Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Active Directory

00. Basics

Accounts ending with a $ indicate either a machine account (like a computer object in AD) or a managed service account. These accounts are automatically created when a computer is joined to the domain or when a service account is provisioned.

+----------------------------------------------+
SID Structure
+----------------------------------------------+
S-1-5-21-343818398-2089392276-30300820-544
+----------------------------------------------+
   │ │ │ └──── Subauthority Values ─────┘  │
   │ │ │                                   └───────| RID (Relative Identifier)
   │ │ │                                   
   │ │ └─────────────── Identifier Authority (e.g., NT Authority = 5)
   │ │
   │ └─────────── Revision (Always "1") 

   └───────── "S" identifies as a SID string

- Identifier Authority: Defines the authority under which the SID was created.
    - 0 = Null Authority (Represents an empty or undefined authority.)
    - 1 = World Authority (epresents "everyone" or all users.)
    - 2 = Local Authority (Defines local machine accounts and groups.)
    - 3 = Creator Authority (Represents the creator or owner of an object.)
    - 4 = Non-Unique Authority (Rarely used; identifies non-unique entities.)
    - 5 = NT Authority (Represents the Windows NT security subsystem.)
    
- RID: Relative Identifier, unique to each account or group.
    - 500 = Administrator account.
    - 501 = Guest account.
    - 502 = KRBTGT account - used for Kerberos authentication.
    - 512 = Domain Administrators group.
    - 513 = Domain Users group.
    - 514 = Domain Guests group.
    - 515 = Domain Computers group.
    - 516 = Domain Controllers group.
    - 517 = Cert Publishers group.
    - 518 = Schema Admins group.
    - 519 = Enterprise Admins group.
    - 520 = Group Policy Creator Owners group.
    - 521 = Read-only Domain Controllers group.
    - 522 = Cloneable Domain Controllers group.
    - 525 = Protected Users group.
    - 544 = Administrators group.
    - 545 = Users group.
    - 546 = Guests group.
    - 547 = Power Users group.
    - 548 = Account Operators group.
    - 549 = Server Operators group.
    - 550 = Print Operators group.
    - 551 = Backup Operators group.
    - 552 = Replicator group.
    - 554 = Remote Desktop Users group.
    - 559 = Windows Authorization Access group.
    - 573 = RDS Remote Access Servers group.
    - 574 = RDS Endpoint Servers group.
    - 575 = RDS Management Servers group.
    - 577 = Access Control Assistance Operators group.
    - 578 = Remote Management Users group.
    - 580 = Storage Replica Administrators group.
    - 1000 = The first user account created manually after Windows installation.
  • objectSid to SID representation

  • Steel Hashes

  • Basic commands

  • Find GPP Passwords in SYSVOL

  • Microsoft ActiveDirectory PowerShell ADModule

01. Exploitations & Attacks

01.1 Kerberoasting

💡 Kerberoasting is an attack technique that targets Service Principal Names (SPNs) in a Windows domain. In this attack, the attacker requests service tickets for service accounts that are running under Kerberos authentication. These service tickets are encrypted using the service account's password hash, and since many service accounts have weak or easily guessable passwords, the attacker can brute-force the encrypted tickets offline to reveal the account's password. Once the password is cracked, the attacker gains access to the service account and can escalate privileges within the domain. Kerberoasting is effective because it doesn't require elevated privileges to launch, and the process of cracking the tickets is done offline, making detection difficult.

  • With GetUserSPNs.py

  • With GetUserSPNs.ps1

  • With Invoke-Kerberoast.ps1

  • With Rubeus

01.2 AS-REP Roasting

💡 AS-REP Roasting is an attack where an attacker targets accounts with disabled pre-authentication in a Kerberos environment. The attacker requests an AS-REP from the KDC, which is encrypted with the target account's password hash. Since no pre-authentication is required for these accounts, the attacker can intercept the AS-REP and attempt to brute-force the encryption offline. If the account uses a weak password, the attacker can crack it and gain access to the account, potentially escalating privileges in the domain.

01.3 Silver Ticket

