[GH-ISSUE #1264] Several formats allow "negative iteration counts" etc. #799

Closed
opened 2026-10-14 03:24:35 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @frank-dittrich on GitHub (May 3, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1264

Originally assigned to: @frank-dittrich on GitHub.

They just use atoi(p). They should use use isdecu(p) first and reject invalid hashes.

   $ time ../run/john --test=0 --format=agilekeychain 
Will run 8 OpenMP threads
Testing: agilekeychain, 1Password Agile Keychain [PBKDF2-SHA1 AES 128/128 AVX 4x2]... (8xOMP) PASS

real    0m0.142s
user    0m0.384s
sys 0m0.007s

After changing "iteration count" from 1000 to -1000:

-       {"$agilekeychain$2*1000*8*7146eaa1cca395e5*1040*e7eb81496717d35f12b83024bb055dec00ea82843886cbb8d0d77302a85d89b1d2c0b5b8275dca44c168cba310344be6eea3a79d559d0846a9501f4a012d32b6550
+       {"$agilekeychain$2*-1000*8*7146eaa1cca395e5*1040*e7eb81496717d35f12b83024bb055dec00ea82843886cbb8d0d77302a85d89b1d2c0b5b8275dca44c168cba310344be6eea3a79d559d0846a9501f4a012d32b655
$ time ../run/john --test=0 --format=agilekeychain 
Will run 8 OpenMP threads
^CSession abortedchain, 1Password Agile Keychain [PBKDF2-SHA1 AES 128/128 AVX 4x2]... (8xOMP) ^CWait...

real    0m26.864s
user    0m26.867s
sys 0m0.008s

I gave up here, pressing ^C twice after about 20 seconds.

agilekeychain is not the only format.

At least the KeePass format has similar errors, but there might be more.

Originally created by @frank-dittrich on GitHub (May 3, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1264 Originally assigned to: @frank-dittrich on GitHub. They just use `atoi(p)`. They should use use `isdecu(p)` first and reject invalid hashes. ``` $ time ../run/john --test=0 --format=agilekeychain Will run 8 OpenMP threads Testing: agilekeychain, 1Password Agile Keychain [PBKDF2-SHA1 AES 128/128 AVX 4x2]... (8xOMP) PASS real 0m0.142s user 0m0.384s sys 0m0.007s ``` After changing "iteration count" from `1000` to `-1000`: ``` - {"$agilekeychain$2*1000*8*7146eaa1cca395e5*1040*e7eb81496717d35f12b83024bb055dec00ea82843886cbb8d0d77302a85d89b1d2c0b5b8275dca44c168cba310344be6eea3a79d559d0846a9501f4a012d32b6550 + {"$agilekeychain$2*-1000*8*7146eaa1cca395e5*1040*e7eb81496717d35f12b83024bb055dec00ea82843886cbb8d0d77302a85d89b1d2c0b5b8275dca44c168cba310344be6eea3a79d559d0846a9501f4a012d32b655 ``` ``` $ time ../run/john --test=0 --format=agilekeychain Will run 8 OpenMP threads ^CSession abortedchain, 1Password Agile Keychain [PBKDF2-SHA1 AES 128/128 AVX 4x2]... (8xOMP) ^CWait... real 0m26.864s user 0m26.867s sys 0m0.008s ``` I gave up here, pressing ^C twice after about 20 seconds. agilekeychain is not the only format. At least the KeePass format has similar errors, but there might be more.
Author
Owner

@frank-dittrich commented on GitHub (May 3, 2015):

Since these formats use unsigned int for iterations/rounds, these negative integer values get translated into numbers close to UINT_MAX. I don't think this behaviour is intended.

<!-- gh-comment-id:98557692 --> @frank-dittrich commented on GitHub (May 3, 2015): Since these formats use unsigned int for iterations/rounds, these negative integer values get translated into numbers close to UINT_MAX. I don't think this behaviour is intended.
Author
Owner

@jfoug commented on GitHub (Aug 3, 2015):

I am pretty sure this bug is fixed. The isdec() function now returns false for negative numbers. Thus as long as isdec() is used, then this problem should be fixed by valid returning false for these type items.

@frank-dittrich can you look at this just in case I missed something.

<!-- gh-comment-id:127410123 --> @jfoug commented on GitHub (Aug 3, 2015): I am pretty sure this bug is fixed. The isdec() function now returns false for negative numbers. Thus as long as isdec() is used, then this problem should be fixed by valid returning false for these type items. @frank-dittrich can you look at this just in case I missed something.
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#799
No description provided.