Azure / SimuLand

Understand adversary tradecraft and improve detection strategies
MIT License
694 stars 79 forks source link

CreateADForest Conflict Error #24

Closed Dabuek closed 1 year ago

Dabuek commented 2 years ago

Hi,

I am getting a conflict error on the deployment script and work what the issue is, just wondering if theres something obvious I am missing:

I have uploaded the full error txt.

image

Should the CreateADForest Resource exist in both deployWinADFS and CreateADForest like this?

image

image

Error.txt

Dabuek commented 2 years ago

Also, when I log into the DC I can see it has made my domain forest, but hasnt added any of the users other than the adfs and local admin

Cyb3rWard0g commented 2 years ago

Hello @Dabuek ! Thank you for letting me know about this issue. Very interesting. Let me deploy the on-prem environment in my environment to see if I can replicate the error. Have you already tried to run it one more time?

Dabuek commented 2 years ago

I believe I found the issue, I am not using a .com domain - I have a '.co.uk' domain - For example 'simuland.co.uk'

I think therefore the .split is causing an issue;

https://github.com/OTRF/Blacksmith/blob/ee0f5b8eecdb87092c4f36e30cce49db3063fef2/resources/scripts/powershell/dsc/active-directory/Create-AD.ps1#L134

I did a local test using this and the output looks correct

 $DomainName1,$DomainName2,$DomainName3 = ($using:domainFQDN).split('.')
 $ParentPath = "DC=$DomainName1,DC=$DomainName2,DC=$DomainName3 "
Dabuek commented 2 years ago

I think this code would fix my issue, I need to rerun it... but would be good to have it be more dynamic for other TLD's if it is the problem.

https://github.com/Dabuek/Blacksmith/blob/master/resources/scripts/powershell/dsc/active-directory/Create-AD.ps1

Cyb3rWard0g commented 2 years ago

Ahh makes sense. Yeah, that would do it. Let me do some testing with similar domains and see if we can get to a more dynamic approach in here. Sorry for the inconvenience.

Cyb3rWard0g commented 1 year ago

Hello @Dabuek ! This seems to be working now with the following change: https://github.com/OTRF/Blacksmith/blob/master/resources/scripts/powershell/dsc/active-directory/Create-AD.ps1#L28-L30

Thank you for opening this issue. Feel free to re-open it if you still have the same issue.