Skip to main content

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 in Local 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 Arguments

/unprotect
flag
Force use of CryptUnprotectData() for decryption. Default behavior in unprivileged contexts. Must run from the user context that owns the state keys.
/pvk
string
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
Requires domain admin rights to obtain via the backupkey command.
{GUID}:SHA1
string
One or more DPAPI masterkey GUID:SHA1 mappings for decryption.
Extract these with Mimikatz: sekurlsa::dpapi
/mkfile
file
File containing one or more GUID:SHA1 masterkey mappings (one per line).
/password
string
Decrypt target user’s masterkeys using plaintext password. Works remotely.
/ntlm
string
Decrypt target user’s masterkeys using NTLM hash. Works remotely.
/prekey
string
Decrypt target user’s masterkeys using DPAPI prekey (domain or local SHA1).
  • Domain users: Use dpapi field from Mimikatz sekurlsa::msv
  • Local users: Use sha1 field from Mimikatz sekurlsa::msv
/rpc
flag
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:
  1. Read encrypted state key from Local State file
  2. Decrypt state key using DPAPI
  3. Use decrypted state key to decrypt cookies/logins

State Key Storage Format

The state key is stored in the Local State JSON file under the os_crypt.encrypted_key field:
The encrypted key format:
  1. Header: “DPAPI” (5 bytes)
  2. 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:
Example Output:
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

  1. File Access Patterns
    • Reading Local State JSON files from browser directories
    • Accessing multiple users’ browser profile directories
    • Parsing JSON configuration files
  2. Process Behavior
    • SharpChrome.exe enumerating user profiles
    • DPAPI API calls for decryption
    • Accessing browser data directories
  3. Network Activity
    • Remote file access to browser profile paths
    • SMB connections to multiple workstations
    • Domain controller communication for RPC decryption
  4. API Monitoring
    • CryptUnprotectData calls
    • File system access to Local State files
    • JSON parsing operations

OPSEC Recommendations

Defensive Detection Points:
  • State key extraction is less obvious than direct cookie/login extraction
  • Local State files are legitimate config files (less suspicious to read)
  • Multiple Local State file accesses in short time frame is suspicious
  • Remote extraction via SMB generates network logs
  • Consider extracting state keys separately from credential usage
  • Use state keys offline to avoid detection during credential extraction

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

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

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
Solutions:
  • 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
Possible causes:
  • Wrong user context for CryptUnprotectData
  • Missing or incorrect masterkey
  • Corrupted Local State file
Solutions:
  • 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
Possible causes:
  • State key extracted incorrectly (wrong format)
  • State key changed (user cleared browser data)
  • Credentials use different encryption
Solutions:
  • Re-extract state key
  • Verify state key is 64 hexadecimal characters
  • Check if cookies/logins are from before Chrome 80
  • Try automatic decryption without manual state key
Possible causes:
  • No administrative access to remote system
  • Firewall blocking SMB
  • Local State file not found on remote system
Solutions:
  • Verify local admin rights on remote system
  • Check SMB (port 445) connectivity
  • Ensure browser is installed on remote system
  • Use /pvk or /password with /server

Best Practices

Operational Best Practices:
  1. Extract Once, Use Many: State keys don’t change often, extract once and reuse
  2. Offline Decryption: Extract state keys remotely, decrypt credentials locally
  3. Save State Keys: Store extracted state keys for future use
  4. Automate Collection: Script state key extraction across multiple systems
  5. Verify Format: Ensure state keys are 64-character hex strings
  6. Test First: Verify state key works before large-scale collection

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

Additional Resources