From 33e2251220bb0593b4d4e637eb2c99be435cf433 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Fri, 9 Jan 2026 05:39:01 -0500 Subject: [PATCH] master password v146 non-mixed profiles. inspect. ruff. use --reveal-keys flag use git-sqlite-filter for *.db files --- .gitattributes | 7 + Makefile | 6 +- ffpass/__init__.py | 494 +++++++++++++++++++++++++------ ffpass/nss.py | 155 ++++++++++ requirements-dev.txt | 2 + tests/conftest.py | 20 ++ tests/firefox-146-aes/key4.db | Bin 294912 -> 3808 bytes tests/firefox-14iv/cert9.db | 9 + tests/firefox-14iv/key4.db | 13 + tests/firefox-14iv/logins.json | 1 + tests/firefox-14iv/pkcs11.txt | 5 + tests/firefox-70/key4.db | Bin 294912 -> 2320 bytes tests/firefox-84/key4.db | Bin 294912 -> 2931 bytes tests/firefox-mixed-keys/key4.db | Bin 16384 -> 476 bytes tests/firefox-mp-70/key4.db | Bin 294912 -> 2320 bytes tests/firefox-mp-84/key4.db | Bin 294912 -> 2931 bytes tests/firefox-mp-test/key4.db | Bin 16384 -> 618 bytes tests/test_inspect.py | 58 ++++ tests/test_key.py | 34 ++- tests/test_mixed_keys_run.py | 21 +- tests/test_native_verify.py | 44 +++ tests/test_run.py | 61 ++-- tests/test_sha256_mock.py | 218 ++++++++++++++ 23 files changed, 985 insertions(+), 163 deletions(-) create mode 100644 .gitattributes create mode 100644 ffpass/nss.py create mode 100644 tests/conftest.py create mode 100644 tests/firefox-14iv/cert9.db create mode 100644 tests/firefox-14iv/key4.db create mode 100644 tests/firefox-14iv/logins.json create mode 100644 tests/firefox-14iv/pkcs11.txt create mode 100644 tests/test_inspect.py create mode 100644 tests/test_native_verify.py create mode 100644 tests/test_sha256_mock.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f42f38d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,7 @@ +*.db filter=sqlite diff=sqlite + +# NOTE: you can also configure the git filter/smudge for this repo: +# git config set --local filter.sqlite.clean=git-sqlite-clean %f +# git config set --local filter.sqlite.smudge=git-sqlite-smudge %f +# git config set --local filter.sqlite.required=true + diff --git a/Makefile b/Makefile index 9e05248..d9951e3 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ release: build ## Upload release to PyPI (via Twine) -LINT_LOCS_PY ?= ffpass/ scripts tests/ +LINT_LOCS_PY ?= ffpass/ tests/ .PHONY: format format: ## Not phased in yet, no-op @@ -33,6 +33,7 @@ format: ## Not phased in yet, no-op .PHONY: lint lint: ## Lint the code flake8 --count --show-source --statistics + ruff check ${LINT_LOCS_PY} .PHONY: test @@ -54,5 +55,8 @@ clean: ## Clean up build files/cache find . \ -name .venv -prune \ -o -name __pycache__ -print \ + -o -name *.egg -print \ -o -name .pytest_cache -print \ + -o -name .coverage -print \ + -o -name .mypy_cache -print \ | xargs -r rm -rf diff --git a/ffpass/__init__.py b/ffpass/__init__.py index 3184934..a134e2d 100755 --- a/ffpass/__init__.py +++ b/ffpass/__init__.py @@ -9,11 +9,11 @@ The MIT License (MIT) Copyright (c) 2018 Louis Abraham Laurent Clevy (@lorenzo2472) # from https://github.com/lclevy/firepwd/blob/master/firepwd.py -\x1B[34m\033[F\033[F +\x1b[34m\033[F\033[F ffpass can import and export passwords from Firefox Quantum. -\x1B[0m\033[1m\033[F\033[F +\x1b[0m\033[1m\033[F\033[F example of usage: ffpass export --file passwords.csv @@ -28,30 +28,28 @@ If you found this code useful, add a star on Method: PBKDF2-HMAC-SHA256 | Iterations: {iters}") - logging.debug(f" > Salt: {censor(entry_salt)} (Local) + {censor(global_salt)} (Global)") + logging.debug( + f" > Salt: {censor(entry_salt)} (Local) + {censor(global_salt)} (Global)" + ) - enc_pwd = sha1(global_salt + master_password.encode('utf-8')).digest() - k = pbkdf2_hmac('sha256', enc_pwd, entry_salt, iters, dklen=key_len) + enc_pwd = hash_password(global_salt, master_password, hash_method) + k = pbkdf2_hmac("sha256", enc_pwd, entry_salt, iters, dklen=key_len) iv = clean_iv(decoded[0][1][1][1].asOctets()) logging.debug(f" > Cipher: AES-256-CBC | IV: {censor(iv)}") @@ -162,19 +192,23 @@ def decrypt_key_entry(a11, global_salt, master_password): ciphertext = decoded[1].asOctets() logging.debug(" > Method: PKCS12-3DES-Derivation") - logging.debug(f" > Salt: {censor(entry_salt)} (Local) + {censor(global_salt)} (Global)") + logging.debug( + f" > Salt: {censor(entry_salt)} (Local) + {censor(global_salt)} (Global)" + ) - return PKCS7unpad(decrypt3DES(global_salt, master_password, entry_salt, ciphertext)) + return PKCS7unpad( + decrypt3DES(global_salt, master_password, entry_salt, ciphertext) + ) except Exception as e: logging.debug(f" > Failed: {e}") return None -def verify_password(global_salt, item2, pwd): +def verify_password(global_salt, item2, pwd): # noqa: C901 """ - Verifies the master password against the metadata entry (item2). Raises WrongPassword on failure. + Returns the successful hashing method ('sha1' or 'sha256'). """ try: decodedItem2, _ = der_decode(item2) @@ -183,27 +217,98 @@ def verify_password(global_salt, item2, pwd): except (IndexError, AttributeError): raise ValueError("Could not decode password validation data structure.") - if algorithm_oid == OID_PKCS12_3DES: - entrySalt = decodedItem2[0][1][0].asOctets() - cipherT = decodedItem2[1].asOctets() - clearText = decrypt3DES(global_salt, pwd, entrySalt, cipherT) - elif algorithm_oid == OID_PBES2: - algo = decodedItem2[0][1][0] - pbkdf2_params = algo[1] - entry_salt = pbkdf2_params[0].asOctets() - iters = int(pbkdf2_params[1]) - key_len = int(pbkdf2_params[2]) - enc_pwd = sha1(global_salt + pwd.encode('utf-8')).digest() - k = pbkdf2_hmac('sha256', enc_pwd, entry_salt, iters, dklen=key_len) - iv = clean_iv(decodedItem2[0][1][1][1].asOctets()) - cipher = AES.new(k, AES.MODE_CBC, iv) - clearText = cipher.decrypt(decodedItem2[1].asOctets()) - else: - raise ValueError(f"Unknown encryption method OID: {algorithm_oid}") + # Try various hashing combinations to guess the correct pre-hashing used by Firefox + methods_to_try = [ + "sha1", + "sha256", + "plaintext", + "sha512", + "sha256_no_salt", + "sha1_no_salt", + "sha512_no_salt", + ] + seen_14_byte_iv = False + for method in methods_to_try: + try: + logging.debug( + f"Attempting verification with method: {method}. Input Pwd Len: {len(pwd)}" + ) + if algorithm_oid == OID_PKCS12_3DES: + entrySalt = decodedItem2[0][1][0].asOctets() + cipherT = decodedItem2[1].asOctets() + clearText = decrypt3DES(global_salt, pwd, entrySalt, cipherT) + if clearText == b"password-check\x02\x02": + logging.info(f"Verified: Method={method} (3DES)") + return method + + elif algorithm_oid == OID_PBES2: + algo = decodedItem2[0][1][0] + pbkdf2_params = algo[1] + entry_salt = pbkdf2_params[0].asOctets() + iters = int(pbkdf2_params[1]) + key_len = int(pbkdf2_params[2]) + + hmac_algo = "sha256" + if len(pbkdf2_params) > 3: + prf_oid = pbkdf2_params[3][0].asTuple() + if prf_oid == (1, 2, 840, 113549, 2, 7): + hmac_algo = "sha1" + elif prf_oid == (1, 2, 840, 113549, 2, 9): + hmac_algo = "sha256" + elif prf_oid == (1, 2, 840, 113549, 2, 11): + hmac_algo = "sha512" + + cipher_params = decodedItem2[0][1][1] + raw_iv = cipher_params[1].asOctets() + + iv_candidates = [("standard", raw_iv)] + if len(raw_iv) == 14: + seen_14_byte_iv = True + iv_candidates = [ + ("clean_iv", b"\x04\x0e" + raw_iv), + ("pad_start_null", b"\x00\x00" + raw_iv), + ("pad_end_null", raw_iv + b"\x00\x00"), + ] + + cipherT = decodedItem2[1].asOctets() + for iv_name, iv in iv_candidates: + + try: + enc_pwd = hash_password(global_salt, pwd, method) + k = pbkdf2_hmac( + hmac_algo, enc_pwd, entry_salt, iters, dklen=key_len + ) + cipher = AES.new(k, AES.MODE_CBC, iv) + clearText = cipher.decrypt(cipherT) + + if clearText == b"password-check\x02\x02": + logging.info(f"Verified: Method={method}, IV={iv_name}") + if iv_name == "pad_start_null": + logging.warning( + "NOTICE: Profile uses NULL-PREFIXED IVs." + ) + return method + else: + logging.debug( + f" Mismatch: {method} / {iv_name} -> {clearText.hex()}" + ) + + except Exception: + continue + else: + raise ValueError(f"Unknown OID: {algorithm_oid}") + + except Exception as outer_e: + logging.debug(f"Method {method} skipped: {outer_e}") + continue - if clearText != b"password-check\x02\x02": - raise WrongPassword() + if seen_14_byte_iv: + raise IncompatibleCryptoError() + raise WrongPassword() + + except WrongPassword: + raise except Exception as e: logging.debug(f"Password check failed: {e}") raise WrongPassword() @@ -227,7 +332,7 @@ def get_all_keys(directory, pwd=""): logging.info(f"[*] Global Salt: {censor(global_salt)}") # 2. VERIFY PASSWORD EXPLICITLY - verify_password(global_salt, item2, pwd) + hash_method = verify_password(global_salt, item2, pwd) logging.info("[*] Password Verified Correctly") # 3. Find ALL Keys @@ -244,10 +349,12 @@ def get_all_keys(directory, pwd=""): for idx, (a11, a102) in enumerate(rows): logging.debug(f"[*] Attempting to decrypt Key #{idx} (ID: {censor(a102)})...") - key = decrypt_key_entry(a11, global_salt, pwd) + key = decrypt_key_entry(a11, global_salt, pwd, hash_method) if key: - logging.info(f"[*] Decrypted Key #{idx}: {len(key)} bytes | ID: {a102.hex()}") + logging.info( + f"[*] Decrypted Key #{idx}: {len(key)} bytes | ID: {a102.hex()}" + ) found_keys.append(key) else: logging.debug(f"[*] Key #{idx}: Failed to decrypt (Corrupt?)") @@ -255,7 +362,9 @@ def get_all_keys(directory, pwd=""): if not found_keys: # Rows existed, but none decrypted successfully. # Since password was verified in step 2, this IS corruption. - raise Exception("Database corrupted: Password verified, but no valid master keys could be decrypted.") + raise Exception( + "Database corrupted: Password verified, but no valid master keys could be decrypted." + ) return found_keys, global_salt @@ -267,7 +376,7 @@ def try_decrypt_login(key, ciphertext, iv): cipher = AES.new(key, AES.MODE_CBC, iv) pt = cipher.decrypt(ciphertext) res = PKCS7unpad(pt) - text = res.decode('utf-8') + text = res.decode("utf-8") if is_valid_text(text): return text, "AES-Standard" except Exception: @@ -279,7 +388,7 @@ def try_decrypt_login(key, ciphertext, iv): cipher = DES3.new(key, DES3.MODE_CBC, iv[:8]) pt = cipher.decrypt(ciphertext) res = PKCS7unpad(pt) - text = res.decode('utf-8') + text = res.decode("utf-8") if is_valid_text(text): return text, "3DES-Standard" except Exception: @@ -391,14 +500,20 @@ def readCSV(csv_file): logging.debug(f"Breaking loop since we got an empty row at index={i}.") break # Heuristic: if it lacks a URL (index=1) and has user,pass (index=2,3), assume it's a header and continue - if ( - first_row[0].lower() in {"url", "hostname", "website", "site", "address", "link"} - or ( - first_row[1].lower() in {"username", "uname", "user", "u"} - and first_row[2].lower() in {"password", "passwd", "pass", "p"} - ) + if first_row[0].lower() in { + "url", + "hostname", + "website", + "site", + "address", + "link", + } or ( + first_row[1].lower() in {"username", "uname", "user", "u"} + and first_row[2].lower() in {"password", "passwd", "pass", "p"} ): - logging.debug(f"Continuing (skipping) over first row: index=0, [is_header={True}].") + logging.debug( + f"Continuing (skipping) over first row: index=0, [is_header={True}]." + ) continue # ~~~ END peek at first row ~~~~~~~~~~ @@ -431,9 +546,9 @@ def rawURL(url): def addNewLogins(key, jsonLogins, logins): nextId = jsonLogins["nextId"] timestamp = int(datetime.now().timestamp() * 1000) - logging.warning(f'adding {len(logins)} logins') + logging.warning(f"adding {len(logins)} logins") for i, (url, username, password) in enumerate(logins, nextId): - logging.info(f'adding {url} {username}') + logging.info(f"adding {url} {username}") entry = { "id": i, "hostname": url, @@ -471,9 +586,37 @@ def getProfiles() -> list[Path]: return profiles +def get_native_logins(directory, password): + """ + Attempts to decrypt logins using safe, native NSS interactions via ctypes. + Returns list of logins or None/Empty list on failure. + """ + try: + # Import explicitly to handle potential path issues + try: + from ffpass.nss import decrypt_logins_native + except ImportError: + try: + from nss import decrypt_logins_native + except ImportError: + import sys + + root_dir = str(Path(__file__).resolve().parent.parent) + if root_dir not in sys.path: + sys.path.append(root_dir) + from ffpass.nss import decrypt_logins_native + + return decrypt_logins_native(directory, password) + except Exception as e: + logging.debug(f"Native decryption attempt failed: {e}") + return None + + def guessDir() -> Path: if sys.platform not in PROFILE_GUESS_DIRS: - logging.error(f"Automatic profile selection is not supported for {sys.platform}") + logging.error( + f"Automatic profile selection is not supported for {sys.platform}" + ) logging.error("Please specify a profile to parse (-d path/to/profile)") raise NoProfile @@ -484,8 +627,10 @@ def guessDir() -> Path: raise NoProfile if len(profiles) > 1: - logging.error("More than one profile detected. Please specify a profile to parse (-d path/to/profile)") - logging.error("valid profiles:\n\t\t" + '\n\t\t'.join(map(str, profiles))) + logging.error( + "More than one profile detected. Please specify a profile to parse (-d path/to/profile)" + ) + logging.error("valid profiles:\n\t\t" + "\n\t\t".join(map(str, profiles))) raise NoProfile profile_path = profiles[0] @@ -494,40 +639,189 @@ def guessDir() -> Path: return profile_path -def askpass(directory): - password = "" +def askpass(directory, allow_native=False): + # Determine initial password source + password = os.environ.get("FFPASS_SECRET", "") + is_interactive = sys.stdin.isatty() and not password + + # If interactive and no env secret, prompt immediately for the first attempt + if is_interactive: + password = getpass("Master Password: ") + n = 0 - # Allow 1 automatic check + 2 user prompts = 3 attempts total. - # The condition "n < n_max" must allow n=0, n=1, n=2. - n_max = 3 + # Max attempts: If env var set, try it once. If fails and non-interactive, stop. + # If interactive, allow retry. + # User requested trying "twice". + n_max = 2 + while True: + # 1. Try Python Protocol try: keys, _ = get_all_keys(directory, password) # Prefer 32-byte key, fallback to first best_key = next((k for k in keys if len(k) == 32), keys[0]) - logging.info(f"Selected Master Key: {len(best_key)} bytes (from {len(keys)} candidates)") - return best_key - except WrongPassword: - n += 1 - if n >= n_max: - break - password = getpass("Master Password: ") + logging.info( + f"Selected Master Key: {len(best_key)} bytes (from {len(keys)} candidates)" + ) + return best_key, None + except (WrongPassword, IncompatibleCryptoError): + # Python protocol failed. + pass # Fall through to native check + + # 2. Try Native Protocol (Fallback) + if allow_native: + # We treat native failure as silent (wrong password) unless it succeeds. + # But we might want to log if it was attempted. + native_res = get_native_logins(directory, password) + if native_res: + logging.info("Successfully authenticated via Native NSS backend.") + return None, native_res + + # 3. Handle Failure / Retry Loop + n += 1 + + # If we are non-interactive/env-var based, do NOT loop unless we are falling back to interactive? + # If FFPASS_SECRET was used (n=1 checked), and verification failed... + if os.environ.get("FFPASS_SECRET"): + logging.error("FFPASS_SECRET verification failed (both Python and Native).") + break + + if n >= n_max: + logging.error(f"Wrong master password after {n} prompts.") + break + + print("Wrong password. Please try again.") + password = getpass("Master Password: ") + + return None, None + + +def main_inspect(args): # noqa: C901 + db_path = args.directory / "key4.db" + if not db_path.exists(): + logging.error(f"Error: {db_path} not found.") + return + + print(f"Inspecting Profile: {args.directory}") + print(f"Database: {db_path}") + + conn = sqlite3.connect(str(db_path)) + c = conn.cursor() + + print("\n[METADATA]") + c.execute("SELECT id, item1, item2 FROM metadata WHERE id = 'password'") + row = c.fetchone() + if row: + print(f" ID: {row[0]}") + if args.reveal_keys: + print(f" Global Salt: {binascii.hexlify(row[1]).decode()}") + else: + gs_hex = binascii.hexlify(row[1]).decode() + print(f" Global Salt: {censor(gs_hex)} (Use --reveal-keys to show full)") + print(f" Password Check Data ({len(row[2])} bytes)") + + try: + decoded, _ = der_decode(row[2]) + # Structure is typically: + # Sequence: + # Sequence (AlgorithmIdentifier for KDF): e.g. pkcs5PBES2 + # OID + # Sequence (PBES2-params): + # Sequence (KeyDerivationFunc): + # OID (pkcs5PBKDF2) + # Sequence (PBKDF2-params): [salt, iters, keylen, prf] + # Sequence (EncryptionScheme): + # OID (aes256-cbc) + # OctetString (IV) + # OctetString (Ciphertext) + + pbes2_params = decoded[0][1] + kdf_seq = pbes2_params[0] + kdf_oid = kdf_seq[0] + pbkdf2_params = kdf_seq[1] + + print(f" KDF OID: {kdf_oid} (Expected: {OID_PBES2} for PBES2)") + + salt = pbkdf2_params[0] + iters = pbkdf2_params[1] + key_length = pbkdf2_params[2] + + if args.reveal_keys: + print(f" Salt: {binascii.hexlify(salt.asOctets()).decode()}") + else: + s_hex = binascii.hexlify(salt.asOctets()).decode() + print(f" Salt: {censor(s_hex)} (Use --reveal-keys to show full)") + print(f" Iterations: {iters}") + print(f" Key Length: {key_length}") + + hmac_algo = "Unknown (Default/SHA1)" + if len(pbkdf2_params) > 3: + prf_oid = pbkdf2_params[3][0].asTuple() + if prf_oid == (1, 2, 840, 113549, 2, 7): + hmac_algo = "HMAC-SHA1" + elif prf_oid == (1, 2, 840, 113549, 2, 9): + hmac_algo = "HMAC-SHA256" + elif prf_oid == (1, 2, 840, 113549, 2, 11): + hmac_algo = "HMAC-SHA512" + else: + hmac_algo = f"OID {prf_oid}" + print(f" PRF: {hmac_algo}") + + # Encryption Scheme + enc_scheme = pbes2_params[1] + enc_oid = enc_scheme[0] + iv = enc_scheme[1].asOctets() + + print(" Encryption Scheme:") + print(f" OID: {enc_oid}") + if args.reveal_keys: + print(f" IV: {binascii.hexlify(iv).decode()} (Length: {len(iv)})") + else: + iv_hex = binascii.hexlify(iv).decode() + print(f" IV: {censor(iv_hex)} (Length: {len(iv)})") + + if len(iv) == 14: + print("\n [!] WARNING: Non-standard 14-byte IV detected.") + print(" [!] This profile REQUIRES Native NSS backend for decryption.") + elif len(iv) == 16: + print(" [OK] Standard 16-byte IV.") + + except Exception as e: + + print(f" [ERROR] ASN.1 Decode Failed: {e}") + logging.debug(e, exc_info=True) + else: + print(" No 'password' entry found via SELECT.") + + print("\n[KEYS]") + c.execute("SELECT count(*) FROM nssPrivate") + count = c.fetchone()[0] + print(f" nssPrivate Entries: {count}") - if n > 0: - logging.error(f"wrong master password after {n_max - 1} prompts!") - return None + conn.close() def main_export(args): - # Removed try/except NoDatabase here to let it bubble to main() for proper logging - key = askpass(args.directory) + # args.directory is passed. allow_native=True for export. + key, native_logins = askpass(args.directory, allow_native=True) - if not key: + if native_logins: + # Native backend succeeded where python failed (or was chosen) + # Convert to list of tuples for CSV writer + logins = [] + for login in native_logins: + logins.append((login["hostname"], login["username"], login["password"])) + + elif key: + # Python backend succeeded + jsonLogins = getJsonLogins(args.directory) + logins = exportLogins(key, jsonLogins) + + else: + # Both failed or user cancelled logging.error("Failed to derive master key.") return - jsonLogins = getJsonLogins(args.directory) - logins = exportLogins(key, jsonLogins) # Hard-code to "\n" to fix Windows bug with every other row empty: [a, "", b, "", ...]. writer = csv.writer(args.file, lineterminator="\n") writer.writerow(["url", "username", "password"]) @@ -536,7 +830,8 @@ def main_export(args): def main_import(args): # askpass handles stdin/tty detection for the password prompt automatically - key = askpass(args.directory) + # Native backend is read-only (export), so allow_native=False + key, _ = askpass(args.directory, allow_native=False) if not key: logging.error("Failed to derive master key.") @@ -564,12 +859,28 @@ def makeParser(): "import", description="imports a CSV with columns `url,username,password` (order insensitive)", ) + parser_inspect = subparsers.add_parser( + "inspect", description="inspect key4.db metadata structures" + ) + parser_inspect.add_argument( + "--reveal-keys", + action="store_true", + help="Show sensitive keys/salts/IVs in output", + ) parser_import.add_argument( - "-f", "--file", dest="file", type=argparse.FileType("r", encoding="utf-8"), default=sys.stdin + "-f", + "--file", + dest="file", + type=argparse.FileType("r", encoding="utf-8"), + default=sys.stdin, ) parser_export.add_argument( - "-f", "--file", dest="file", type=argparse.FileType("w", encoding="utf-8"), default=sys.stdout + "-f", + "--file", + dest="file", + type=argparse.FileType("w", encoding="utf-8"), + default=sys.stdout, ) for sub in subparsers.choices.values(): @@ -590,12 +901,15 @@ def makeParser(): sub.add_argument("-v", "--verbose", action="store_true") sub.add_argument("--debug", action="store_true") + parser_inspect.set_defaults(func=main_inspect) + parser_import.set_defaults(func=main_import) parser_export.set_defaults(func=main_export) # Try to load argcomplete try: import argcomplete + argcomplete.autocomplete(parser) except (ImportError, ModuleNotFoundError): @@ -637,7 +951,7 @@ def main(): try: args.func(args) except BrokenPipeError: - sys.stdout = os.fdopen(1, 'w') + sys.stdout = os.fdopen(1, "w") except NoDatabase: logging.error("Firefox password database is empty.") diff --git a/ffpass/nss.py b/ffpass/nss.py new file mode 100644 index 0000000..a68ab24 --- /dev/null +++ b/ffpass/nss.py @@ -0,0 +1,155 @@ +import base64 +import ctypes +import json +import os +from ctypes import ( + POINTER, + Structure, + byref, + c_char_p, + c_int, + c_ubyte, + c_uint, + c_void_p, + cast, +) + + +# --- NSS Structures --- +class SECItem(Structure): + _fields_ = [ + ("type", c_uint), + ("data", POINTER(c_ubyte)), + ("len", c_uint), + ] + + +# --- Load Library --- +def load_nss(): + paths = [ + "/usr/lib/x86_64-linux-gnu/libnss3.so", + "/usr/lib/libnss3.so", + "/usr/lib64/libnss3.so", + "libnss3.so", + ] + lib = None + for p in paths: + try: + lib = ctypes.CDLL(p) + break + except OSError: + pass + return lib + + +def decrypt_sdr(lib, b64_data): + if not b64_data: + return None + + try: + raw_data = base64.b64decode(b64_data) + except Exception: + return None + + # Prepare SECItem input + item_in = SECItem() + item_in.type = 0 # SECItemTypeBuffer + item_in.len = len(raw_data) + + # Create byte buffer matching length + buf = (c_ubyte * len(raw_data)).from_buffer_copy(raw_data) + item_in.data = cast(buf, POINTER(c_ubyte)) + + # Output item + item_out = SECItem() + + ret = lib.PK11SDR_Decrypt(byref(item_in), byref(item_out), None) + + if ret == 0: + # Success + content = ctypes.string_at(item_out.data, item_out.len) + return content.decode("utf-8", errors="replace") + else: + return None + + +def decrypt_logins_native(profile_path, password): # noqa: C901 + """ + Uses libnss3 to authenticate and decrypt logins.json. + Returns a list of dicts: {'hostname': ..., 'username': ..., 'password': ...} + Raises Exception on failure. + """ + lib = load_nss() + if not lib: + raise ImportError("Could not load libnss3.so") + + # Function Signatures + lib.NSS_Init.argtypes = [c_char_p] + lib.NSS_Init.restype = c_int + + lib.PK11_GetInternalKeySlot.restype = c_void_p + + lib.PK11_CheckUserPassword.argtypes = [c_void_p, c_char_p] + lib.PK11_CheckUserPassword.restype = c_int + + lib.NSS_Shutdown.restype = c_int + + lib.PK11SDR_Decrypt.argtypes = [POINTER(SECItem), POINTER(SECItem), c_void_p] + lib.PK11SDR_Decrypt.restype = c_int + + # Initialize NSS + db_dir = os.path.abspath(profile_path) + if db_dir.endswith("/key4.db") or db_dir.endswith("/logins.json"): + db_dir = os.path.dirname(db_dir) + + config_dir = f"sql:{db_dir}".encode("utf-8") + + # We must try to init. If already inited by process? + # Python process usually distinct. + ret = lib.NSS_Init(config_dir) + if ret != 0: + raise Exception(f"NSS_Init failed (Ret: {ret})") + + try: + # Authenticate + slot = lib.PK11_GetInternalKeySlot() + if not slot: + raise Exception("Could not get internal key slot") + + res = lib.PK11_CheckUserPassword(slot, password.encode("utf-8")) + if res != 0: + raise ValueError("Invalid Password (NSS rejected)") + + # Read logins.json + logins_path = os.path.join(db_dir, "logins.json") + if not os.path.exists(logins_path): + return [] # No file, empty list + + with open(logins_path, "r") as f: + data = json.load(f) + + if "logins" not in data: + return [] + + results = [] + for login in data["logins"]: + hostname = login.get("hostname", "") + enc_user = login.get("encryptedUsername") + enc_pass = login.get("encryptedPassword") + + dec_user = decrypt_sdr(lib, enc_user) + dec_pass = decrypt_sdr(lib, enc_pass) + + if dec_user is None: + dec_user = "(error)" + if dec_pass is None: + dec_pass = "(error)" + + results.append( + {"hostname": hostname, "username": dec_user, "password": dec_pass} + ) + + return results + + finally: + lib.NSS_Shutdown() diff --git a/requirements-dev.txt b/requirements-dev.txt index 64ce1ef..f979348 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,5 @@ coverage==7.13.0 flake8==7.3.0 pytest==9.0.2 +ruff==0.14.11 + diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..469b634 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,20 @@ +import shutil +from pathlib import Path + +import pytest + + +@pytest.fixture +def clean_profile(tmp_path): + """ + Copies the requested profile to a temporary directory and returns + the path to the new copy. + """ + + def _setup(profile_name): + src = Path("tests") / profile_name + dst = tmp_path / profile_name + shutil.copytree(src, dst) + return dst + + return _setup diff --git a/tests/firefox-146-aes/key4.db b/tests/firefox-146-aes/key4.db index 935e417f99389fdaceb2479c489c6e32ffbeb7d2..95735f17b50ada222468ff8f3aff73cc5f9e5fc0 100644 GIT binary patch literal 3808 zcmeHKO-~#-5WVv&TDg#wI8^zg+AWlW?Y5)Q!VEhZR^)^Rm_%&8Rt(8%|NT}~cV~bk z8s>-fsW-aC5bP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H|LpbIzrXpz z+b^H`?apgIdFH2MVdweon^`zC0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk Y1PBlyu&)FTmX3`+*WTK?zIk=+AJYN#fdBvi diff --git a/tests/firefox-84/key4.db b/tests/firefox-84/key4.db index 36f2e37e8133e139680ffe986776dfbd3930ffcf..762c46e63beb01b95402798e719341915990acb8 100644 GIT binary patch literal 2931 zcmeHJOK%%T48HqUEON06_`u;jb_PZcv-1dq%91O~MRGDETM5)8b|E<_^6yJ>SC*@| zNKjuZV5x6sI3Kwrm)wh4d~+U~FWc4T`s-@5UEkj|uNyc!y689F-)~my4|mreSKqd; zr?s9Pb>+=y(#&UZav9TnG@YCsrCEvd(#&HwF3soF!y+#p7R|}}wz-&%&g1M|^J{t6 zTuny5U6p1!Y0`93$D=fFX60fWQ#ozc53A3r|HEI-jz*KqGMhJ}$$Z+p+7Z5Levjj; za(QyRU4LMQu5S_A<&6o~AU~y!Pv0JE@XCV*o4`T9=$-N2)fO@+uuwFZN|$sIotn0%{@cM)sXVGJ#nE;`+kk3SP-)v=G10ICE~ z&az{amq@bc=u_t`CEJDwRwr+a?rcfEQhpU>PGJEkZC8`2L6_*fQQ5b-P+3@WOd9B1x%*khUMU1@1HPZkA)e98HE{z z8HE{z8HHKPDJ`e8oYHbi%PA+jPIjH_I@xvou5dcxY(-Pzqa;8mPfB$`exf`ninoSa z1S(!0AoJ2ID3X`8Xw#;s^op!wBvRBB1hZ`eY@3Qnq-aWBtemxC+X@@i8tL4utTyyk z?jiFIt4|cz!m!F_2FSJs$N?N6N3n+zlmYIKNqC0U{V}&YMtyAO4#Ax}1b6Nb+_^(= z$4hYM4#6ES!6&?2Gi;bvxo`%^)iXdYp#k3R;c5@xKSC*lUU#{7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9kwp?H3F@5IgZJ11t!$%d)v>c)vA Wv{I?#-1ar`t+o02LkH$&I{yhoOlQLY diff --git a/tests/firefox-mixed-keys/key4.db b/tests/firefox-mixed-keys/key4.db index 74a40c6a9f776b9642acbab45b6632d63fa41cdb..9a46863fd68002183191f99322d4bd9cdb541093 100644 GIT binary patch literal 476 zcma)%T}#6-6o&8nD-OG9gC$3Vh^`$KZj<}$6zYqRqSNNmI(=2AxoHjex1QR z-Q2OQ=RPZAUc0__=Q|e@oMMhc9N;wK1dWv}#t!ibi8w}hi6eU__8m^Mu0>qfwZ>F^ zb5er_PX$&)1^y3@@1ZXfi$AZl%TtRX7LUkv#8HSoB>2+*?F6IBMcTh8H#Y17MHmMx2Rr07M# zC{0^QcrWDKsL*J;b6v$Uu zCG?r+UV5z6J~^wmyX@5M)|mQiAF8TZa;ke;vD`2z2}geLklsdWm5VzW&*nU@#O-{P zecP{O*d^7e@kUfbKmY;|fB*y_009U<00Izz00bcL=LEKB!Q9*)i!`0Yi9d+qo``rV zA~~M${&mp5;XSpsrrwJhA4D|-1Rwwb2tWV=5P$##AOHafKmY>&NMKzzSM&b@+4;X_ zyb$AET@Vm}00bZa0SG_<0uX=z1Rwwb2rQX^rRkMgc7)G|u^%KOe&9?OACX!#-x37_ L(SPL5;m<8!VHR+_ diff --git a/tests/firefox-mp-70/key4.db b/tests/firefox-mp-70/key4.db index 9be3138733915e9f9d3f9ba10ae7181697f89314..ca711e3d5793f1cba64b46882aa2efb27094fbbc 100644 GIT binary patch literal 2320 zcmeHJO>f&c5WV|X5WP4HyY}?{OMB{$j}PLtfW>UnPkeYhwa336-hXVrcCXh} zwU`y@&9WA|ZK!WU+%4DjVivb4?2_1pVwJ?__NghGr$$^I4`Q=j-h}Nt@q2nF?&{?q zcS)>k5!ZFKTE?B&rp+qEbS;ig?PuBlsNWW|Wqq5rJF%>HYw>C%d?o%2tGjf2HUFpS zx_=)}hxzr}c?ed5wN^V5Tm{M~rybZzN?m%ZQtn+ARgoxHg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ff0yZt&>g!vSk7u(&f09JSX)ivbMf64i9L>OHQVWX+c-4S9I8}5IrXrA0tdgV zEA>HL3V(A(u>(>$G`p4%Wwa&I+W+-+L3De z&hHlRRHo5R(&|M}}zzV_(GU#i3(oKfm(9!{2=JjhBD<)8gr3y7I^q zH=n!t-rjuAa9%17l=t8H-dErJ!=0a0zWeU)O7DF5@a6qyzJGTp&&wb9+tu68KmME7 z-~HIk>z{Zu-}uIO*m=JF_beP50RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N Z0t5&U*i8a^N|X6(oz2ZF7cZ?1{R{4~^Tq%G diff --git a/tests/firefox-mp-84/key4.db b/tests/firefox-mp-84/key4.db index 51017f14f12ac0f093cf39a55e405681cbae3c63..e8e4583cbce25f288536b464ceec0e37de54912f 100644 GIT binary patch literal 2931 zcmeHJOK%%T48HqUEON06_(0BkVB|2*K&UObvRou5L$Z`WO=1_4lcN8=@48>hyY6~C z`t7=OlW~_O<9a?yvu;{0&qFGw-TGnm8T&u+%h}Ord{w5iZZw`vx>q~GSKaU7{JLD7 z9B^+>B)H=S;Pb0YO8NpekMXtTsuI3X~wJ zwE?RmN*5pm1KCO=Gt}&@l{)wwM8ssG3qoZqDq*(Sne4Jp)`B2!$db4K0(o=a#3I1| z+dBJCK4=7IW30hz5HVYwP@7tFHo@lVtnr$FtQ3?KE?V*g=u`;VIDLFNzCJ(yaVr0u zZ?}KlZ0fk(~TgmN9aSQ~>G(K%+S@s!JeQ zbP=gop;aB6b@gh01+WV)KS=EH0mTNPK#A&r|dDM_?z~>+iov6>#y^N z)z7>DAx@^V({2uQQUA{cU6OHI;1%R0$G47eUAtuyr&wqfhJ|I}Sa=q577G%-Q9&;o zBQOU-?}u5a>P<2a0uxc|HOW*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KjQ{}x1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72%MAx?d?&aE8TfK|Bom=Gy((&5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAaL>tmbP$K zzGG$e@ba5$v$F^H?w@*id&ka!%lEczm>eHF{ldG?zyF4xKA9{mBs2NKnj;&JyxARh zbSLAgc%WaBnm_eZ$!9`fX!VT zR(Fmccx>>2hsU2ExbQb-?yl6fZT@%B{OjpSBS3%v0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0v{xSmF*YBv(q<>?XKT8HdRj6O-xqT Yk0qg%N*$-RuZ(Z5&CVX&yMHSGPk+T_bN~PV diff --git a/tests/firefox-mp-test/key4.db b/tests/firefox-mp-test/key4.db index c8ed7d9c3c243641b99e8c7e4d45a6a06b85c377..11695abbe92a11a9a54902070bd7d6b4b20496b9 100644 GIT binary patch literal 618 zcma)&O>5gg5Qgvm6-zF5A&1$o*%cy(+1=S78p}pjOL7VVt3{O9#d1^n@4IeDN-31i zVdgN;dwAY$N4IMd-{$f3_&lEG>39$~0_w%~qXP{8*%j-y%Hbk?gQ^u%df*ce?Ok~%j^4PARW;7guzLdBZKh_tfh^ZmDWHZfwY+} ztOgx5C=UohkuNci*+Bsyf-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