💡 A Silver Ticket attack is a post-exploitation technique in Kerberos environments where an attacker forges a service ticket (TGS) to access a specific service, like SQL Server or HTTP, without needing to contact the Domain Controller. This attack requires the NTLM hash of a service account, which can be obtained after compromising a machine or account. With this hash, the attacker can craft a fake Kerberos ticket that appears valid to the target service, allowing access as any user, including privileged ones. Since the forged ticket is presented directly to the service and not validated with the Domain Controller, Silver Ticket attacks are stealthier and harder to detect than Golden Ticket attacks.

  • Prerequisite

  • PassTheTicket with Rubeus

  • PassTheTicket with mimikatz

  • PassTheTicket with python

01.4 Golden Ticket

💡 A Golden Ticket attack is a powerful post-exploitation technique where an attacker forges a Kerberos Ticket Granting Ticket (TGT) to gain unlimited access to any service or resource in a domain. To create a Golden Ticket, the attacker must first obtain the NTLM hash of the KRBTGT account, which is responsible for signing all Kerberos tickets in the domain. With this hash, the attacker can generate a fake TGT that appears completely legitimate to Domain Controllers and other systems. This allows them to impersonate any user, including Domain Admins, and maintain persistent, stealthy access across the network, often bypassing detection tools and authentication logs

  • Prerequisite

  • With impacket

  • With Metasploit

01.5 DCSync Attack

💡 A DCSync attack is a post-exploitation method where an attacker pretends to be a Domain Controller to request password hashes and secrets from Active Directory using replication protocols. To perform this, the attacker needs access to the domain and an account with special permissions like Replicating Directory Changes, which are usually held by Domain Admins or Domain Controllers.

01.6 Password Spraying

  • Low and Slow Password Spraying

01.6 Pass The Hash [PTH] - Extended

02. PowerView

03. Abusing ACLs

03.1 WriteOwner

Abusing the WriteOwner permission in Active Directory allows an attacker to change the owner of an object, such as a user, group, or computer. Once you own the object, you can then grant yourself FullControl or GenericAll permissions—giving you complete control over it.

03.2 ForceChangePassword

03.3 GenericAll

03.4 GenericWrite

03.6 ADCSESC4

The principal has permissions to modify one or more certificate templates, allowing them to configure the templates to meet ADCS ESC1 conditions—enabling specification of alternate subject names and certificate-based authentication. With enrollment permissions on an enterprise CA that trusts NT authentication and chains to the forest root CA, the principal can alter templates to enroll certificates impersonating any user or computer in the AD forest without needing their credentials, effectively enabling stealthy domain-wide impersonation via certificate authentication.

04. PowerMAD

05. Impacket's Collection

05.1 getPac

05.2 getTGT

05.3 GetADUsers

05.4 GetUserSPNs

05.5 GetNPUsers

05.6 RPCDump

05.7 gMSADumper

gMSADumper.py is a Python script designed to read and parse Group Managed Service Account (gMSA) password blobs in Active Directory (AD). It identifies which users or groups have permissions to read these password blobs and extracts the current password if accessible

06. Evil-WinRm

07. PsExec

08. Mimikatz

A tool for extracting plaintext credentials, hashes, and Kerberos tickets from memory. It is often used for credential dumping and escalating privileges.

  • Dump all user's ntlm hashes.

  • Dump passwords using lsass

  • Export Kerberos tickets.

  • Extract krbtgt Hash

  • OverPassTheHash

  • Set password for account

09. RustHound-CE

10. SharpHound

11. BloodHound

  • BloodHound-Python

  • BloodHound & neo4j raw queries. [source]

12. Certipy

Certipy is a Python tool used to enumerate and exploit Active Directory Certificate Services (ADCS) for privilege escalation, requiring valid domain credentials to use.

13. Krbrelayx

14. Covenant

15. Other Commands

  • Mount shares to linux machine

  • Mounting VHD file on Kali Linux through remote share

  • Get Deleted items from AD

16. Other Exploits

BadSuccessor

ADCS ESC16

Unconstrained Delegation + The PrinterBug = DCSync

Resource Based Constrained Delegation [Domain Escalation]

  • File Attacks [if you can write anything]

  • If you get STATUS_PASSWORD_MUST_CHANGE ; Reset SMB Password

  • SambaCry | CVE-2017-7494 | 3.5.0 and 3.6.0

Last updated