Overview
The cookies command searches for Chromium-based browser ‘Cookies’ files and decrypts cookie values stored in SQLite databases. This enables session hijacking by extracting authentication cookies that can be imported into another browser to impersonate users without requiring passwords. SharpChrome’s lockless SQLite implementation allows cookie extraction while the target browser is still running, making it ideal for stealthy credential harvesting operations. The command supports filtering by cookie name or URL using regex patterns, and can output in multiple formats including JSON for easy import.Key Features
- Extracts encrypted cookies from Chromium browsers
- Supports session hijacking via cookie import
- Regex filtering by cookie name and URL
- JSON export compatible with EditThisCookie extension
- Lockless database access (browser stays open)
- Filters expired cookies automatically
- Chrome 80+ AES state key support
- Remote cookie extraction capability
Basic Usage
Command Arguments
- Decryption
- Targeting
- Output
- Filtering
Decryption Arguments
Force use of CryptUnprotectData() for decryption. Default behavior in unprivileged contexts. Must be run from the user context that saved the cookies.
Use a DPAPI domain backup key to decrypt user masterkeys, then decrypt cookies.Accepts two formats:
- Base64-encoded key:
/pvk:HvG1sAAAAAABAAAAAAAAAAAAAAACU... - File path:
/pvk:key.pvk
backupkey command.One or more DPAPI masterkey GUID:SHA1 mappings for decryption.Extract these with Mimikatz:
sekurlsa::dpapiFile containing one or more GUID:SHA1 masterkey mappings (one per line).
Decrypt target user’s masterkeys using plaintext password. Works remotely.
Decrypt target user’s masterkeys using NTLM hash. Works remotely.
Decrypt target user’s masterkeys using DPAPI prekey (domain or local SHA1).
- Domain users: Use
dpapifield from Mimikatzsekurlsa::msv - Local users: Use
sha1field from Mimikatzsekurlsa::msv
Decrypt target user’s masterkeys by asking the domain controller via RPC.
Provide a pre-decrypted AES state key for Chrome 80+ cookie decryption.Obtain using the
statekeys command first.Chrome 80+ State Key Encryption
Starting with Chrome 80, cookies use AES encryption via a state key instead of direct DPAPI encryption.State Key Process
- State Key Storage: AES key stored in
Local Statefile - DPAPI Protection: State key encrypted with DPAPI
- Cookie Encryption: Cookies encrypted with AES state key
Automatic Handling
SharpChrome automatically handles Chrome 80+ encryption:Manual State Key Usage
For better control, extract state keys separately:Supported Browsers
Google Chrome
Default target. Extracts cookies from all Chrome profiles.Location:
%LOCALAPPDATA%\Google\Chrome\User Data\Default\CookiesMicrosoft Edge
Chromium-based Edge. Use
/browser:edge.Location: %LOCALAPPDATA%\Microsoft\Edge\User Data\Default\CookiesBrave Browser
Privacy-focused browser. Use
/browser:brave.Location: %LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data\Default\CookiesSlack Desktop
Slack desktop app. Use
/browser:slack.Location: %APPDATA%\Slack\CookiesCookie Hijacking Guide
What is Cookie Hijacking?
Cookie hijacking involves stealing authenticated session cookies from a target user and importing them into your browser. This bypasses the need for passwords and multi-factor authentication in many cases, as the session is already established.Step-by-Step Workflow
1
Extract Cookies
Extract cookies from the target system in JSON format:
2
Install EditThisCookie
Install the EditThisCookie extension in your Chrome browser.This extension allows easy cookie import/export and is compatible with SharpChrome’s JSON output.
3
Import Cookies
In your browser:
- Navigate to the target domain (e.g., portal.office.com)
- Click the EditThisCookie extension icon
- Click the import icon (upload symbol)
- Paste the JSON output from SharpChrome
- Click “Import” to load the cookies
4
Access the Session
Refresh the page. You should now be authenticated as the target user without entering credentials.Important: The session remains active as long as:
- The cookies haven’t expired (use
/setneverexpire) - The target user hasn’t logged out
- The service doesn’t detect anomalies (different IP, user-agent, etc.)
High-Value Cookie Targets
Office 365 / Azure
AWS Console
GitHub / GitLab
Corporate VPN / Portal
Session Persistence Strategies
Example Workflows
Scenario 1: Basic Cookie Extraction
Extract all cookies for the current user:Scenario 2: Targeted Session Hijacking
Extract specific cookies for session hijacking:Scenario 3: Domain-Wide Cookie Harvesting
As domain admin, harvest cookies from all domain workstations:Scenario 4: Filtered Cookie Extraction
Extract specific cookies using regex patterns:Scenario 5: Remote Cookie Extraction
Extract cookies from remote systems:Scenario 6: Multi-Browser Cookie Extraction
Extract cookies from all Chromium-based browsers:Example Output
CSV Format (Default)
Table Format
JSON Format (EditThisCookie Compatible)
Detection Considerations
EDR/AV Detection Vectors
-
Process Activity
- SharpChrome.exe accessing Cookies SQLite databases
- Mass cookie file enumeration across user profiles
- Unusual SQLite database operations
-
File Access Patterns
- Reading Cookies files from multiple user profiles
- Accessing Local State files for state keys
- Lockless database access to open Cookies files
-
Network Activity
- Remote file access to UNC paths for cookie databases
- SMB connections to multiple workstations
- Bulk cookie exfiltration over network
-
Behavioral Indicators
- Rapid enumeration of browser profile directories
- Simultaneous access to multiple browsers’ cookie stores
- Cookie export to JSON files
OPSEC Recommendations
Anomaly Detection
Many enterprise applications detect session anomalies:- IP Address Changes: Session used from different location
- User-Agent Strings: Different browser/OS detected
- Geolocation: Login from impossible travel location
- Device Fingerprinting: Device characteristics don’t match
- Behavioral Analytics: Usage patterns differ from normal
Related Commands
SharpChrome Logins
Extract saved login credentials from browsers
SharpChrome State Keys
Extract AES state keys for Chrome 80+ decryption
Backup Key Retrieval
Retrieve domain DPAPI backup key from DC
SharpChrome Overview
Complete SharpChrome documentation
Tips and Troubleshooting
Common Issues
No cookies extracted
No cookies extracted
Cookies decrypted but can't login
Cookies decrypted but can't login
JSON import fails in browser
JSON import fails in browser
Possible causes:
- JSON format malformed
- Wrong domain for cookie import
- Browser extension not installed
- Validate JSON syntax
- Navigate to correct domain first
- Install EditThisCookie extension
- Try importing cookies one at a time
Remote extraction fails
Remote extraction fails
Possible causes:
- No administrative access to remote system
- Firewall blocking SMB
- Missing decryption method
- Verify local admin rights on target
- Check SMB (port 445) connectivity
- Always use
/pvkor/passwordwith/server
Best Practices
Performance Notes
- Local extraction: Completes in seconds
- Remote extraction: Depends on network speed and user count
- Lockless access: Browser remains functional during extraction
- Large cookie databases: May take longer to process and filter