Active Directory Methodology
{{#include ../../banners/hacktricks-training.md}}
Basic overview
Active Directory ã¯åºç€æè¡ãšããŠæ©èœããnetwork administrators ããããã¯ãŒã¯å ã§ domains, users, ããã³ objects ãå¹ççã«äœæã»ç®¡çã§ããããã«ããŸããã¹ã±ãŒã«ããããã«èšèšããã倿°ã®ãŠãŒã¶ãŒã管çãããã groups ã subgroups ã«æŽçããæ§ã ãªã¬ãã«ã§ access rights ãå¶åŸ¡ã§ããŸãã
Active Directory ã®æ§é ã¯äž»ã«äžã€ã®å±€ã§æ§æãããŠããŸã: domains, trees, ããã³ forestsãdomain ã¯å ±éã®ããŒã¿ããŒã¹ãå ±æãã users ã devices ã®ãããªãªããžã§ã¯ãã®éåãå å«ããŸããtrees ã¯å ±éã®æ§é ã§çµã°ãããããã® domains ã®ã°ã«ãŒãã§ãforest ã¯è€æ°ã® trees ã trust relationships ãä»ããŠæ¥ç¶ãããæäžäœã®çµç¹æ§é ã衚ããŸããåã¬ãã«ã§ç¹å®ã® access ã communication rights ãæå®ã§ããŸãã
Active Directory ã®äž»èŠãªæŠå¿µã«ã¯æ¬¡ã®ãã®ããããŸã:
- Directory â Active Directory ãªããžã§ã¯ãã«é¢ããå šæ å ±ãæ ŒçŽããŸãã
- Object â ãã£ã¬ã¯ããªå ã®å®äœãæããusers, groups, ãŸã㯠shared folders ãªã©ãå«ãŸããŸãã
- Domain â ãã£ã¬ã¯ããªãªããžã§ã¯ãã®ã³ã³ãããšããŠæ©èœããè€æ°ã® domains ã forest å ã«å ±åã§ãããããããç¬èªã®ãªããžã§ã¯ãéåãä¿æããŸãã
- Tree â å ±éã® root domain ãå ±æãã domains ã®ã°ã«ãŒãã§ãã
- Forest â Active Directory ã®çµç¹æ§é ã®é ç¹ã§ãè€æ°ã® trees ãšãããã®éã® trust relationships ã§æ§æãããŸãã
Active Directory Domain Services (AD DS) ã¯ããããã¯ãŒã¯å ã®éäžç®¡çãšéä¿¡ã«éèŠãªäžé£ã®ãµãŒãã¹ãå«ã¿ãŸãããããã®ãµãŒãã¹ã«ã¯æ¬¡ãå«ãŸããŸã:
- Domain Services â ããŒã¿ã®éäžæ ŒçŽãš users ãš domains éã®ããåãã管çããauthentication ã search æ©èœãæäŸããŸãã
- Certificate Services â å®å šãª digital certificates ã®äœæãé åžã管çãè¡ããŸãã
- Lightweight Directory Services â LDAP protocol ãéããŠãã£ã¬ã¯ããªå¯Ÿå¿ã¢ããªã±ãŒã·ã§ã³ããµããŒãããŸãã
- Directory Federation Services â è€æ°ã® web ã¢ããªã±ãŒã·ã§ã³éã§ã® single-sign-on ãæäŸããŸãã
- Rights Management â èäœç©ã®äžæ£é åžã䜿çšãå¶åŸ¡ããŠä¿è·ãæ¯æŽããŸãã
- DNS Service â domain names ã®è§£æ±ºã«äžå¯æ¬ ã§ãã
For a more detailed explanation check: TechTerms - Active Directory Definition
Kerberos Authentication
To learn how to attack an AD you need to understand really good the Kerberos authentication process.
Read this page if you still don't know how it works.
Cheat Sheet
You can take a lot to https://wadcoms.github.io/ to have a quick view of which commands you can run to enumerate/exploit an AD.
Warning
Kerberos communication requires a full qualified name (FQDN) for performing actions. If you try to access a machine by the IP address, it'll use NTLM and not Kerberos.
Recon Active Directory (No creds/sessions)
If you just have access to an AD environment but you don't have any credentials/sessions you could:
- Pentest the network:
- Scan the network, find machines and open ports and try to exploit vulnerabilities or extract credentials from them (for example, printers could be very interesting targets.
- Enumerating DNS could give information about key servers in the domain as web, printers, shares, vpn, media, etc.
gobuster dns -d domain.local -t 25 -w /opt/Seclist/Discovery/DNS/subdomain-top2000.txt
- Take a look to the General Pentesting Methodology to find more information about how to do this.
- Check for null and Guest access on smb services (this won't work on modern Windows versions):
enum4linux -a -u "" -p "" <DC IP> && enum4linux -a -u "guest" -p "" <DC IP>
smbmap -u "" -p "" -P 445 -H <DC IP> && smbmap -u "guest" -p "" -P 445 -H <DC IP>
smbclient -U '%' -L //<DC IP> && smbclient -U 'guest%' -L //
- A more detailed guide on how to enumerate a SMB server can be found here:
{{#ref}} ../../network-services-pentesting/pentesting-smb/ {{#endref}}
- Enumerate Ldap
nmap -n -sV --script "ldap* and not brute" -p 389 <DC IP>
- A more detailed guide on how to enumerate LDAP can be found here (pay special attention to the anonymous access):
{{#ref}} ../../network-services-pentesting/pentesting-ldap.md {{#endref}}
- Poison the network
- Gather credentials impersonating services with Responder
- Access host by abusing the relay attack
- Gather credentials exposing fake UPnP services with evil-SSDP
- OSINT:
- Extract usernames/names from internal documents, social media, services (mainly web) inside the domain environments and also from the publicly available.
- If you find the complete names of company workers, you could try different AD username conventions (read this). The most common conventions are: NameSurname, Name.Surname, NamSur (3letters of each), Nam.Sur, NSurname, N.Surname, SurnameName, Surname.Name, SurnameN, Surname.N, 3 random letters and 3 random numbers (abc123).
- Tools:
- w0Tx/generate-ad-username
- urbanadventurer/username-anarchy
User enumeration
- Anonymous SMB/LDAP enum: Check the pentesting SMB and pentesting LDAP pages.
- Kerbrute enum: When an invalid username is requested the server will respond using the Kerberos error code KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN, allowing us to determine that the username was invalid. Valid usernames will illicit either the TGT in a AS-REP response or the error KRB5KDC_ERR_PREAUTH_REQUIRED, indicating that the user is required to perform pre-authentication.
- No Authentication against MS-NRPC: Using auth-level = 1 (No authentication) against the MS-NRPC (Netlogon) interface on domain controllers. The method calls the
DsrGetDcNameEx2
function after binding MS-NRPC interface to check if the user or computer exists without any credentials. The NauthNRPC tool implements this type of enumeration. The research can be found here
./kerbrute_linux_amd64 userenum -d lab.ropnop.com --dc 10.10.10.10 usernames.txt #From https://github.com/ropnop/kerbrute/releases
nmap -p 88 --script=krb5-enum-users --script-args="krb5-enum-users.realm='DOMAIN'" <IP>
Nmap -p 88 --script=krb5-enum-users --script-args krb5-enum-users.realm='<domain>',userdb=/root/Desktop/usernames.txt <IP>
msf> use auxiliary/gather/kerberos_enumusers
crackmapexec smb dominio.es -u '' -p '' --users | awk '{print $4}' | uniq
python3 nauth.py -t target -u users_file.txt #From https://github.com/sud0Ru/NauthNRPC
- OWA (Outlook Web Access) Server
ãããã¯ãŒã¯å ã§ãããã®ãµãŒããŒãèŠã€ããå Žåãuser enumeration against it ãå®è¡ããããšãã§ããŸããäŸãã°ãããŒã« MailSniper ã䜿çšã§ããŸã:
ipmo C:\Tools\MailSniper\MailSniper.ps1
# Get info about the domain
Invoke-DomainHarvestOWA -ExchHostname [ip]
# Enumerate valid users from a list of potential usernames
Invoke-UsernameHarvestOWA -ExchHostname [ip] -Domain [domain] -UserList .\possible-usernames.txt -OutFile valid.txt
# Password spraying
Invoke-PasswordSprayOWA -ExchHostname [ip] -UserList .\valid.txt -Password Summer2021
# Get addresses list from the compromised mail
Get-GlobalAddressList -ExchHostname [ip] -UserName [domain]\[username] -Password Summer2021 -OutFile gal.txt
Warning
ãŠãŒã¶ãŒåã®äžèŠ§ã¯ this github repo ããã³ (statistically-likely-usernames) ã«ãããŸãã
ãã ããäºåã«è¡ãã¹ã recon ã¹ãããã§ãã®äŒç€Ÿã§åããŠãã人ã ã® name ãææ¡ããŠããã¹ãã§ããååãšå§ããããã°ã¹ã¯ãªãã namemash.py ã䜿ã£ãŠæå¹ãª username ã®åè£ãçæã§ããŸãã
Knowing one or several usernames
OKããã§ã«æå¹ãª username ãææ¡ããŠããã passwords ãæã£ãŠããªãå Žåã¯ã次ã詊ããŠãã ãã:
- ASREPRoast: ãŠãŒã¶ãŒã屿§ DONT_REQ_PREAUTH ã æã£ãŠããªã å Žåããã®ãŠãŒã¶ãŒã® AS_REP ã¡ãã»ãŒãžã èŠæ± ã§ãããã®ã¡ãã»ãŒãžã¯ãŠãŒã¶ãŒã® password ã®å°åºã§æå·åãããããŒã¿ãå«ã¿ãŸãã
- Password Spraying: çºèŠããåãŠãŒã¶ãŒã«å¯ŸããŠæã äžè¬ç㪠passwords ã詊ããŠã¿ãŠãã ãããæªã password ã䜿ã£ãŠãããŠãŒã¶ãŒããããããããŸããïŒpassword policy ãå¿ããã«ïŒïŒã
- OWA ãµãŒããŒã spray ããŠãŠãŒã¶ãŒã® mail ãµãŒããŒãžã®ã¢ã¯ã»ã¹ã詊ã¿ãããšãã§ããŸãã
{{#ref}} password-spraying.md {{#endref}}
LLMNR/NBT-NS Poisoning
äžéšã®ãã£ã¬ã³ãž hashes ãååŸããŠãããã¯ãŒã¯å ã®ããã€ãã®ãããã³ã«ã poisoning ããåŸã§ crack ããããšãã§ãããããããŸãã:
{{#ref}} ../../generic-methodologies-and-resources/pentesting-network/spoofing-llmnr-nbt-ns-mdns-dns-and-wpad-and-relay-attacks.md {{#endref}}
NTLM Relay
Active Directory ãåæã§ããŠããã°ãããå€ãã®ã¡ãŒã«ã¢ãã¬ã¹ããããã¯ãŒã¯ã®çè§£ ãåŸãããŸããNTLM relay attacks ã匷å¶ã㊠AD ç°å¢ãžã¢ã¯ã»ã¹ã§ããå¯èœæ§ããããŸãã
Steal NTLM Creds
null ã guest user ã§ä»ã® PC ã shares ã« ã¢ã¯ã»ã¹ ã§ããå ŽåãSCF ãã¡ã€ã«ã®ãããªãã¡ã€ã«ã é 眮 ããŠã誰ãããããåç §ãããš ããªãã«å¯Ÿãã NTLM èªèšŒãããªã¬ãŒãããNTLM ãã£ã¬ã³ãžãçãã§ crack ã§ããå¯èœæ§ããããŸã:
{{#ref}} ../ntlm/places-to-steal-ntlm-creds.md {{#endref}}
è³æ Œæ å ±/ã»ãã·ã§ã³ããã§ã® Active Directory åæ
ãã®ãã§ãŒãºã§ã¯ãæå¹ãªãã¡ã€ã³ã¢ã«ãŠã³ãã® credentials ãŸã㯠session ã奪å ããŠããå¿ èŠããããŸããããæå¹ãª credentials ããã¡ã€ã³ãŠãŒã¶ãŒãšããŠã®ã·ã§ã«ãæã£ãŠãããªããåã«æãããªãã·ã§ã³ã¯ä»ã®ãŠãŒã¶ãŒã䟵害ããããã®éžæè¢ãšããŠåŒãç¶ãæå¹ã§ããããšãèŠããŠãããŠãã ããã
èªèšŒæžã¿åæãéå§ããåã«ãKerberos double hop problem ãçè§£ããŠããã¹ãã§ãã
{{#ref}} kerberos-double-hop-problem.md {{#endref}}
åæ
ã¢ã«ãŠã³ãã䟵害ããããšã¯ãã¡ã€ã³å šäœã䟵害ãå§ãããã㮠倧ããªäžæ© ã§ããããã«ãã Active Directory åæãéå§ã§ããŸã:
ASREPRoast ã«é¢ããŠã¯ãä»ãè匱ãªãŠãŒã¶ãŒãå šãŠèŠã€ããããŸãããPassword Spraying ã«é¢ããŠã¯ããã¹ãŠã® username ã®ãªã¹ã ãååŸããŠã䟵害ããã¢ã«ãŠã³ãã® passwordã空㮠passwordããã®ä»ææãª password ã詊ãããšãã§ããŸãã
- åºæ¬ç㪠recon ãå®è¡ããã«ã¯ CMD to perform a basic recon ã䜿ãããšãã§ããŸã
- ããã¹ãã«ã¹ã«è¡ããªã powershell for recon ã䜿çšã§ããŸã
- ããè©³çŽ°ãªæ å ±ãæœåºããã«ã¯ use powerview ã䜿ããŸã
- Active Directory ã® recon ã«äŸ¿å©ãªããŒã«ãšã㊠BloodHound ããããŸããåéæ¹æ³ã«ãã£ãŠã¯ ããŸãã¹ãã«ã¹ã§ã¯ãããŸãã ããæ°ã«ããªããªããã²è©ŠããŠãã ãããã©ãã§ãŠãŒã¶ãŒã RDP ã§ããããä»ã®ã°ã«ãŒããžã®ãã¹ãªã©ãèŠã€ããããŸãã
- ãã®ä»ã®èªååããã AD åæããŒã«: AD Explorer, ADRecon, Group3r, PingCastleã
- è峿·±ãæ å ±ãå«ãŸããŠããå¯èœæ§ãããã®ã§ãAD ã® DNS ã¬ã³ãŒã ã確èªããŠãã ããã
- GUI ããŒã¹ã®ãã£ã¬ã¯ããªåæããŒã«ãšããŠã¯ SysInternal Suite ã® AdExplorer.exe ã䜿ããŸãã
- ldapsearch ã䜿ã£ãŠ LDAP ããŒã¿ããŒã¹ãæ€çŽ¢ãããã£ãŒã«ã userPassword ã unixUserPasswordãããã㯠Description ã« credential ããªããæ¢ãããšãã§ããŸãããã®ä»ã®æ¹æ³ã«ã€ããŠã¯ PayloadsAllTheThings ã® "Password in AD User comment" ãåç §ããŠãã ããïŒhttps://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Active%20Directory%20Attack.md#password-in-ad-user-commentïŒã
- Linux ã䜿ã£ãŠãããªã pywerview ã§ãã¡ã€ã³ãåæã§ããŸãã
- èªååããŒã«ã®äŸ:
- tomcarver16/ADSearch
- 61106960/adPEAS
- Extracting all domain users
Windows ã§ã¯ãã¡ã€ã³å
ã®å
šãŠãŒã¶ãŒåãååŸããã®ã¯éåžžã«ç°¡åã§ãïŒnet user /domain
ãGet-DomainUser
ããŸã㯠wmic useraccount get name,sid
ïŒãLinux ã§ã¯ GetADUsers.py -all -dc-ip 10.10.10.110 domain.com/username
ã enum4linux -a -u "user" -p "password" <DC IP>
ã䜿ããŸãã
ãã®åæã»ã¯ã·ã§ã³ã¯çãèŠãããããããŸããããæãéèŠãªéšåã§ãããªã³ã¯å ïŒäž»ã« cmd, powershell, powerview, BloodHoundïŒãåç §ããŠããã¡ã€ã³ã®åææ¹æ³ãåŠã³ãååã«æ £ãããŸã§ç·Žç¿ããŠãã ãããè©äŸ¡æã«ãããã DA ã«å°éããéµãšãªãããäœãã§ããªããšå€æããæ±ºå®ç¹ã«ãªããŸãã
Kerberoast
Kerberoasting ã¯ããµãŒãã¹ã«çŽã¥ããŠãŒã¶ãŒã¢ã«ãŠã³ãã®ããã«äœ¿ããã TGS tickets ãååŸãããã®æå·åïŒãŠãŒã¶ãŒã® password ã«åºã¥ãïŒããªãã©ã€ã³ã§ crack ããæ»æã§ãã
詳ããã¯ä»¥äžãåç §ããŠãã ãã:
{{#ref}} kerberoast.md {{#endref}}
Remote connexion (RDP, SSH, FTP, Win-RM, etc)
ãã£ãã credentials ãå ¥æããããã©ã® machine ã«ã¢ã¯ã»ã¹ã§ããã確èªããŠãã ããããã®ããã«ãããŒãã¹ãã£ã³ã«åºã¥ããŠæ§ã ãªãããã³ã«ã§è€æ°ã®ãµãŒããŒã«æ¥ç¶ã詊ã¿ãããã« CrackMapExec ã䜿ãããšãã§ããŸãã
Local Privilege Escalation
éåžžã®ãã¡ã€ã³ãŠãŒã¶ãŒãšã㊠credentials ã session ã奪åãããã®ãŠãŒã¶ãŒã§ãã¡ã€ã³å ã® ä»»æã®ãã·ã³ã«ã¢ã¯ã»ã¹ ã§ããå Žåã¯ãããŒã«ã«ã§ã®æš©éææ Œãš credential ã®åéã詊ã¿ãã¹ãã§ããããŒã«ã«ç®¡çè æš©éãåŸãŠåããŠãä»ã®ãŠãŒã¶ãŒã®ããã·ã¥ãã¡ã¢ãªïŒLSASSïŒãããŒã«ã«ïŒSAMïŒãããã³ãã§ããŸãã
ãã®æžç±ã«ã¯ local privilege escalation in Windows ã«é¢ããå®å šãªããŒãžãšãchecklist ããããŸãããŸã WinPEAS ã®äœ¿çšãå¿ããªãã§ãã ããã
Current Session Tickets
çŸåšã®ãŠãŒã¶ãŒã«äºæããªããªãœãŒã¹ãžã®ã¢ã¯ã»ã¹æš©ãäžãããã㪠tickets ãèŠã€ããå¯èœæ§ã¯éåžžã« äœã ã§ãããæ¬¡ã®ç¹ã確èªããããšã¯ã§ããŸãïŒ
## List all tickets (if not admin, only current user tickets)
.\Rubeus.exe triage
## Dump the interesting one by luid
.\Rubeus.exe dump /service:krbtgt /luid:<luid> /nowrap
[IO.File]::WriteAllBytes("ticket.kirbi", [Convert]::FromBase64String("<BASE64_TICKET>"))
NTLM Relay
If you have managed to enumerate the active directory you will have more emails and a better understanding of the network. You might be able to to force NTLM relay attacks.
Looks for Creds in Computer Shares | SMB Shares
åºæ¬çãªè³æ Œæ å ±ãå ¥æããããAD å ã§å ±æãããŠããè峿·±ããã¡ã€ã«ãèŠã€ããããªããã確èªãã¹ãã§ããæäœæ¥ã§ãå¯èœã§ãããéåžžã«éå±ã§å埩çãªäœæ¥ã«ãªããŸãïŒæ°çŸã®ããã¥ã¡ã³ãã確èªããå¿ èŠãããå Žåã¯ããã«å€§å€ã§ãïŒã
䜿çšã§ããããŒã«ã«ã€ããŠã¯ãã¡ããåç §ããŠãã ããã
Steal NTLM Creds
ä»ã®PCãå ±æã«ã¢ã¯ã»ã¹ã§ããå Žåãã¢ã¯ã»ã¹ããããšããªãã«å¯ŸããŠNTLMèªèšŒãåŒãèµ·ãããããªãã¡ã€ã«ïŒäŸãã° SCF ãã¡ã€ã«ïŒãé 眮ããŠãNTLM challenge ãçã¿åºããŠè§£æããããšãã§ããŸã:
{{#ref}} ../ntlm/places-to-steal-ntlm-creds.md {{#endref}}
CVE-2021-1675/CVE-2021-34527 PrintNightmare
ãã®è匱æ§ã«ãããèªèšŒæžã¿ã®ä»»æã®ãŠãŒã¶ãŒããã¡ã€ã³ã³ã³ãããŒã©ãŒã䟵害ã§ããŸããã
{{#ref}} printnightmare.md {{#endref}}
Privilege escalation on Active Directory WITH privileged credentials/session
For the following techniques a regular domain user is not enough, you need some special privileges/credentials to perform these attacks.
Hash extraction
幞ãã«ããAsRepRoastãPassword SprayingãKerberoastãResponderïŒãªã¬ãŒãå«ãïŒãEvilSSDPãescalating privileges locallyãªã©ã䜿ã£ãŠããã€ãã®ããŒã«ã«ç®¡çè
ã¢ã«ãŠã³ãã䟵害ã§ããŠããããšãæåŸ
ããŸãã
ãã®åŸãã¡ã¢ãªäžããã³ããŒã«ã«ã«ãããã¹ãŠã®ããã·ã¥ããã³ãããæã§ãã
ããã·ã¥ãååŸããããŸããŸãªæ¹æ³ã«ã€ããŠã¯ãã¡ããèªãã§ãã ããã
Pass the Hash
Once you have the hash of a user, you can use it to impersonate it.
You need to use some tool that will perform the NTLM authentication using that hash, or you could create a new sessionlogon and inject that hash inside the LSASS, so when any NTLM authentication is performed, that hash will be used. The last option is what mimikatz does.
Read this page for more information.
Over Pass the Hash/Pass the Key
This attack aims to use the user NTLM hash to request Kerberos tickets, as an alternative to the common Pass The Hash over NTLM protocol. Therefore, this could be especially useful in networks where NTLM protocol is disabled and only Kerberos is allowed as authentication protocol.
{{#ref}} over-pass-the-hash-pass-the-key.md {{#endref}}
Pass the Ticket
In the Pass The Ticket (PTT) attack method, attackers steal a user's authentication ticket instead of their password or hash values. This stolen ticket is then used to impersonate the user, gaining unauthorized access to resources and services within a network.
{{#ref}} pass-the-ticket.md {{#endref}}
Credentials Reuse
ããŒã«ã«ç®¡çè ã®ããã·ã¥ãŸãã¯ãã¹ã¯ãŒããå ¥æããŠããå Žåã¯ãããã䜿ã£ãŠä»ã®PCã«ããŒã«ã«ãã°ã€ã³ã詊ã¿ãŠãã ããã
# Local Auth Spray (once you found some local admin pass or hash)
## --local-auth flag indicate to only try 1 time per machine
crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9cab376ecd08491764a0 | grep +
Warning
ããã¯ããªããã€ãžãŒã§ãããLAPSã§ç·©åã§ããç¹ã«æ³šæããŠãã ããã
MSSQL Abuse & Trusted Links
ãŠãŒã¶ãŒãMSSQL ã€ã³ã¹ã¿ã³ã¹ã«ã¢ã¯ã»ã¹ããæš©éãæã£ãŠããå ŽåãMSSQL ãã¹ãäžã§ïŒSA ãšããŠå®è¡ãããŠããã°ïŒã³ãã³ããå®è¡ããããNetNTLM ã® hash ãçããããã㯠relay attack ãè¡ãããšãå¯èœã§ãã
ãŸãããã MSSQL ã€ã³ã¹ã¿ã³ã¹ãå¥ã® MSSQL ã€ã³ã¹ã¿ã³ã¹ããä¿¡é ŒïŒdatabase linkïŒãããŠããå ŽåããŠãŒã¶ãŒãä¿¡é ŒãããããŒã¿ããŒã¹äžã®æš©éãæã£ãŠããã°ãä¿¡é Œé¢ä¿ãå©çšããŠå¥ã€ã³ã¹ã¿ã³ã¹ã§ãã¯ãšãªãå®è¡ããããšãã§ããŸãããããã®ä¿¡é Œã¯é£éããå¯èœæ§ããããæçµçã«ã³ãã³ãå®è¡å¯èœãªèª€èšå®ãããããŒã¿ããŒã¹ãèŠã€ããããšãããããŸãã
ããŒã¿ããŒã¹éã®ãªã³ã¯ã¯ãã©ã¬ã¹ããã©ã¹ããè·šãã§ãæ©èœããŸãã
{{#ref}} abusing-ad-mssql.md {{#endref}}
IT asset/deployment platforms abuse
ãµãŒãããŒãã£ã®ã€ã³ãã³ããª/ãããã€ã¡ã³ãã¹ã€ãŒãã¯ããã°ãã°è³æ Œæ å ±ãã³ãŒãå®è¡ãžã®åŒ·åãªçµè·¯ãé²åºããŸããåç §ïŒ
{{#ref}} sccm-management-point-relay-sql-policy-secrets.md {{#endref}}
{{#ref}} lansweeper-security.md {{#endref}}
Unconstrained Delegation
屿§ ADS_UF_TRUSTED_FOR_DELEGATION ãæã€ Computer ãªããžã§ã¯ããèŠã€ãããã€ãã®ã³ã³ãã¥ãŒã¿äžã§ãã¡ã€ã³æš©éãæã£ãŠããå Žåãåœè©²ã³ã³ãã¥ãŒã¿ã«ãã°ã€ã³ãããã¹ãŠã®ãŠãŒã¶ãŒã® TGT ãã¡ã¢ãªãããã³ãããããšãã§ããŸãã
ãããã£ãŠãDomain Admin ããã®ã³ã³ãã¥ãŒã¿ã«ãã°ã€ã³ããå Žåããã® TGT ããã³ãã㊠Pass the Ticket ã䜿ã£ãŠæš©éãåœè£
ã§ããŸãã
constrained delegation ã«ãããããªã³ããµãŒããŒãèªåçã«ä¹ã£åãïŒéãè¯ããã°ããã DC ã§ããïŒããšããå¯èœã§ãã
{{#ref}} unconstrained-delegation.md {{#endref}}
Constrained Delegation
ãŠãŒã¶ãŒãã³ã³ãã¥ãŒã¿ã "Constrained Delegation" ãèš±å¯ãããŠãããšãããã³ã³ãã¥ãŒã¿äžã®ç¹å®ãµãŒãã¹ã«å¯ŸããŠä»»æã®ãŠãŒã¶ãŒãåœè£
ããŠã¢ã¯ã»ã¹ããããšãå¯èœã«ãªããŸãã
ãã®ããããã®ãŠãŒã¶ãŒ/ã³ã³ãã¥ãŒã¿ã® hash ã奪åããã°ãïŒDomain Admin ãå«ãïŒä»»æã®ãŠãŒã¶ãŒãåœè£
ããŠãµãŒãã¹ã«ã¢ã¯ã»ã¹ã§ããŸãã
{{#ref}} constrained-delegation.md {{#endref}}
Resourced-based Constrain Delegation
ãªã¢ãŒãã³ã³ãã¥ãŒã¿ã® Active Directory ãªããžã§ã¯ãã«å¯Ÿã㊠WRITE æš©éããããšãææ Œæš©éã§ã®ã³ãŒãå®è¡ãéæã§ããå¯èœæ§ããããŸãïŒ
{{#ref}} resource-based-constrained-delegation.md {{#endref}}
Permissions/ACLs Abuse
䟵害ãããŠãŒã¶ãŒãäžéšã®ãã¡ã€ã³ãªããžã§ã¯ãã«å¯ŸããŠè峿·±ãæš©éãæã£ãŠããå Žåãããã«ããæšªå±éãæš©éææ Œãå¯èœã«ãªãããšããããŸãã
{{#ref}} acl-persistence-abuse/ {{#endref}}
Printer Spooler service abuse
ãã¡ã€ã³å ã§ Spool ãµãŒãã¹ããªãã¹ã³ããŠããããšãçºèŠãããšããããæªçšããŠæ°ããªè³æ Œæ å ±ãååŸããããæš©éææ Œãè¡ã£ããã§ããŸãã
{{#ref}} printers-spooler-service-abuse.md {{#endref}}
Third party sessions abuse
ä»ã®ãŠãŒã¶ãŒã䟵害ããããã·ã³ã«ã¢ã¯ã»ã¹ããŠããå Žåãã¡ã¢ãªããè³æ Œæ
å ±ãåéãããã圌ãã®ããã»ã¹ã«ããŒã³ã³ãã€ã³ãžã§ã¯ãããŠåœè£
ããããšãå¯èœã§ãã
éåžžãŠãŒã¶ãŒã¯ RDP ã§ã·ã¹ãã ã«ã¢ã¯ã»ã¹ããããã第äžè
ã® RDP ã»ãã·ã§ã³ã«å¯Ÿããããã€ãã®æ»æææ³ã¯æ¬¡ã®éãã§ãïŒ
{{#ref}} rdp-sessions-abuse.md {{#endref}}
LAPS
LAPS ã¯ãã¡ã€ã³åå ã³ã³ãã¥ãŒã¿ã®ããŒã«ã« Administrator ãã¹ã¯ãŒãã管çããã·ã¹ãã ã§ãããããã©ã³ãã åã»äžæåã»é »ç¹ã«å€æŽããŸãããããã®ãã¹ã¯ãŒã㯠Active Directory ã«ä¿åãããACL ã«ãã£ãŠèš±å¯ããããŠãŒã¶ãŒã®ã¿ãã¢ã¯ã»ã¹ã§ããŸãããããã®ãã¹ã¯ãŒãã«ã¢ã¯ã»ã¹ã§ããååãªæš©éãããã°ãä»ã®ã³ã³ãã¥ãŒã¿ãžã®ãããããå¯èœã«ãªããŸãã
{{#ref}} laps.md {{#endref}}
Certificate Theft
䟵害ãããã·ã³ããèšŒææžãåéããããšã¯ãç°å¢å ã§ã®æš©éææ Œææ®µã«ãªãåŸãŸãïŒ
{{#ref}} ad-certificates/certificate-theft.md {{#endref}}
Certificate Templates Abuse
è匱ãªãã³ãã¬ãŒããèšå®ãããŠããå ŽåããããæªçšããŠæš©éææ Œããããšãå¯èœã§ãïŒ
{{#ref}} ad-certificates/domain-escalation.md {{#endref}}
Post-exploitation with high privilege account
Dumping Domain Credentials
äžåºŠ Domain Adminããããã¯ããã« Enterprise Admin ã®æš©éãåŸããããã¡ã€ã³ããŒã¿ããŒã¹ã§ãã ntds.dit ããã³ãã§ããŸãã
DCSync attack ã«é¢ãã詳现ã¯ããã«ãããŸãã
NTDS.dit ã®çã¿æ¹ã«é¢ãã詳现ã¯ããã«ãããŸã
Privesc as Persistence
åè¿°ã®ããã€ãã®ææ³ã¯ãæ°žç¶åã«ãå©çšã§ããŸãã
äŸãã°ã次ã®ãããªããšãå¯èœã§ãïŒ
- ãŠãŒã¶ãŒã Kerberoast ã«è匱ã«ãã
Set-DomainObject -Identity <username> -Set @{serviceprincipalname="fake/NOTHING"}r
- ãŠãŒã¶ãŒã ASREPRoast ã«è匱ã«ãã
Set-DomainObject -Identity <username> -XOR @{UserAccountControl=4194304}
- ãŠãŒã¶ãŒã« DCSync æš©éãä»äžãã
Add-DomainObjectAcl -TargetIdentity "DC=SUB,DC=DOMAIN,DC=LOCAL" -PrincipalIdentity bfarmer -Rights DCSync
Silver Ticket
Silver Ticket attack ã¯ãç¹å®ãµãŒãã¹åãã®æ£åœãª TGS ãã±ãããïŒäŸãã° PC ã¢ã«ãŠã³ãã®ïŒNTLM hash ã䜿ã£ãŠäœæãããã®ãµãŒãã¹ã®æš©éãžã¢ã¯ã»ã¹ããææ³ã§ãã
{{#ref}} silver-ticket.md {{#endref}}
Golden Ticket
Golden Ticket attack ã¯ãActive Directory ç°å¢ã§ krbtgt ã¢ã«ãŠã³ãã® NTLM hash ãå ¥æããããšã§è¡ãããŸãããã®ã¢ã«ãŠã³ãã¯ãã¹ãŠã® TGT ã眲åããããã«äœ¿ãããç¹å¥ãªã¢ã«ãŠã³ãã§ãã
æ»æè ããã®ããã·ã¥ãååŸãããšãä»»æã®ã¢ã«ãŠã³ãã® TGT ãçæã§ãïŒSilver ticket attack ãšåæ§ïŒããããã¯ãŒã¯å ã§ã®èªèšŒãåœè£ ã§ããŸãã
{{#ref}} golden-ticket.md {{#endref}}
Diamond Ticket
golden ticket ã«äŒŒãŠããŸãããäžè¬ç㪠golden ticket æ€åºã¡ã«ããºã ãåé¿ããããã«å å·¥ããããã±ããã§ãã
{{#ref}} diamond-ticket.md {{#endref}}
Certificates Account Persistence
ã¢ã«ãŠã³ãã®èšŒææžãä¿æããŠããããããã¯èŠæ±ã§ããããšã¯ããã¹ã¯ãŒãã倿ŽãããŠããã®ã¢ã«ãŠã³ãã«æ°žç¶çã«ã¢ã¯ã»ã¹ããéåžžã«æå¹ãªæ¹æ³ã§ãïŒ
{{#ref}} ad-certificates/account-persistence.md {{#endref}}
Certificates Domain Persistence
èšŒææžãçšããããšã§ãã¡ã€ã³å ã§é«æš©éãç¶æããããšãå¯èœã§ãïŒ
{{#ref}} ad-certificates/domain-persistence.md {{#endref}}
AdminSDHolder Group
Active Directory ã® AdminSDHolder ãªããžã§ã¯ãã¯ãDomain Admins ã Enterprise Admins ã®ãããªç¹æš©ã°ã«ãŒãã®ã»ãã¥ãªãã£ãä¿ã€ããã«ãæšæºã® ACL ãé©çšããŠãããã®ã°ã«ãŒããžã®äžæ£ãªå€æŽãé²ããŸãããããããã®æ©èœã¯æªçšãããããšããããæ»æè ã AdminSDHolder ã® ACL ã倿ŽããŠéåžžãŠãŒã¶ãŒã«ãã«ã¢ã¯ã»ã¹ãäžãããšããã®ãŠãŒã¶ãŒã¯ãã¹ãŠã®ç¹æš©ã°ã«ãŒãã«å¯Ÿããåºç¯ãªå¶åŸ¡ãåŸãŠããŸããŸããä¿è·ãæå³ãããã®ä»çµã¿ããç£èŠãããŠããªããšéã«äžæ£ã¢ã¯ã»ã¹ãèš±ãåå ã«ãªããŸãã
AdminDSHolder Group ã«é¢ãã詳现ã¯ãã¡ãã
DSRM Credentials
ãã¹ãŠã® Domain Controller (DC) ã«ã¯ããŒã«ã«ã®ç®¡çè ã¢ã«ãŠã³ããååšããŸãããã®ãããªãã·ã³ã§ç®¡çè æš©éãååŸãããšãmimikatz ã䜿ã£ãŠããŒã«ã« Administrator ã®ããã·ã¥ãæœåºã§ããŸãããã®åŸãã¬ãžã¹ããªã®å€æŽã«ãããã®ãã¹ã¯ãŒãã®å©çšãæå¹åããããŒã«ã« Administrator ã¢ã«ãŠã³ããžã®ãªã¢ãŒãã¢ã¯ã»ã¹ãå¯èœã«ããŸãã
{{#ref}} dsrm-credentials.md {{#endref}}
ACL Persistence
ç¹å®ã®ãã¡ã€ã³ãªããžã§ã¯ãã«å¯ŸããŠãŠãŒã¶ãŒã«ç¹å¥ãªæš©éãäžããããšã§ããã®åŸã«ãã®ãŠãŒã¶ãŒãæš©éãææ Œã§ããããã«ããããšãã§ããŸãã
{{#ref}} acl-persistence-abuse/ {{#endref}}
Security Descriptors
security descriptors ã¯ãªããžã§ã¯ããæã€æš©éãä¿æããããã«äœ¿ãããŸãããªããžã§ã¯ãã® security descriptor ã«å°ããªå€æŽãå ããã ãã§ãç¹æš©ã°ã«ãŒãã«å±ããŠããªããŠããã®ãªããžã§ã¯ãã«å¯ŸããŠéåžžã«åŒ·åãªæš©éãååŸã§ããå ŽåããããŸãã
{{#ref}} security-descriptors.md {{#endref}}
Skeleton Key
ã¡ã¢ãªå ã® LSASS ãæ¹å€ããŠ**å šã¢ã«ãŠã³ãå ±éã®ãã¹ã¯ãŒãïŒuniversal passwordïŒ**ãèšå®ããå šãã¡ã€ã³ã¢ã«ãŠã³ããžã®ã¢ã¯ã»ã¹ãåŸãŸãã
{{#ref}} skeleton-key.md {{#endref}}
Custom SSP
SSP (Security Support Provider) ãäœãã¯ãã¡ããåç
§ã
ç¬èªã® SSP ãäœæããŠããã·ã³ãžã®ã¢ã¯ã»ã¹ã«äœ¿çšãããè³æ Œæ
å ±ãå¹³æã§ãã£ããã£ããããšãã§ããŸãã
{{#ref}} custom-ssp.md {{#endref}}
DCShadow
AD ã« æ°ãã Domain Controller ãç»é²ããããã䜿ã£ãŠæå®ãªããžã§ã¯ãã«å¯ŸããŠïŒSIDHistory, SPNs... ãªã©ïŒå±æ§ã ãã°ãæ®ããã« push ããŸããDA æš©éãå¿
èŠã§ãã«ãŒããã¡ã€ã³å
ã§å®è¡ããå¿
èŠããããŸãã
ãã ã誀ã£ãããŒã¿ã䜿ããšæŽŸæãªãã°ãæ®ãç¹ã«æ³šæããŠãã ããã
{{#ref}} dcshadow.md {{#endref}}
LAPS Persistence
åè¿°ããããã«ãLAPS ãã¹ã¯ãŒããèªãååãªæš©éããããšæš©éææ Œã§ããŸããããããã®ãã¹ã¯ãŒãã¯æ°žç¶åã«ãå©çšå¯èœã§ãã
åç
§ïŒ
{{#ref}} laps.md {{#endref}}
Forest Privilege Escalation - Domain Trusts
Microsoft 㯠Forest ãã»ãã¥ãªãã£å¢çãšèŠãªããŠããŸããã€ãŸã åäžãã¡ã€ã³ã®äŸµå®³ããã©ã¬ã¹ãå šäœã®äŸµå®³ã«ã€ãªããå¯èœæ§ããããšããããšã§ãã
Basic Information
domain trust ã¯ããã ãã¡ã€ã³ ã®ãŠãŒã¶ãŒãå¥ã® ãã¡ã€ã³ ã®ãªãœãŒã¹ãžã¢ã¯ã»ã¹ããããšãå¯èœã«ããã»ãã¥ãªãã£æ©æ§ã§ãããã¡ã€ã³éã®èªèšŒã·ã¹ãã ãé£çµããèªèšŒæ å ±ã®ããåããå¯èœã«ããŸãããã¡ã€ã³ãä¿¡é Œãèšå®ãããšãäž¡ãã¡ã€ã³ã® Domain Controller (DC) ã«ãã®ä¿¡é Œã®æŽåæ§ãä¿ã€ããã®ç¹å®ã® ã㌠ã亀æã»ä¿æãããŸãã
å žåçãªã·ããªãªã§ã¯ããŠãŒã¶ãŒãä¿¡é Œããããã¡ã€ã³ã®ãµãŒãã¹ãžã¢ã¯ã»ã¹ããã«ã¯ããŸãèªèº«ã®ãã¡ã€ã³ã® DC ãã inter-realm TGT ãèŠæ±ããå¿ èŠããããŸãããã® TGT ã¯äž¡ãã¡ã€ã³ã§å ±æããã trust key ã§æå·åãããŸãããŠãŒã¶ãŒã¯ãã® inter-realm TGT ãä¿¡é Œå ãã¡ã€ã³ã® DC ã«æåºã㊠TGS ãååŸããŸããä¿¡é Œå ã® DC ã inter-realm TGT ãæ€èšŒãããšã察象ãµãŒãã¹ã®ããã® TGS ãçºè¡ããŠã¢ã¯ã»ã¹ãèš±å¯ããŸãã
æé :
- Domain 1 ã®ã¯ã©ã€ã¢ã³ãã³ã³ãã¥ãŒã¿ãããã® NTLM hash ã䜿çšã㊠Ticket Granting Ticket (TGT) ããã® Domain Controller (DC1) ã«èŠæ±ããã
- ã¯ã©ã€ã¢ã³ããèªèšŒããããš DC1 ã¯æ°ãã TGT ãçºè¡ããã
- ã¯ã©ã€ã¢ã³ã㯠Domain 2 ã®ãªãœãŒã¹ã«ã¢ã¯ã»ã¹ããããã« DC1 ãã inter-realm TGT ãèŠæ±ããã
- inter-realm TGT ã¯ã2-way domain trust ã®äžéšãšã㊠DC1 ãš DC2 ãå ±æãã trust key ã§æå·åãããã
- ã¯ã©ã€ã¢ã³ã㯠inter-realm TGT ã Domain 2 ã® Domain Controller (DC2) ã«æã£ãŠããã
- DC2 ã¯å ±æããã trust key ã䜿ã£ãŠ inter-realm TGT ãæ€èšŒããæå¹ã§ããã°ã¯ã©ã€ã¢ã³ããã¢ã¯ã»ã¹ããããšãã Domain 2 å ã®ãµãŒãåãã« Ticket Granting Service (TGS) ãçºè¡ããã
- æåŸã«ã¯ã©ã€ã¢ã³ãã¯ãã® TGS ããµãŒãã«æç€ºãããµãŒãã®ã¢ã«ãŠã³ãããã·ã¥ã§æå·åãããããã«ãã£ãŠ Domain 2 ã®ãµãŒãã¹ãžã¢ã¯ã»ã¹ããã
Different trusts
ä¿¡é Œã¯ äžæ¹åïŒ1 wayïŒãåæ¹åïŒ2 waysïŒ ã«ãªãåŸãç¹ã«æ³šæããŠãã ãããåæ¹åã®å Žåã¯äž¡ãã¡ã€ã³ãäºããä¿¡é ŒããŸãããäžæ¹éè¡ã®å Žåã¯çæ¹ã trustedãããçæ¹ã trusting ã«ãªããŸãããã®å Žåãtrusted åŽãã㯠trusting ãã¡ã€ã³å ã®ãªãœãŒã¹ã«ããã¢ã¯ã»ã¹ã§ããŸããã
ãã Domain A ã Domain B ãä¿¡é ŒããŠãããªããA ã trusting domainãB ã trusted domain ã§ããããã«ãDomain A ã§ã¯ãã㯠Outbound trust ã«ãªããDomain B ã§ã¯ Inbound trust ã«ãªããŸãã
ç°ãªãä¿¡é Œé¢ä¿ã®çš®é¡
- Parent-Child Trusts: åäžãã©ã¬ã¹ãå ã§ããããæ§æã§ãåãã¡ã€ã³ã¯èŠªãã¡ã€ã³ãšèªåçã« two-way transitive trust ãæã¡ãŸããèªèšŒèŠæ±ã¯èŠªãšåã®éã§ééçã«æµããŸãã
- Cross-link Trusts: "shortcut trusts" ãšãåŒã°ããåãã¡ã€ã³éã®åç §ãé«éåããããã«èšå®ãããŸããå€§èŠæš¡ãªãã©ã¬ã¹ãã§ã¯èªèšŒåç §ããã©ã¬ã¹ãã«ãŒããŸã§äžãã£ãŠããç®çãã¡ã€ã³ãžéããå¿ èŠããããcross-link ã«ãã£ãŠãã®çµè·¯ãççž®ãããŸãã
- External Trusts: ç¡é¢ä¿ãªå¥ãã¡ã€ã³éã§èšå®ãããéæšç§»çãªä¿¡é Œã§ããMicrosoft ã®ããã¥ã¡ã³ãã«ããã°ãexternal trusts ã¯ãã©ã¬ã¹ããã©ã¹ãã§æ¥ç¶ãããŠããªãå€éšãã¡ã€ã³ã®ãªãœãŒã¹ã«ã¢ã¯ã»ã¹ããéã«æçšã§ãSID ãã£ã«ã¿ãªã³ã°ã«ãã£ãŠã»ãã¥ãªãã£ã匷åãããŸãã
- Tree-root Trusts: ãã©ã¬ã¹ãã«ãŒããã¡ã€ã³ãšæ°ãã远å ãããããªãŒã«ãŒãéã«èªåçã«ç¢ºç«ãããä¿¡é Œã§ããæ°ãããã¡ã€ã³ããªãŒããã©ã¬ã¹ãã«è¿œå ããéã«éèŠã§ãäºæ¹åã®æšç§»æ§ãä¿æããŸãã
- Forest Trusts: äºã€ã®ãã©ã¬ã¹ãã«ãŒããã¡ã€ã³éã® two-way transitive trust ã§ãSID ãã£ã«ã¿ãªã³ã°ã匷å¶ããã»ãã¥ãªãã£ãé«ããŸãã
- MIT Trusts: é Windows ã®ãRFC4120 æºæ ã® Kerberos ãã¡ã€ã³ãšç¢ºç«ãããä¿¡é Œã§ããWindows 以å€ã® Kerberos ããŒã¹ã®ã·ã¹ãã ãšçµ±åããç°å¢åãã®å°éçãªä¿¡é Œã§ãã
Other differences in trusting relationships
- ä¿¡é Œé¢ä¿ã¯ transitiveïŒæšç§»çïŒïŒA ã B ãä¿¡é ŒããB ã C ãä¿¡é Œãããš A 㯠C ãä¿¡é ŒããïŒãŸã㯠non-transitiveïŒéæšç§»çïŒ ã«èšå®ã§ããŸãã
- ä¿¡é Œé¢ä¿ã¯ bidirectional trustïŒåæ¹ä¿¡é ŒïŒïŒäºãã«ä¿¡é ŒïŒãŸã㯠one-way trustïŒäžæ¹åä¿¡é ŒïŒïŒäžæ¹ã®ã¿ã仿¹ãä¿¡é ŒïŒãšããŠèšå®ã§ããŸãã
Attack Path
- ä¿¡é Œé¢ä¿ãåæãã
- ããããã® security principalïŒuser/group/computerïŒãä»ãã¡ã€ã³ã®ãªãœãŒã¹ã«ã¢ã¯ã»ã¹ã§ãããã確èªãããACE ãšã³ããªãä»ãã¡ã€ã³ã®ã°ã«ãŒãã«å«ãŸããŠãããã調ã¹ããã¡ã€ã³éã®é¢ä¿æ§ãæ¢ãïŒå€ãã®å Žåä¿¡é Œã¯ãããç®çã«äœæãããŠããïŒã
- ãã®å Žåãkerberoast ãå¥ã®ãªãã·ã§ã³ã«ãªãåŸãã
- ãã¡ã€ã³éãããããã§ããã¢ã«ãŠã³ãã䟵害ããã
æ»æè ãå¥ãã¡ã€ã³ã®ãªãœãŒã¹ã«ã¢ã¯ã»ã¹ããææ®µã¯äž»ã«æ¬¡ã®3ã€ã§ãïŒ
- Local Group Membership: ããªã³ã·ãã«ããµãŒãã® "Administrators" ã°ã«ãŒããªã©ããŒã«ã«ã°ã«ãŒãã«è¿œå ããããšããã®ãã·ã³ã«å¯ŸããŠåŒ·åãªå¶åŸ¡æš©ãåŸãããŸãã
- Foreign Domain Group Membership: ããªã³ã·ãã«ãå€éšãã¡ã€ã³å ã®ã°ã«ãŒãã®ã¡ã³ããŒã§ããå Žåããã ããã®æ¹æ³ã®æå¹æ§ã¯ä¿¡é Œã®æ§è³ªãã°ã«ãŒãã®ã¹ã³ãŒãã«äŸåããŸãã
- Access Control Lists (ACLs): ããªã³ã·ãã«ã ACLãç¹ã« DACL å ã® ACE ãšããŠæå®ãããŠããå Žåãç¹å®ã®ãªãœãŒã¹ãžã®ã¢ã¯ã»ã¹ãäžããããŸããACLãDACLãACE ã®ä»çµã¿ã«æ·±ãèžã¿èŸŒãã«ã¯ããã¯ã€ãããŒã㌠âAn ACE Up The Sleeveâ ãæçšã§ãã
Find external users/groups with permissions
ãã¡ã€ã³å
ã® foreign security principals ãèŠã€ããã«ã¯ãCN=<user_SID>,CN=ForeignSecurityPrincipals,DC=domain,DC=com
ã確èªã§ããŸããããã㯠å€éšãã¡ã€ã³/ãã©ã¬ã¹ã ã® user/group ã§ãã
ããã Bloodhound ã powerview ã䜿ã£ãŠç¢ºèªã§ããŸãïŒ
# Get users that are i groups outside of the current domain
Get-DomainForeignUser
# Get groups inside a domain with users our
Get-DomainForeignGroupMember
Child-to-Parent forest privilege escalation
# Fro powerview
Get-DomainTrust
SourceName : sub.domain.local --> current domain
TargetName : domain.local --> foreign domain
TrustType : WINDOWS_ACTIVE_DIRECTORY
TrustAttributes : WITHIN_FOREST --> WITHIN_FOREST: Both in the same forest
TrustDirection : Bidirectional --> Trust direction (2ways in this case)
WhenCreated : 2/19/2021 1:28:00 PM
WhenChanged : 2/19/2021 1:28:00 PM
ãã¡ã€ã³ä¿¡é Œãåæããä»ã®æ¹æ³:
# Get DCs
nltest /dsgetdc:<DOMAIN>
# Get all domain trusts
nltest /domain_trusts /all_trusts /v
# Get all trust of a domain
nltest /dclist:sub.domain.local
nltest /server:dc.sub.domain.local /domain_trusts /all_trusts
Warning
ä¿¡é ŒãããããŒã2ã€ãããŸãã1ã€ã¯ Child --> Parent çšããã1ã€ã¯ Parent --> Child çšã§ãã
çŸåšã®ãã¡ã€ã³ã§äœ¿çšãããŠããããŒã確èªããã«ã¯ã次ãå®è¡ããŸã:Invoke-Mimikatz -Command '"lsadump::trust /patch"' -ComputerName dc.my.domain.local Invoke-Mimikatz -Command '"lsadump::dcsync /user:dcorp\mcorp$"'
SID-History Injection
ä¿¡é Œé¢ä¿ãæªçšã㊠SID-History injection ã«ãã child/parent ãã¡ã€ã³ã§ Enterprise admin ãšããŠæš©éææ ŒããŸã:
{{#ref}} sid-history-injection.md {{#endref}}
Exploit writeable Configuration NC
Configuration Naming Context (NC) ãã©ã®ããã«æªçšããåŸãããçè§£ããããšã¯éèŠã§ããConfiguration NC 㯠Active Directory (AD) ç°å¢ã®ãã©ã¬ã¹ãå šäœã®èšå®ããŒã¿ãæ ŒçŽããäžå€®ãªããžããªãšããŠæ©èœããŸãããã®ããŒã¿ã¯ãã©ã¬ã¹ãå ã®ãã¹ãŠã® Domain Controller (DC) ã«è€è£œãããæžã蟌ã¿å¯èœãª DC 㯠Configuration NC ã®æžã蟌ã¿å¯èœãªã³ããŒãä¿æããŸãããããæªçšããã«ã¯ãDC äžã§ SYSTEM ç¹æš© ãæã£ãŠããå¿ èŠããããã§ããã° child DC ãæãŸããã§ãã
Link GPO to root DC site
Configuration NC ã® Sites ã³ã³ããã«ã¯ãAD ãã©ã¬ã¹ãå ã®ãã¡ã€ã³åå ã³ã³ãã¥ãŒã¿ã®ãµã€ãæ å ±ãå«ãŸããŸããä»»æã® DC äžã§ SYSTEM ç¹æš©ãæã£ãŠããã°ãGPO ã root DC site ã«ãªã³ã¯ããããšãã§ããŸããããã«ããããããã®ãµã€ãã«é©çšãããããªã·ãŒãæäœã㊠root domain ã屿®åãããå¯èœæ§ããããŸãã
詳现ã¯ãBypassing SID Filtering ã®ç ç©¶ãåç §ããŠãã ããã
Compromise any gMSA in the forest
æ»æãã¯ã¿ãŒãšããŠããã¡ã€ã³å ã®ç¹æš© gMSA ãæšçã«ããæ¹æ³ããããŸããgMSA ã®ãã¹ã¯ãŒãèšç®ã«å¿ èŠãª KDS Root key 㯠Configuration NC ã«ä¿åãããŠããŸããä»»æã® DC äžã§ SYSTEM ç¹æš©ãæã£ãŠããã°ãKDS Root key ã«ã¢ã¯ã»ã¹ããŠãã©ã¬ã¹ãå ã®ä»»æã® gMSA ã®ãã¹ã¯ãŒããèšç®ããããšãå¯èœã§ãã
詳现ãªè§£æãšæé ã¯ä»¥äžãåç §ããŠãã ãã:
{{#ref}} golden-dmsa-gmsa.md {{#endref}}
è£å®ç㪠delegated MSA æ»æïŒBadSuccessor â migration attributes ã®æªçšïŒ:
{{#ref}} badsuccessor-dmsa-migration-abuse.md {{#endref}}
远å ã®å€éšç ç©¶: Golden gMSA Trust Attacksã
Schema change attack
ãã®ææ³ã¯ãæ°ããäœæãããç¹æš© AD ãªããžã§ã¯ããåŸ ã€å¿ èŠãããããå¿èãå¿ èŠã§ããSYSTEM ç¹æš©ãæã£ãŠããã°ãAD ã¹ããŒãã倿ŽããŠä»»æã®ãŠãŒã¶ã«ãã¹ãŠã®ã¯ã©ã¹ã«å¯Ÿããå®å šãªå¶åŸ¡æš©ãä»äžããããšãã§ããŸããããã«ãããæ°ããäœæããã AD ãªããžã§ã¯ãã«å¯ŸããŠäžæ£ãªã¢ã¯ã»ã¹ãå¶åŸ¡ãå¯èœã«ãªããŸãã
詳ãã㯠Schema Change Trust Attacks ãåç §ããŠãã ããã
From DA to EA with ADCS ESC5
ADCS ESC5 è匱æ§ã¯ PKI ãªããžã§ã¯ããå¶åŸ¡ããŠããã©ã¬ã¹ãå ã®ä»»æãŠãŒã¶ãšããŠèªèšŒå¯èœãªèšŒææžãã³ãã¬ãŒããäœæããããšãçã£ããã®ã§ããPKI ãªããžã§ã¯ã㯠Configuration NC ã«ååšãããããæžã蟌ã¿å¯èœãª child DC ã奪åããã° ESC5 æ»æãå®è¡ã§ããŸãã
詳现㯠From DA to EA with ESC5 ãåç §ããŠãã ãããADCS ãååšããªãå Žåã§ããæ»æè ã¯å¿ èŠãªã³ã³ããŒãã³ããã»ããã¢ããã§ãããããEscalating from Child Domain Admins to Enterprise Admins ãåç §ããŠãã ããã
External Forest Domain - One-Way (Inbound) or bidirectional
Get-DomainTrust
SourceName : a.domain.local --> Current domain
TargetName : domain.external --> Destination domain
TrustType : WINDOWS-ACTIVE_DIRECTORY
TrustAttributes :
TrustDirection : Inbound --> Inboud trust
WhenCreated : 2/19/2021 10:50:56 PM
WhenChanged : 2/19/2021 10:50:56 PM
ãã®ã·ããªãªã§ã¯ãããªãã®ãã¡ã€ã³ã¯å€éšãã¡ã€ã³ã«ãã£ãŠä¿¡é ŒãããŠãããããã«å¯ŸããŠäžæãªæš©éãä»äžãããŠããŸããããªãã¯ãèªãã¡ã€ã³ã®ã©ã®ããªã³ã·ãã«ãå€éšãã¡ã€ã³ã«å¯ŸããŠã©ã®ãããªã¢ã¯ã»ã¹æš©ãæã£ãŠããããç¹å®ãããããæªçšããããšè©Šã¿ãå¿ èŠããããŸãïŒ
{{#ref}} external-forest-domain-oneway-inbound.md {{#endref}}
å€éšãã©ã¬ã¹ããã¡ã€ã³ - äžæ¹å (ã¢ãŠãããŠã³ã)
Get-DomainTrust -Domain current.local
SourceName : current.local --> Current domain
TargetName : external.local --> Destination domain
TrustType : WINDOWS_ACTIVE_DIRECTORY
TrustAttributes : FOREST_TRANSITIVE
TrustDirection : Outbound --> Outbound trust
WhenCreated : 2/19/2021 10:15:24 PM
WhenChanged : 2/19/2021 10:15:24 PM
ãã®ã·ããªãªã§ã¯ ããªãã®ãã¡ã€ã³ ã å¥ã®ãã¡ã€ã³ ããã®ããªã³ã·ãã«ã«å¯ŸããŠããã€ãã® æš©é ã ä¿¡é Œ ããŠããŸãã
ããããä¿¡é Œãããã¡ã€ã³ã«ãã£ãŠ domain is trusted ãè¡ããããšãtrusted domain ã¯ äºæž¬å¯èœãªååã®ãŠãŒã¶ ãäœæãããã® ãã¹ã¯ãŒã ãšã㊠trusted password ã䜿çšããŸããã€ãŸããtrusting domain ã®ãŠãŒã¶ã«ã¢ã¯ã»ã¹ã㊠trusted domain ã«äŸµå ¥ããåæããããªãæš©éææ Œã詊ã¿ãããšãå¯èœã«ãªãããšããããšã§ãïŒ
{{#ref}} external-forest-domain-one-way-outbound.md {{#endref}}
ä»ã®æ¹æ³ãšããŠã¯ããã¡ã€ã³ãã©ã¹ãã®éæ¹åã«äœæãããSQL trusted linkïŒããŸãäžè¬çã§ã¯ãããŸããïŒãèŠã€ããããšã§ trusted domain ã䟵害ããæ¹æ³ããããŸãã
ãŸãå¥ã®æ¹æ³ãšããŠãtrusted domain ã® ãŠãŒã¶ãã¢ã¯ã»ã¹ã§ãã ãã·ã³äžã«åŸ
æ©ããŠããã®ãŠãŒã¶ã RDP ã§ãã°ã€ã³ããã®ãåŸ
ã€æ¹æ³ããããŸãããã®å Žåãæ»æè
㯠RDP ã»ãã·ã§ã³ã®ããã»ã¹ã«ã³ãŒããæ³šå
¥ãããããã 被害è
ã®å
ã®ãã¡ã€ã³ã«ã¢ã¯ã»ã¹ ããããšãã§ããŸãã
ããã«ããã 被害è
ãèªåã®ããŒããã©ã€ããããŠã³ãããŠãã å Žåãæ»æè
㯠RDP ã»ãã·ã§ã³ ã®ããã»ã¹ããããŒããã©ã€ãã® ã¹ã¿ãŒãã¢ãããã©ã«ã ã« backdoors ã眮ãããšãã§ããŸãããã®ææ³ã¯ RDPInception ãšåŒã°ããŸãã
{{#ref}} rdp-sessions-abuse.md {{#endref}}
ãã¡ã€ã³ä¿¡é Œã®æªçšã«å¯Ÿããç·©åç
SID Filtering:
- SID history 屿§ãæªçšããæ»æã®ãªã¹ã¯ã¯ãSID Filtering ã«ãã£ãŠç·©åãããŠãããããã¯ãã¹ãŠã®ãã©ã¬ã¹ãéãã©ã¹ãã§ããã©ã«ãã§æå¹ã«ãªã£ãŠããŸããããã¯ãMicrosoft ã®èãæ¹ã«åŸããã»ãã¥ãªãã£å¢çããã¡ã€ã³ã§ã¯ãªããã©ã¬ã¹ããšããŠæ±ãåæã«åºã¥ããŠããŸãã
- ãã ãæ³šæç¹ãšããŠãSID filtering ã¯ã¢ããªã±ãŒã·ã§ã³ããŠãŒã¶ã®ã¢ã¯ã»ã¹ã劚ããå¯èœæ§ãããããã®ããç¡å¹åãããããšãããç¹ã«çæããŠãã ããã
Selective Authentication:
- ãã©ã¬ã¹ãéãã©ã¹ãã§ã¯ãSelective Authentication ãå©çšããããšã§ãäž¡ãã©ã¬ã¹ãã®ãŠãŒã¶ãèªåçã«èªèšŒãããªãããã«ã§ããŸãã代ããã«ãtrusting domain/forest å ã®ãã¡ã€ã³ããµãŒãã«ã¢ã¯ã»ã¹ããããã«ã¯æç€ºçãªæš©éãå¿ èŠãšãªããŸãã
- ãã ãããããã®å¯Ÿç㯠writable Configuration Naming Context (NC) ã®æªçšã trust account ã«å¯Ÿããæ»æããã¯ä¿è·ããªãç¹ã«æ³šæãå¿ èŠã§ãã
More information about domain trusts in ired.team.
AD -> Azure & Azure -> AD
{{#ref}} https://cloud.hacktricks.wiki/en/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/azure-ad-connect-hybrid-identity/index.html {{#endref}}
äžè¬çãªé²åŸ¡ç
Learn more about how to protect credentials here.
Defensive Measures for Credential Protection
- Domain Admins Restrictions: Domain Admins 㯠Domain Controllers ã«ã®ã¿ãã°ã€ã³ãèš±å¯ããä»ã®ãã¹ãã§ã®äœ¿çšãé¿ããããšãæšå¥šãããŸãã
- Service Account Privileges: ãµãŒãã¹ã¯ Domain Admin (DA) æš©éã§å®è¡ãã¹ãã§ã¯ãããŸããã
- Temporal Privilege Limitation: DA æš©éãå¿
èŠãªã¿ã¹ã¯ã«ã€ããŠã¯ãã®æéãå¶éããã¹ãã§ããäŸïŒ
Add-ADGroupMember -Identity âDomain Adminsâ -Members newDA -MemberTimeToLive (New-TimeSpan -Minutes 20)
Implementing Deception Techniques
- ãã£ã»ãã·ã§ã³ã®å®è£ ã¯çœ ïŒäŸïŒãã¹ã¯ãŒãæéåããªããTrusted for Delegation ã«èšå®ããããããŒãŠãŒã¶ãã³ã³ãã¥ãŒã¿ïŒã仿ããããšãå«ã¿ãŸããå ·äœçã«ã¯ç¹å®ã®æš©å©ãæã€ãŠãŒã¶ãäœæãããã髿š©éã°ã«ãŒãã«è¿œå ãããããŸãã
- å®äŸãšããŠæ¬¡ã®ãããªããŒã«ã䜿çšããŸãïŒ
Create-DecoyUser -UserFirstName user -UserLastName manager-uncommon -Password Pass@123 | DeployUserDeception -UserFlag PasswordNeverExpires -GUID d07da11f-8a3d-42b6-b0aa-76c962be719a -Verbose
- ãã£ã»ãã·ã§ã³æè¡ã®å±éã«ã€ããŠã¯ Deploy-Deception on GitHub ãåç §ããŠãã ããã
Identifying Deception
- For User Objects: çãããææšã«ã¯ãç°åžžãª ObjectSIDãäœé »åºŠã®ãã°ãªã³ãäœææ¥ãäžèªç¶ã«å°ãªã bad password count ãªã©ããããŸãã
- General Indicators: æœåšçãªãããŒãªããžã§ã¯ãã®å±æ§ãå®åšãªããžã§ã¯ããšæ¯èŒããããšã§äžæŽåãæããã«ã§ããŸããããŒã«ãšã㊠HoneypotBuster ãªã©ã圹ç«ã¡ãŸãã
Bypassing Detection Systems
- Microsoft ATA Detection Bypass:
- User Enumeration: ATA æ€åºãåé¿ããããã« Domain Controllers äžã§ã®ã»ãã·ã§ã³åæãé¿ããã
- Ticket Impersonation: ãã±ããäœæã« aes ããŒãå©çšããããšã§ NTLM ã«ããŠã³ã°ã¬ãŒãããã«æ€åºãåé¿ããã®ã«åœ¹ç«ã¡ãŸãã
- DCSync Attacks: Domain Controller 以å€ããå®è¡ããããšã§ ATA æ€åºãåé¿ããããšãæšå¥šãããŸããDomain Controller ããçŽæ¥å®è¡ãããšã¢ã©ãŒããçºçããŸãã
åè
- http://www.harmj0y.net/blog/redteaming/a-guide-to-attacking-domain-trusts/
- https://www.labofapenetrationtester.com/2018/10/deploy-deception.html
- https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/child-domain-da-to-ea-in-parent-domain
{{#include ../../banners/hacktricks-training.md}}