Documentation
¶
Overview ¶
Package masterkey retrieves Chromium master keys (per-platform retrievers + a cross-host Dump format). Firefox and Safari own their own key paths and don't route through here.
Index ¶
Constants ¶
const DumpVersion = "2"
Variables ¶
This section is empty.
Functions ¶
func DecryptKeychainRecords ¶
func DecryptKeychainRecords() ([]keychainbreaker.GenericPassword, error)
DecryptKeychainRecords dumps securityd memory, scans for the keychain master key, and uses it to read login.keychain-db's generic password records. Requires root.
Types ¶
type ChainRetriever ¶
type ChainRetriever struct {
// contains filtered or unexported fields
}
ChainRetriever tries retrievers in order, first success wins (macOS V10: gcoredump→password→security).
func (*ChainRetriever) RetrieveKey ¶
func (c *ChainRetriever) RetrieveKey(hints Hints) ([]byte, error)
type Dump ¶
type Dump struct {
Version string `json:"version"`
CreatedAt time.Time `json:"created_at"`
Host Host `json:"host"`
Vaults []Vault `json:"vaults"`
}
Dump is the portable, cross-host container for Chromium master keys — produce it on one host to decrypt copied profile data on another without DPAPI / ABE / Keychain / D-Bus.
type GcoredumpRetriever ¶
type GcoredumpRetriever struct {
// contains filtered or unexported fields
}
GcoredumpRetriever extracts keychain secrets via CVE-2025-24204 (dumps securityd memory; needs root). Records are cached once (sync.Once) so the dump runs a single time across all browsers.
func (*GcoredumpRetriever) RetrieveKey ¶
func (r *GcoredumpRetriever) RetrieveKey(hints Hints) ([]byte, error)
RetrieveKey returns (nil, nil) on failure so ChainRetriever falls through silently — the common "needs root" case isn't warning-worthy and would drown real warnings (same as ABERetriever).
type Hints ¶
type Hints struct {
KeychainLabel string // macOS Keychain account / Linux D-Bus Secret Service label
WindowsABEKey string // Windows ABE browser key (e.g. "chrome"); "" → ABE not applicable
LocalStatePath string // path to (temp-copied) Local State JSON; only used on Windows
}
Hints bundles inputs for Retriever; each retriever reads only the field that applies to it.
type Host ¶
type Host struct {
OS string `json:"os"`
Arch string `json:"arch"`
Hostname string `json:"hostname,omitempty"`
User string `json:"user,omitempty"`
}
Host OS / Arch always set; Hostname / User best-effort (empty on syscall failure).
type KeychainPasswordRetriever ¶
type KeychainPasswordRetriever struct {
Password string
// contains filtered or unexported fields
}
KeychainPasswordRetriever unlocks login.keychain-db with the macOS login password (no root). Records are cached once and reused across browsers.
func (*KeychainPasswordRetriever) RetrieveKey ¶
func (r *KeychainPasswordRetriever) RetrieveKey(hints Hints) ([]byte, error)
type MasterKeys ¶
type MasterKeys struct {
V10 []byte `json:"v10,omitempty"`
V11 []byte `json:"v11,omitempty"`
V20 []byte `json:"v20,omitempty"`
}
MasterKeys holds one key per cipher tier; a profile can mix tiers (Win v10+v20, Linux v10+v11), so each is populated independently. A nil tier = that cipher version can't be decrypted.
func NewMasterKeys ¶
func NewMasterKeys(r Retrievers, hints Hints) (MasterKeys, error)
NewMasterKeys fetches each non-nil tier and joins per-tier errors. A retriever returning (nil, nil) means "tier not applicable" and contributes no key. Never logs — the caller decides severity.
func (MasterKeys) HasAny ¶
func (k MasterKeys) HasAny() bool
type Retriever ¶
Retriever obtains a Chromium master key from one platform source (DPAPI, Keychain, D-Bus, …).
type Retrievers ¶
Retrievers is the per-tier retriever configuration; unused slots are nil.
func DefaultRetrievers ¶
func DefaultRetrievers(keychainPassword string) Retrievers
DefaultRetrievers wires the macOS V10 chain (the only tier Chromium uses here), first success wins:
- GcoredumpRetriever — CVE-2025-24204 exploit (root only)
- KeychainPasswordRetriever — direct unlock, skipped when password is empty
- SecurityCmdRetriever — `security` CLI fallback (may prompt)
type SecurityCmdRetriever ¶
type SecurityCmdRetriever struct {
// contains filtered or unexported fields
}
SecurityCmdRetriever queries Keychain via the macOS `security` CLI (may prompt). Results are cached per storage name so each browser's key is fetched once.
func (*SecurityCmdRetriever) RetrieveKey ¶
func (r *SecurityCmdRetriever) RetrieveKey(hints Hints) ([]byte, error)
type StaticRetriever ¶
type StaticRetriever struct {
// contains filtered or unexported fields
}
StaticRetriever returns pre-supplied key bytes (from a Dump) instead of platform retrieval, ignoring Hints. An empty key returns (nil, nil) — the "tier not applicable" signal NewMasterKeys expects.
func NewStaticRetriever ¶
func NewStaticRetriever(key []byte) *StaticRetriever
NewStaticRetriever wraps key bytes; a nil/empty key yields a retriever that reports the tier unavailable.
func (*StaticRetriever) RetrieveKey ¶
func (p *StaticRetriever) RetrieveKey(_ Hints) ([]byte, error)
type Vault ¶
type Vault struct {
Browser string `json:"browser"`
Kind string `json:"kind"`
UserDataDir string `json:"user_data_dir"`
Profiles []string `json:"profiles"`
Keys MasterKeys `json:"keys"`
}
Vault groups profiles sharing master keys (master keys are per-installation, not per-profile). Browser is the lookup key (e.g. "chrome"); Kind is the engine ("chromium"|"chromium-yandex"| "chromium-opera") so a consumer can rebuild the engine without the local browser table.