9 - Notes
Nice General Cheatsheets
Authentication Process - Linux
1. Core Architecture: PAM
Pluggable Authentication Modules (PAM) manage the authentication, session setup, and password changes.
- Key Module:
pam_unix.so(Standard Unix auth). - Location:
/usr/lib/x86_64-linux-gnu/security/ - Function: Bridges the gap between user input (e.g.,
passwdcommand) and flat files (/etc/passwd,/etc/shadow).
2. Critical Files & Storage
A. The User Registry (/etc/passwd)
- Permissions: World-Readable.
- Format:
Username:Password:UID:GID:GECOS:Home:Shell - Key Fields:
- Password (
x): Indicates the hash is actually in/etc/shadow. - Exploit: If writeable, deleting the
xremoves the password requirement for that user (e.g.,root::0:0...allows passwordless login).
- Password (
B. The Secrets (/etc/shadow)
- Permissions: Root-Readable only.
- Format:
Username:Hash:LastChange:Min:Max:Warn:Inactive:Expire:Reserved - Status Flags:
!or*: Account is locked (cannot login via password).- Note: SSH Key auth or
sumight still work even if locked.
C. Password History (/etc/security/opasswd)
- Permissions: Root-Readable.
- Function: Stores previously used password hashes to enforce history policies (prevent reuse).
- Value: Often contains older, weaker hashes (MD5) useful for pattern analysis.
3. Hash Formats & Algorithms
Linux hashes follow the format: $<id>$<salt>$<hash>
| ID | Algorithm | Notes |
|---|---|---|
| $1$ | MD5 | Weak. Fast to crack. |
| $2a$ | Blowfish | Slower (Bcrypt). |
| $5$ | SHA-256 | Standard. |
| $6$ | SHA-512 | Standard / Strong. |
| $y$ | Yescrypt | Modern Default (Debian/Kali). Harder to crack. |
| $7$ | Scrypt | Memory hard. |
4. Cracking Workflow
1. Prepare the File (Unshadow)
Combine passwd and shadow to give the cracker the necessary context (Usernames, GECOS, and Hash).
2. Crack (Hashcat)
- Format: SHA-512 (Mode 1800) is the most common legacy default.
3. Crack (John the Ripper)
- Mode:
--singleis highly effective here becauseunshadowprovides the GECOS fields for guessing.
Authentication Process - Windows
1. Key Processes & Architecture
WinLogon (WinLogon.exe)
- Role: The “orchestrator.” Intercepts keyboard input (
Ctrl+Alt+Del), manages the workstation lock status, and handles password changes. - Workflow: Launches
LogonUI-> Collects Creds -> Sends toLSASS. - Legacy Note (GINA): In older Windows (NT/XP),
msgina.dllhandled this. Replaced by Credential Providers in modern Windows.
LogonUI (LogonUI.exe)
- Role: The graphical user interface that asks for the password.
- Mechanism: Uses Credential Providers (COM Objects/DLLs) to accept different auth types (Password, PIN, Biometrics).
LSASS (%SystemRoot%\System32\Lsass.exe)
- Role: The “Gatekeeper.” Enforces security policy, validates the password against SAM/AD, and writes to the Event Log.
- Resources: Microsoft: LSA Architecture
2. Authentication DLLs (The Packages)
These modules live inside LSASS to handle specific tasks.
| DLL Name | Function / Description |
|---|---|
| Lsasrv.dll | The Manager. Enforces policy and chooses the protocol (Negotiate: Kerberos vs NTLM). |
| Msv1_0.dll | Local / NTLM. Handles non-domain logins and legacy NTLM authentication. |
| Kerberos.dll | Domain. Handles Kerberos ticket requests and validation. |
| Samsrv.dll | SAM Interface. Talks to the local SAM database. |
| Netlogon.dll | Network. Handles the secure channel for network logons. |
| Ntdsa.dll | AD Interface. Used to create/manage records in the Registry or AD. |
3. Credential Storage Locations
Local Users (SAM)
- File Path:
%SystemRoot%\system32\config\SAM - Registry Mount:
HKLM\SAM - Protection: Partially encrypted by SYSKEY (
syskey.exe) to prevent offline extraction. - Content: Local user NTLM/LM hashes.
| Registry Hive | Description |
|---|---|
HKLM\SAM | Contains password hashes for local user accounts. These hashes can be extracted and cracked to reveal plaintext passwords. |
HKLM\SYSTEM | Stores the system boot key, which is used to encrypt the SAM database. This key is required to decrypt the hashes. |
HKLM\SECURITY | Contains sensitive information used by the Local Security Authority (LSA), including cached domain credentials (DCC2), cleartext passwords, DPAPI keys, and more. |
Domain Users (NTDS)
- File Path:
%SystemRoot%\ntds.dit - Location: Found only on Domain Controllers.
- Content: Active Directory database (Users, Groups, Computers, GPOs, Hashes).
- Sync: Replicates to all DCs (except Read-Only DCs).
Credential Manager (The Vault)
- Role: Stores saved passwords for RDP, Websites, and Network Shares.
Policy.vpolin File Path:
%UserProfile%\AppData\Local\Microsoft\Vault\%UserProfile%\AppData\Local\Microsoft\Credentials\%UserProfile%\AppData\Roaming\Microsoft\Vault\%ProgramData%\Microsoft\Vault\%SystemRoot%\System32\config\systemprofile\AppData\Roaming\Microsoft\Vault\
- Resource: Microsoft: Credential Manager
Hashcat
Hashcat is a fast password recovery tool that supports multiple attack modes and hash types. It’s the world’s fastest and most advanced password recovery utility.
References:
- Hash Type Codes: https://hashcat.net/wiki/doku.php?id=example_hashes
- Permutation Rules:
/usr/share/hashcat/rules - Cheat Sheet: https://pentesting.site/cheat-sheets/hashcat/
- Rule-Based Attack: https://hashcat.net/wiki/doku.php?id=rule_based_attack
Basic Usage
Attack Modes
| Mode | Description | Example |
|---|---|---|
| 0 | Straight (Dictionary) | hashcat -a 0 -m 1000 hash.txt wordlist.txt |
| 1 | Combinator | Combines words from two wordlists |
| 3 | Brute-Force/Mask | hashcat -a 3 -m 1000 hash.txt ?a?a?a?a?a?a |
| 6 | Hybrid Wordlist + Mask | Wordlist + mask pattern |
Common Hash Types & Modes
Windows Hashes
Linux Hashes
Kerberos (Active Directory)
Other Hash Types
Rule-Based Attacks
Rule-based attacks apply transformations to words in a wordlist, creating permutations and variations.
Rule Files Location
Rule Comparison Table
| Rule File | Rule Count | Use Case |
|---|---|---|
best64.rule | 64 | First Run. Instant results for easy passwords. |
d3ad0ne.rule | ~34,000 | Deep Crack. Good for standard “complex” user passwords. |
dive.rule | ~100,000+ | Paranoid. Extremely slow; last resort for dictionary attacks. |
Using Rules
Creating Custom Rules
Common rule transformations:
| Rule | Description | Example |
|---|---|---|
c | Capitalize first character, lowercase rest | password โ Password |
C | Lowercase first character, uppercase rest | password โ pASSWORD |
t | Toggle case of all characters | password โ PASSWORD |
$! | Append ! to end | password โ password! |
$1$9$9$8 | Append 1998 to end | password โ password1998 |
sa@ | Replace all a with @ | password โ p@ssword |
so0 | Replace all o with 0 | password โ passw0rd |
ss$ | Replace all s with $ | password โ pa$$word |
Example Custom Rule File:
Mask Attacks (-a 3)
Mask attacks use placeholders to define character sets and patterns for brute-force attacks.
Charset Symbols
| Symbol | Description | Charset / Definition |
|---|---|---|
?l | Lowercase | abcdefghijklmnopqrstuvwxyz |
?u | Uppercase | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
?d | Digits | 0123456789 |
?h | Hex (Lower) | 0123456789abcdef |
?H | Hex (Upper) | 0123456789ABCDEF |
?s | Special | ยซspaceยป!"#$%&’()*+,-./:;<=>?@[]^_{` |
?a | All | ?l?u?d?s |
?b | Binary | 0x00 - 0xff |
Custom Charsets
Mask Examples
Hash Identification
Before cracking, identify the hash type:
Common Hash Values
| Hash Value | Type | Meaning |
|---|---|---|
d41d8cd98f00b204e9800998ecf8427e | MD5 | Empty String (0 byte input) |
da39a3ee5e6b4b0d3255bfef95601890afd80709 | SHA1 | Empty String (0 byte input) |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 | SHA256 | Empty String (0 byte input) |
Workflow Examples
Linux Password Cracking
Kerberoasting
Windows NT Hashes
Important Notes
- Hash Mode: Always specify the correct
-mmode for your hash type. Usehashidor check the hash format to determine the mode. - Wordlists: Common wordlists include
rockyou.txt,SecLists, and custom wordlists generated from OSINT. - Rules: Start with
best64.rulefor quick results, then move to more comprehensive rules if needed. - Performance: Use
-w 3or-w 4for faster cracking (uses more resources). Use-Ofor optimized kernels (may limit password length). - GPU Acceleration: Hashcat automatically uses GPU if available. Ensure proper drivers are installed.
- Resume Sessions: Hashcat saves progress automatically. Use
--restoreto resume interrupted sessions. - Output: Cracked passwords are saved to
~/.hashcat/hashcat.potfileby default.
Hydra
Hydra is a parallelized login cracker that supports numerous protocols to attack. It is very fast and flexible, and new modules are easy to add.
Core Flags
Protocol-Specific Examples
SSH / FTP / RDP / SMB
Web Forms (HTTP-POST)
Syntax: "/path:body:F=FailureString"
- Use
^USER^and^PASS^as placeholders - Check Burp Suite for body structure
F=FailureStringspecifies the failure response text to detect failed logins
WordPress Specific
Password Spraying
Password spraying uses one password against many users (alternates users), which has no risk of account lockout compared to brute-forcing. This is useful as a “hail Mary” to find any way in!
Best practice: Obtain account lockout policy beforehand (via enumeration or asking customer); if you don’t know the password policy, a good rule of thumb is to wait a few hours between attempts, which should be long enough for the account lockout threshold to reset.
Important Notes
- Account Lockout Risk: Brute-forcing (many passwords vs 1 user) has a RISK of account lockout due to account lockout policy. Use small wordlists and be cautious.
- Thread Count: Use
-t 4for SSH to avoid overwhelming the service. Web forms can handle higher thread counts like-t 16. - Wordlist Selection: For online attacks, use small wordlists (e.g., top 1000 passwords) to minimize lockout risk and reduce time.
- Output: Always use
-o <OUTPUT_FILE>to save results for later analysis.
Mimikatz
Mimikatz is a post-exploitation tool that can extract plaintext passwords, hashes, PINs, and Kerberos tickets from memory. It can also perform pass-the-hash, pass-the-ticket, and build Golden Tickets.
Important Notes
- Debug Privilege: Most Mimikatz operations require
privilege::debugto access LSASS memory - Administrator Required: Mimikatz typically needs administrator privileges to function
- LSASS Access: Many operations read from LSASS memory, which is protected by Windows
- Detection: Mimikatz is heavily flagged by security products and EDR solutions
- Pass the Hash: When using
sekurlsa::pth, a new window will open - run commands in that new window - Golden Tickets: Golden Tickets are valid until the KRBTGT account password is changed (typically 180 days by default)
- Ticket Files: Exported Kerberos tickets use
.kirbiformat - Domain Syntax: Use “.” for domain when targeting local machine accounts
Basic Usage & Privilege Escalation
Credential Dumping
LSASS Memory (sekurlsa)
Dump All Credentials:
Dump Specific Hash Types:
Export Kerberos Tickets:
Extract AES Keys:
SAM Database
LSA Secrets
Dump Specific Account:
DCSync (Remote):
DCSync
Might require runas.
Pass the Hash (PtH)
Pass the Hash allows you to authenticate using an NTLM hash instead of a plaintext password.
Alternative Syntax:
Pass the Key (PtK) / OverPass the Hash (OtH)
Concept: Request a Kerberos Ticket (TGT) using an NTLM hash or AES Key, rather than using the NTLM protocol directly.
Extract AES Keys First:
Pass the Key with AES:
Pass the Ticket (PtT)
Pass the Ticket allows you to use stolen Kerberos tickets to authenticate as another user.
Export Tickets:
Inject Ticket:
Golden Ticket Attack
A Golden Ticket is a forged Kerberos TGT that allows you to impersonate any user in the domain, including domain administrators.
Step 1: Get KRBTGT Hash & SID
Method A (On DC):
Method B (Remote DCSync):
Step 2: Create & Inject Ticket
Step 3: Launch Shell
Credential Manager
Dump credentials stored in Windows Credential Manager:
DPAPI (Data Protection API)
Decrypt data protected by Windows DPAPI, such as browser credentials:
Netexec
Netexec (formerly CrackMapExec) is a swiss army knife for pentesting networks. It’s a network exploitation tool that helps automate assessing the security of large networks by providing tactics and techniques for testing security controls in an Active Directory environment.
Password Policy Enumeration
Enumerate password policy information via SMB:
User Enumeration
Enumerate Users
Enumerate Groups
Share Enumeration
Password Spraying
Password spraying uses one password against many users (alternates users), which has no risk of account lockout compared to brute-forcing. This is useful as a “hail Mary” to find any way in!
Best practice: Obtain account lockout policy beforehand (via enumeration or asking customer); if you don’t know the password policy, a good rule of thumb is to wait a few hours between attempts, which should be long enough for the account lockout threshold to reset.
Pass the Hash (PtH)
Netexec supports pass-the-hash attacks for lateral movement:
Credential Dumping
LSA Secrets
Remotely dump LSA secrets from a target:
SAM Database
Remotely dump SAM database secrets:
Active Directory Operations
Verify Credentials
NTDS.dit Extraction
Extract the NTDS.dit file (keys of the kingdom) from a domain controller:
LDAP Operations
Admin Count Enumeration
Find high-value users with adminCount=1 (includes Domain Admins, Enterprise Admins, Backup Operators, etc.):
Command Execution
Command Execution (-x, -X) or Relaying: Sudo is REQUIRED because these operations act as a server/listener.
Execute commands on remote systems:
Protocol Selection
Netexec supports multiple protocols. Check available services with:
Common protocols include:
smb- SMB/CIFS protocolldap- LDAP protocolwinrm- Windows Remote Managementssh- SSH protocolmssql- Microsoft SQL Server- And many more…

