
Retrieves the master password from Keepass memory dump, using a hint of bruteforce.
Python port of vdohney/keepass-password-dumper (CVE-2023-32784) — all credit for the original C# implementation and the underlying technique goes to vdohney.
The script scans a process memory dump for the leftover render strings that
KeePass 2.x's SecureTextBoxEx leaves behind while the user types the
master password, and recovers every character of that password except the
first one. Optionally it then brute-forces the unknown first character
against a KDBX file using keepassxc-cli.
The flaw is in the custom SecureTextBoxEx control: for each character
typed, .NET keeps a residual string in managed memory of the form
●a, ●●s, ●●●s, … from which every password character past the first
can be recovered.
If you used KeePass ≤ 2.53.1, assume the master password is compromised:
C:\Windows\memory.dmp),powercfg /h off on Windows),cipher /w: on Windows) so the
leftovers can't be carved from previously allocated sectors,keepassxc-cli in $PATH (only needed for --kdbx)On Debian / Ubuntu, install the KeePassXC CLI if you plan to brute-force:
sudo apt install keepassxc
# Recover candidate characters and print them
python3 keepass_dumper.py memory.dmp
# Dump the generated candidate list to a file
python3 keepass_dumper.py memory.dmp -p candidates.txt
# Recover and brute-force the missing first char against a KDBX
python3 keepass_dumper.py memory.dmp --kdbx db.kdbx
Run python3 keepass_dumper.py --help for the full option list.