[GH-ISSUE #2502] Support new KeePass algorithms #1652

Closed
opened 2026-10-15 04:21:52 +07:00 by bsakaguchi · 9 comments
Owner

Originally created by @kholia on GitHub (Apr 13, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2502

Originally assigned to: @kholia on GitHub.

Useful links,

ChaCha20 and Argon2 are needed.

Originally created by @kholia on GitHub (Apr 13, 2017). Original GitHub issue: https://github.com/openwall/john/issues/2502 Originally assigned to: @kholia on GitHub. Useful links, * http://keepass.info/help/base/security.html * http://keepass.info/help/kb/kdbx_4.html#argon2 ChaCha20 and Argon2 are needed.
bsakaguchi 2026-10-15 04:21:52 +07:00
Author
Owner

@magnumripper commented on GitHub (Apr 21, 2017):

I'd like to see an OpenCL format as well. (Edit: OK, that's #2471)

<!-- gh-comment-id:296094813 --> @magnumripper commented on GitHub (Apr 21, 2017): I'd like to see an OpenCL format as well. (Edit: OK, that's #2471)
Author
Owner

@kholia commented on GitHub (May 20, 2017):

Here are some sample KeePass databases for testing.

<!-- gh-comment-id:302856806 --> @kholia commented on GitHub (May 20, 2017): Here are some [sample KeePass databases](https://github.com/magnumripper/JohnTheRipper/files/1109234/KeePass.New.Samples.zip) for testing.
Author
Owner

@kholia commented on GitHub (Aug 27, 2017):

ChaCha20 support is done. Argon2 stuff needs work.

<!-- gh-comment-id:325192822 --> @kholia commented on GitHub (Aug 27, 2017): ChaCha20 support is done. Argon2 stuff needs work.
Author
Owner

@kholia commented on GitHub (Sep 9, 2017):

Steps for building KeePass under Linux. Tested on Fedora 25.

Install monodevelop package

Download and extract KeePass-2.36-Source.zip

cd Build

sh PrepMonoDev.sh

cd ..

xbuild /p:TargetFrameworkVersion="v4.5"
<!-- gh-comment-id:328263979 --> @kholia commented on GitHub (Sep 9, 2017): Steps for building KeePass under Linux. Tested on Fedora 25. ``` Install monodevelop package Download and extract KeePass-2.36-Source.zip cd Build sh PrepMonoDev.sh cd .. xbuild /p:TargetFrameworkVersion="v4.5" ```
Author
Owner

@HEELcaT666 commented on GitHub (Jun 18, 2020):

Hi! Has this issue been fixed yet? I would be deeply grateful if you could please resolve this problem.

<!-- gh-comment-id:646221609 --> @HEELcaT666 commented on GitHub (Jun 18, 2020): Hi! Has this issue been fixed yet? I would be deeply grateful if you could please resolve this problem.
Author
Owner

@BobForCat commented on GitHub (Jul 23, 2023):

Hi guys,
I have successfully implemented a python parsing (less than 200 lines) of the keepass v4 file using the KeePassJava2 code+documentation and I would like to propose this as a python keepass2john.py for john, but that will also impact hashcat when it will be implemented

I'd like that we (or in fact : you two, or whoever you think needed for this) decide the exchange format (for both hashcat and john) we change for that new version of file.

Actual john format

Actuat format contains in this order

transformRounds     --> deprecated
algorithm  
masterSeed  
transformSeed         --> deprecated
initializationVectors  --> not needed anymore  
expectedStartBytes  --> not needed anymore

v4 format idea

As the new format contains a HMAC of the header using the password (or +keyfile) I'd suggest the new format contains

algorithm
masterSeed  
kdf_params    --> details below
validation_hmac_sha256
full_header              --> to compute the hmac and validate

The kdf_params consists of a mutliple key pairs, where keys are a single uppercase letter and value either a number of bytes. I tought we could

  • write value as number if number, else hex of bytes
  • write pair like k=v
  • join every pair with *

For argon2 (with in order: version, iteration,memory,parallelism,salt) it would look like

UUID=ef636ddf8c29444b91f7a9a403e30a0c*V=19*I=2*M=1048576*P=2*S=388336bb577ac102077622356bac26141893528edf7687026fe0d6f79e220b27

My questions are

  • is this a good idea to put the full header there to validate on ? Or would it be better to use the hmac of the first encrypted bloc instead ?

  • As I write in python it's very easy for me to decide the separators, the format, ... but in C it's different, so I don't know if how the parameters are written is a nice way. Like we could add a field nbKdfParams to help or whatever


Final possible format

$keepass$*2*2*5663db9dd04368094676903cd2bc447ec2d92d175a7913471fc6ff8a606138bf*6*UUID=ef636ddf8c29444b91f7a9a403e30a0c*V=19*I=2*M=1048576*P=2*S=388336bb577ac102077622356bac26141893528edf7687026fe0d6f79e220b27*910a4315635e59579a531444cb73cca06c9d0003a4652f4b782a4ce048f5d81f*03d9a29a67fb4bb5000004000210000000d6038a2b8b6f4cb5a524339a31dbb59a03040000000100000004200000005663db9dd04368094676903cd2bc447ec2d92d175a7913471fc6ff8a606138bf0b8b00000000014205000000245555494410000000ef636ddf8c29444b91f7a9a403e30a0c040100000056040000001300000005010000004908000000020000000000000005010000004d080000000000100000000000040100000050040000000200000042010000005320000000388336bb577ac102077622356bac26141893528edf7687026fe0d6f79e220b2700070c0000004bbdce257080e13ce35337db00040000000d0a0d0a

pings to @jsteube @kholia https://github.com/hashcat/hashcat/issues/1013

<!-- gh-comment-id:1646770977 --> @BobForCat commented on GitHub (Jul 23, 2023): Hi guys, I have successfully implemented a python parsing (less than 200 lines) of the [keepass v4 file][v4] using the [KeePassJava2][kpjava] code+documentation and I would like to propose this as a python `keepass2john.py` for john, but that will also impact hashcat when it will be implemented I'd like that we (or in fact : you two, or whoever you think needed for this) decide the **exchange format** (for both hashcat and john) we change for that new version of file. ### Actual john format Actuat format contains in this order transformRounds --> deprecated algorithm masterSeed transformSeed --> deprecated initializationVectors --> not needed anymore expectedStartBytes --> not needed anymore ### v4 format idea As the new format contains a HMAC of the header using the password (or +keyfile) I'd suggest the new format contains algorithm masterSeed kdf_params --> details below validation_hmac_sha256 full_header --> to compute the hmac and validate The `kdf_params` consists of a mutliple key pairs, where keys are a single uppercase letter and value either a number of bytes. I tought we could - write value as number if number, else hex of bytes - write pair like `k=v` - join every pair with `*` For argon2 (with in order: version, iteration,memory,parallelism,salt) it would look like UUID=ef636ddf8c29444b91f7a9a403e30a0c*V=19*I=2*M=1048576*P=2*S=388336bb577ac102077622356bac26141893528edf7687026fe0d6f79e220b27 --- ### My questions are - is this a good idea to put the full header there to validate on ? Or would it be better to use the hmac of the first encrypted bloc instead ? - As I write in python it's very easy for me to decide the separators, the format, ... but in C it's different, so I don't know if how the parameters are written is a nice way. Like we could add a field `nbKdfParams` to help or whatever ---- Final possible format ``` $keepass$*2*2*5663db9dd04368094676903cd2bc447ec2d92d175a7913471fc6ff8a606138bf*6*UUID=ef636ddf8c29444b91f7a9a403e30a0c*V=19*I=2*M=1048576*P=2*S=388336bb577ac102077622356bac26141893528edf7687026fe0d6f79e220b27*910a4315635e59579a531444cb73cca06c9d0003a4652f4b782a4ce048f5d81f*03d9a29a67fb4bb5000004000210000000d6038a2b8b6f4cb5a524339a31dbb59a03040000000100000004200000005663db9dd04368094676903cd2bc447ec2d92d175a7913471fc6ff8a606138bf0b8b00000000014205000000245555494410000000ef636ddf8c29444b91f7a9a403e30a0c040100000056040000001300000005010000004908000000020000000000000005010000004d080000000000100000000000040100000050040000000200000042010000005320000000388336bb577ac102077622356bac26141893528edf7687026fe0d6f79e220b2700070c0000004bbdce257080e13ce35337db00040000000d0a0d0a ``` pings to @jsteube @kholia https://github.com/hashcat/hashcat/issues/1013 [v4]: https://keepass.info/help/kb/kdbx_4.html [kpjava]: https://github.com/jorabin/KeePassJava2/blob/master/KdbxDiagram.svg
Author
Owner

@solardiz commented on GitHub (Jul 23, 2023):

@BobForCat Thank you! Once we agree on the encoding and have the script, what is the plan to have this actually supported in JtR and/or hashcat? Do you intend to work on that as well, or know who will?

<!-- gh-comment-id:1646988836 --> @solardiz commented on GitHub (Jul 23, 2023): @BobForCat Thank you! Once we agree on the encoding and have the script, what is the plan to have this actually supported in JtR and/or hashcat? Do you intend to work on that as well, or know who will?
Author
Owner

@BobForCat commented on GitHub (Jul 24, 2023):

@solardiz Nope, no development on the cracking side for me, and I don't know anyone for that task

I also discovered that https://github.com/libkeepass/pykeepass did a parsing for v4, but I'm unsure if we can use a python dependency into a JtR extraction script

<!-- gh-comment-id:1648282691 --> @BobForCat commented on GitHub (Jul 24, 2023): @solardiz Nope, no development on the cracking side for me, and I don't know anyone for that task I also discovered that https://github.com/libkeepass/pykeepass did a parsing for v4, but I'm unsure if we can use a python dependency into a JtR extraction script
Author
Owner

@solardiz commented on GitHub (Nov 14, 2024):

@magnumripper took care of implementing this support, on CPU and in OpenCL!

@HEELcaT666 @BobForCat, @SO-InformationTECH (of #5159), @krillin666 @sinand99 (of #5097), @bjornfor @yozachar @acolombier (who reacted to comments in #5097) - all of you are welcome to test and report any issues.

<!-- gh-comment-id:2475329358 --> @solardiz commented on GitHub (Nov 14, 2024): @magnumripper took care of implementing this support, on CPU and in OpenCL! @HEELcaT666 @BobForCat, @SO-InformationTECH (of #5159), @krillin666 @sinand99 (of #5097), @bjornfor @yozachar @acolombier (who reacted to comments in #5097) - all of you are welcome to test and report any issues.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1652
No description provided.