masterkey

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package masterkey retrieves Chromium master keys; Firefox and Safari keep their own key paths.

Index

Constants

View Source
const DumpVersion = "2"

Variables

View Source
var ErrNotApplicable = errors.New("retriever not applicable")

ErrNotApplicable is a retriever's way of stepping aside; it never counts as a failure.

Functions

func DecryptDPAPI

func DecryptDPAPI(_ []byte) ([]byte, error)

func DecryptKeychainRecords

func DecryptKeychainRecords() ([]keychainbreaker.GenericPassword, error)

DecryptKeychainRecords steps aside in default builds, which leave out the securityd dump (-tags keychain_gcore).

Types

type ABEKind

type ABEKind int

ABEKind is the payload's elevation-service dialect; the zero ABENone leaves a browser on DPAPI alone.

const (
	ABENone ABEKind = iota
	ABEChromeBase
	ABEEdge
	ABEAvast
)

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 keys.json: produced on one host, it decrypts copied profile data on another.

func NewDump

func NewDump() Dump

func ReadJSON

func ReadJSON(reader io.Reader) (Dump, error)

ReadJSON rejects a version it cannot interpret, since a silent misparse is worse than an error.

func (Dump) WriteJSON

func (d Dump) WriteJSON(writer io.Writer) error

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 Locator

type Locator struct {
	LocalState    string // the copied Local State; "" when the user data dir has none
	KeychainLabel string // macOS Keychain account / Linux D-Bus Secret Service label
	Exe           string
	ExeFallbacks  []string
	ABE           ABEKind
	Keychain      LoginKeychain // macOS: the run's login keychain; nil elsewhere
}

Locator is where one user data dir's keys are found; each retriever reads only the fields of its OS.

type LoginKeychain

type LoginKeychain interface {
	GenericPassword(ctx context.Context, account string) ([]byte, error)
}

LoginKeychain is the one method the macOS v10 retriever reads from the run's login keychain.

type Retriever

type Retriever interface {
	Version() Version
	Retrieve(ctx context.Context, loc Locator) ([]byte, error)
}

Retriever obtains one version's key from one OS secret store.

type Set

type Set map[Version][]byte

Set holds one user data dir's key per version; encoding/json writes it as keys.json's "keys" object.

func RetrieveAll

func RetrieveAll(ctx context.Context, locator Locator) (Set, error)

RetrieveAll keeps the first key per version and reports an error only when every retriever of that version fails.

type Vault

type Vault struct {
	Browser string `json:"browser"`
	// ID names a second user data dir of the same browser ("arc-2"); the first one's is Browser, so it is left out.
	ID          string   `json:"id,omitempty"`
	Kind        string   `json:"kind"`
	UserDataDir string   `json:"user_data_dir"`
	Profiles    []string `json:"profiles"`
	Keys        Set      `json:"keys"`
}

Vault names its engine in Kind, so a consumer can read a vault without the browser in its own table.

type Version

type Version string

Version is a Chromium ciphertext's version prefix.

const (
	V10 Version = "v10"
	V11 Version = "v11"
	V20 Version = "v20"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL