Overview
The statekeys command locates and decrypts AES state keys used by Chrome 80+ and other Chromium-based browsers to encrypt cookies and login data. Starting with Chrome version 80, Google moved from direct DPAPI encryption to a two-layer approach where an AES state key (protected by DPAPI) is used to encrypt credentials. This command searches for Chromium-based application state key files (stored inLocal State JSON files), decrypts the DPAPI-protected state keys, and outputs them in a format that can be used with the cookies and logins commands for credential decryption.
Key Features
- Automatically discovers state keys for multiple browsers
- Supports Chrome, Edge, Brave, and Slack
- Decrypts DPAPI-protected AES state keys
- Outputs keys for use with cookies/logins commands
- Handles both local and remote extraction
- Processes all users when elevated
Basic Usage
Command Arguments
- Decryption
- Targeting
- Output
Decryption Arguments
Force use of CryptUnprotectData() for decryption. Default behavior in unprivileged contexts. Must run from the user context that owns the state keys.
Use a DPAPI domain backup key to first decrypt user masterkeys, then decrypt state keys.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.
Chrome 80+ State Key Architecture
Why State Keys Exist
Starting with Chrome 80 (released February 2020), Google introduced a new security architecture for credential storage to improve cross-platform compatibility and security.Architecture Overview
1
State Key Generation
Chrome generates a random AES-256 key when first launched.
2
DPAPI Protection
The AES state key is encrypted using Windows DPAPI and stored in the
Local State JSON file.3
Credential Encryption
New cookies and login credentials are encrypted using the AES state key instead of direct DPAPI encryption.
4
Decryption Process
To decrypt credentials:
- Read encrypted state key from Local State file
- Decrypt state key using DPAPI
- Use decrypted state key to decrypt cookies/logins
State Key Storage Format
The state key is stored in theLocal State JSON file under the os_crypt.encrypted_key field:
- Header: “DPAPI” (5 bytes)
- DPAPI Blob: Encrypted AES key
Supported Browsers
All Chromium-based browsers version 80+ use this architecture:Google Chrome
Version: 80+ (February 2020 and later)State File:
%LOCALAPPDATA%\Google\Chrome\User Data\Local StateDefault target for statekeys command.Microsoft Edge
Version: All Chromium-based versionsState File:
%LOCALAPPDATA%\Microsoft\Edge\User Data\Local StateEdge adopted Chromium’s encryption from the start.Brave Browser
Version: All versionsState File:
%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data\Local StateUses same encryption as Chrome.Slack Desktop
Version: Recent versionsState File:
%APPDATA%\Slack\Local StateSlack’s Electron app uses Chromium engine.Example Workflows
Scenario 1: Extract Local State Keys
Extract state keys from the local system:Scenario 2: Use State Keys for Cookie Decryption
Extract state keys and use them to decrypt cookies:Scenario 3: Domain-Wide State Key Extraction
As domain admin, extract state keys from all domain workstations:Scenario 4: Targeted State Key Extraction
Extract state keys from specific users or browsers:Scenario 5: Complete Chrome 80+ Credential Extraction
Full workflow for Chrome 80+ credential extraction:Scenario 6: Remote State Key Extraction with Password
Extract state keys from remote systems using user credentials:Example Output
Successful State Key Extraction
Manual State Key Extraction
If SharpChrome is unavailable, you can manually extract state keys using PowerShell and the DPAPI APIs.Manual PowerShell Method
Using Python with dpapick
Detection Considerations
EDR/AV Detection Vectors
-
File Access Patterns
- Reading Local State JSON files from browser directories
- Accessing multiple users’ browser profile directories
- Parsing JSON configuration files
-
Process Behavior
- SharpChrome.exe enumerating user profiles
- DPAPI API calls for decryption
- Accessing browser data directories
-
Network Activity
- Remote file access to browser profile paths
- SMB connections to multiple workstations
- Domain controller communication for RPC decryption
-
API Monitoring
- CryptUnprotectData calls
- File system access to Local State files
- JSON parsing operations
OPSEC Recommendations
Log Sources
- Windows Event Logs: File access events, DPAPI operations
- Sysmon: File access to Local State files (Event ID 11)
- EDR Telemetry: Process creation, API calls, file operations
- Network Logs: SMB traffic to ADMIN$ shares
Related Commands
SharpChrome Cookies
Use state keys to decrypt browser cookies
SharpChrome Logins
Use state keys to decrypt saved login credentials
Backup Key Retrieval
Retrieve domain DPAPI backup key from DC
SharpChrome Overview
Complete SharpChrome documentation
Tips and Troubleshooting
Common Issues
No state keys found
No state keys found
Possible causes:
- Browser version is older than Chrome 80
- Browser never been launched (no Local State created)
- Looking in wrong user profile
- Browser using different encryption method
- Verify Chrome/Edge version is 80+
- Check that Local State file exists in browser directory
- Ensure running as correct user or using proper decryption method
- Try extracting cookies/logins directly without state key
State key decryption fails
State key decryption fails
Possible causes:
- Wrong user context for CryptUnprotectData
- Missing or incorrect masterkey
- Corrupted Local State file
- Run as the user who owns the state key
- Use correct decryption method (/pvk, /password, masterkeys)
- Verify Local State file is valid JSON
- Try alternative decryption methods
State key doesn't work with cookies/logins
State key doesn't work with cookies/logins
Remote extraction fails
Remote extraction fails
Possible causes:
- No administrative access to remote system
- Firewall blocking SMB
- Local State file not found on remote system
- Verify local admin rights on remote system
- Check SMB (port 445) connectivity
- Ensure browser is installed on remote system
- Use
/pvkor/passwordwith/server
Best Practices
State Key Persistence
State keys remain valid until:- User clears browser data (settings/cookies)
- Browser is reinstalled
- User profile is recreated
- Windows reinstalled or profile migrated
State keys are remarkably persistent and can remain valid for months or years, making them valuable for long-term access.
Performance Considerations
- Local extraction: Very fast, completes in seconds
- Remote extraction: Depends on network speed
- Multi-user systems: Scales linearly with user count
- Multiple browsers: Each browser has independent state key