Skip to content

Commit d5c9a82

Browse files
committed
kwallet2john.py: Produce truncated "hashes"
1 parent f5fec25 commit d5c9a82

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

doc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ Major changes from 1.9.0-jumbo-1 (May 2019) in this bleeding-edge version:
467467
- KWallet format bug fix of the old KDF (ancient wallets) for password lengths
468468
that are multiples of 16 or longer than 48. [Solar, exploide; 2025]
469469

470+
- KWallet format and kwallet2john.py: Support and produce truncated "hashes"
471+
that do not contain the actual encrypted data. [Solar; 2025]
472+
470473

471474
Major changes from 1.8.0-jumbo-1 (December 2014) to 1.9.0-jumbo-1 (May 2019):
472475

run/kwallet2john.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ def process_file(filename):
103103
sys.stderr.write("%s : invalid file structure!\n" % filename)
104104
sys.exit(7)
105105

106+
# Don't reveal most of the actual content. We only need 64 bytes, but
107+
# truncate at 65 to avoid false auto-detection as the "leet" format.
108+
# Comment out the below line if you need a "hash" for an older version of
109+
# John the Ripper (before Nov 2025).
110+
encrypted = encrypted[:65]
111+
106112
if new_version:
107113
# read salt
108114
salt_filename = os.path.splitext(filename)[0] + ".salt"

src/kwallet_fmt_plug.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,6 @@ static int verify_key_body(unsigned char *key, int key_size, int not_even_wrong)
321321
* Potential optimization:
322322
* Most of the time we could decrypt just one block containing fsize,
323323
* and occasionally bytes 8 to 63, not the whole thing.
324-
* Potential security enhancement:
325-
* We could also revise the 2john script to omit the actual data and
326-
* SHA-1 (everything after initial 64 bytes), but this would be a
327-
* "hash" format change.
328324
*/
329325
if (cur_salt->kwallet_minor_version == 0) {
330326
BF_set_key(&bf_key, key_size, key);

0 commit comments

Comments
 (0)