Where Credentials are Stored?
Last updated
Last updated
Applications that implement authentication mechanisms compare user credentials against local or remote databases.
Local credential storage โค Credentials are stored on the system.
Web applications โค Vulnerable to SQL Injection attacks, which may expose sensitive data, including credentials in plaintext.
โ ๏ธ Example: The breach exposed 32 million user accounts due to storing credentials in plaintext. This led to the creation of the famous password wordlist rockyou.txt (~14 million passwords).
Linux manages everything as files โ even credentials. Here's how credentials are stored and secured:
/etc/shadow
FileEncrypted credentials are stored in /etc/shadow
:
Structure:
Example Breakdown:
htb-student
โค Username
$y$j9T$3QSBB6CbHEu...f8Ms
โค Encrypted password
Hash ID Types:
$1$
MD5
$2a$
Blowfish
$5$
SHA-256
$6$
SHA-512
$sha1$
SHA1crypt
$y$
Yescrypt
$gy$
Gost-Yescrypt
$7$
Scrypt
/etc/passwd
FileUsed for user info but not encrypted passwords anymore.
Structure:
x
means the password is stored in /etc/shadow
File is readable by all, hence moved encrypted passwords to /etc/shadow
โ Misconfigured permissions on
/etc/shadow
can lead to privilege escalation.
Windows authentication is complex and modular:
๐ Process Involves:
WinLogon.exe
LogonUI
Credential Providers
LSASS
Authentication Packages
SAM or Active Directory
๐ Key DLLs (Authentication Packages):
Lsasrv.dll
Enforces policies, selects NTLM/Kerberos
Msv1_0.dll
Local logons
Samsrv.dll
Local user accounts (SAM DB)
Kerberos.dll
Kerberos protocol
Netlogon.dll
Network logon
Ntdsa.dll
Active Directory registry interactions
File: %SystemRoot%\System32\lsass.exe
Functions:
Authenticates users
Enforces security policies
Logs security audit events
LSASS is like the vault of Windows authentication systems.
Location: %SystemRoot%\System32\config\SAM
(mounted on HKLM\SAM
)
Stores:
Usernames
Passwords (in LM or NTLM hash format)
๐ Requires SYSTEM-level privileges to access
Protected with SYSKEY (introduced in Windows NT 4.0)
If Windows is part of a Domain, credentials are validated against Active Directory stored in the NTDS.dit file.
๐ NTDS.dit File:
Location: %SystemRoot%\ntds\ntds.dit
Found on: Domain Controllers
Stores:
User, group, and computer accounts
Password hashes
Group policy objects
๐งช We will explore credential extraction methods from NTDS.dit.
A built-in feature that stores saved credentials for:
Network resources
Websites
๐ Location:
๐ Credentials are encrypted and user-specific. Decryption methods exist and will be explored hands-on.