Repository navigation
Conversation
Firefox key derivation assumed an empty primary password. Add --firefox-pw / --firefox-pw-stdin; each profile is tried with the empty password first, then the given one, so one run can mix protected and unprotected profiles.
--firefox-pw-stdin read a fresh line per profile, so only the first got the password; read it once and lazily, and make it exclusive with --keychain-pw-stdin. A key4.db that will not parse is a corrupt DB, not a wrong password. Add positive and end-to-end primary-password tests.
moonD4rk
force-pushed
the
feat/firefox-primary-password
branch
from
November 18, 2026 09:23
57b0fdd to
b0c01ff
Compare
NSS gives a newly set primary password a 48-byte salt and SHA-384, so real Firefox 159 profiles failed the password check even with the right password.
It bypassed DumpOptions, read once inside cmd, and used []byte where the keychain password uses string; Execute now owns the once-per-run read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #109 — decrypt Firefox profiles protected by a Primary Password.
Stacked on #703 (base branch
feat/configurable-storage-value-limit); review that first. GitHub retargets this tomainonce #703 merges.What
--firefox-pw/--firefox-pw-stdinondump(mirrors--keychain-pw). The password rides onbrowser.Input, and only the dump path supplies it (restore is Chromium-only).SHA1(globalSalt ∥ password), or SHA-384 when the global salt is 48 bytes, which current NSS writes for a newly set primary password (Firefox 159 does).--firefox-pw-stdinreads stdin once and reuses it for every protected profile; it is mutually exclusive with--keychain-pw-stdin, which would read the same stream.key4.dbwhose password check will not parse is reported as corrupt, not as a wrong password.No prompt
A missing
--firefox-pwmeans the empty password, so the common no-password profile never triggers a prompt; a profile that actually needs one errors and names the flag (shown with-v; the table reports "not recovered").Validated with real Firefox 159 (macOS, throwaway profiles)
Two profiles with a primary password and one without, each holding one fake login:
pass it with --firefox-pwprimary password is incorrect--firefox-pwand via--firefox-pw-stdin: all three decrypt--firefox-pw-stdintogether with--keychain-pw-stdin: rejectedTest
go test ./...green; a known-answer test replays a real Firefox 159 primary-passwordkey4.dbcheck; unit tests cover password selection (right / missing / wrong / corrupt check, and no read when the empty password fits) an end-to-endretrieveMasterKeyover a 48-byte-saltkey4.db+logins.jsonfixture; and anExecute-level test that two protected profiles share one password read; the existing Firefox e2e tests keep the empty-password path;golangci-lintclean; cross-compiles linux/windows/darwin.