1. intro, theory

Confidentiality, Integrity, and Availability are at the heart of every Infosec practitioner's role.

Authentication, at its core, is the validation of your identity by presenting a combination of three main factors to a validation mechanism. They are;

  1. Something you know (a password, passcode, pin, etc.).
  2. Something you have (an ID Card, security key, or other MFA tools).
  3. Something you are (your physical self, username, email address, or other identifiers.)

https://www.pandasecurity.com/en/mediacenter/password-statistics/


linux credential storage

located in /etc/shadow and is part of the Linux user management system. In addition, these passwords are commonly stored in the form of hashes

htb-student:$y$j9T$3QSBB6CbHEu...SNIP...f8Ms:18955:0:99999:7:::
htb-student:$y$j9T$3QSBB6CbHEu...SNIP...f8Ms:	18955:	            0:	          99999:	7:	               :	:	:
<username>:	<encrypted password>:	          <day of last change>:	<min age>:	<max age>:	<warning period>:	<inactivity period>:	<expiration date>:	<reserved field>

The type (id) is the cryptographic hash method used to encrypt the password. Many different cryptographic hash methods were used in the past and are still used by some systems today.

ID Cryptographic Hash Algorithm
$1$ MD5
$2a$ Blowfish
$5$ SHA-256
$6$ SHA-512
$sha1$ SHA1crypt
$y$ Yescrypt
$gy$ Gost-yescrypt
$7$ Scrypt
stejwes@htb[/htb]$ cat /etc/passwd

...SNIP...
htb-student:x:1000:1000:,,,:/home/htb-student:/bin/bash
  1. <username>
  2. <password>
  3. <uid>
  4. <gid>
  5. <comment>
  6. <home>
  7. <cmd exec after login> The x in the password field indicates that the encrypted password is in the /etc/shadow file.

Windows credential storage, and auth process

![](/img/Pasted image 20240803173656.png)

The Windows client authentication process can oftentimes be more complicated than with Linux systems and consists of many different modules that perform the entire logon, retrieval, and verification processes. In addition, there are many different and complex authentication procedures on the Windows system, such as Kerberos authentication.

**The Local Security Authority (LSA) is a protected subsystem that authenticates users and logs them into the local computer. In addition, the LSA maintains information about all aspects of local security on a computer. It also provides various services for translating between names and security IDs (SIDs).

The security subsystem keeps track of the security policies and accounts that reside on a computer system. In the case of a Domain Controller, these policies and accounts apply to the domain where the Domain Controller is located. These policies and accounts are stored in Active Directory. In addition, the LSA subsystem provides services for checking access to objects, checking user permissions, and generating monitoring messages.

NTDS

It is very common to come across network environments where Windows systems are joined to a Windows domain. This is common because it makes it easier for admins to manage all the systems owned by their respective organizations (centralized management). In these cases, the Windows systems will send all logon requests to Domain Controllers that belong to the same Active Directory forest.

**Each Domain Controller hosts a file called NTDS.dit that is kept synchronized across all Domain Controllers with the exception of Read-Only Domain Controllers. NTDS.dit is a database file that stores the data in Active Directory, including but not limited to:

SAM Database

**The Security Account Manager (SAM) is a database file in Windows operating systems that stores users' passwords.

It can be used to authenticate local and remote users. SAM uses cryptographic measures to prevent unauthenticated users from accessing the system. User passwords are stored in a hash format in a registry structure as either an LM hash or an NTLM hash. This file is located in %SystemRoot%/system32/config/SAM and is mounted on HKLM/SAM. SYSTEM level permissions are required to view it.

Windows systems can be assigned to either a workgroup or domain during setup. If the system has been assigned to a workgroup, it handles the SAM database locally and stores all existing users locally in this database. However, if the system has been joined to a domain, the Domain Controller (DC) must validate the credentials from the Active Directory database (ntds.dit), which is stored in %SystemRoot%\ntds.dit.

Microsoft introduced a security feature in Windows NT 4.0 to help improve the security of the SAM database against offline software cracking. This is the SYSKEY (syskey.exe) feature, which, when enabled, partially encrypts the hard disk copy of the SAM file so that the password hash values for all local accounts stored in the SAM are encrypted with a key.

LSASS

Local Security Authority Subsystem Service (LSASS) is a collection of many modules and has access to all authentication processes that can be found in %SystemRoot%\System32\Lsass.exe. This service is responsible for the local system security policy, user authentication, and sending security audit logs to the Event log. In other words, it is the vault for Windows-based operating systems, and we can find a more detailed illustration of the LSASS architecture here. ![](/img/Pasted image 20240803173616.png)


Credential Manager

![](/img/Pasted image 20240803173909.png) https://docs.microsoft.com/en-us/windows-server/security/windows-authentication/credentials-processes-in-windows-authentication

Credential Manager is a feature built-in to all Windows operating systems that allows users to save the credentials they use to access various network resources and websites. Saved credentials are stored based on user profiles in each user's Credential Locker. Credentials are encrypted and stored at the following location:

PS C:\Users\[Username]\AppData\Local\Microsoft\[Vault/Credentials]\

There are various methods to decrypt credentials saved using Credential Manager.

At a glance: NTDS vs LSA vs CM vs LSASS

NTDS:

SAM:

LSASS: Local System Authority Subsystem Service