Repository navigation
Conversation
Type 8 is PBKDF2-HMAC-SHA256 with 20000 rounds and type 9 is scrypt with N=16384, r=1, p=1, both with a 14 character salt. Test vectors were generated on IOS XE 17.15.6, which hashes only the first 127 bytes of a password.
This is the reversible "$9$" encoding Junos uses for secrets such as RADIUS and TACACS+ keys. Test vectors were generated on vJunos-router 25.4R1-S2.3. cisco_type9 hashes also start with "$9$", so both handlers identify by whether a second "$" follows.
IOS XE converts a Type 5 secret to "convoluted Type 9" ($14$): scrypt, as in Type 9, of the whole md5_crypt hash. Test vectors are Type 5 secrets as converted by IOS XE 17.15.6 when configured.
ASA stores a user's plain text password as "$sha512$<rounds>$<salt>$<checksum>" with the "pbkdf2" keyword: the first 16 bytes of PBKDF2-HMAC-SHA512 over a 16 byte salt, both in standard base64 with padding. The username isn't hashed in, unlike cisco_asa. Test vectors were generated on ASAv 9.24(10), which uses 5000 rounds and refuses passwords longer than 127 bytes. The docs listed this format as unsupported (passlib issue 87).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds handlers for Cisco type 8 (PBKDF2-HMAC-SHA256, 20000 rounds) and type 9$14$ ) secrets IOS XE converts type 5 secrets to, and for
(scrypt, N=16384, r=1, p=1) secrets and Cisco ASA "pbkdf2" passwords
(PBKDF2-HMAC-SHA512), which the docs list as unsupported (passlib issue 87,
https://foss.heptapod.net/python-libs/passlib/-/work_items/87), for the
"convoluted type 9" (
the Junos "$9$" reversible encoding.
Test vectors were generated on a Cisco c8000v running IOS XE 17.15.6, plus
the hashcat example hashes, on an ASAv running 9.24(10), and on
vJunos-router 25.4R1-S2.3. IOS XE hashes only the first 127 bytes of a longer
password, so the type 8 and 9 handlers do the same;
truncate_error=Trueraises instead.
For$14$ , the device's conversions of known type 5 secrets confirm it is
scrypt of the whole md5_crypt string ($1$salt$checksum), as hashcat's mode
38200 has it.
The ASA format is
$sha512$<rounds>$<salt>$<checksum>: the first 16 bytesof PBKDF2-HMAC-SHA512 over a 16 byte salt, both standard base64 with padding.
Unlike
cisco_asa, the username isn't hashed in. ASA 9.24 generates 5000rounds, also accepts other counts (a login against a 10000 round hash made by
this handler succeeded), and refuses passwords longer than 127 bytes, so
hash()raises for those.Cisco type 9 hashes and Junos secrets both start with "$9$". The two
handlers tell them apart by the second "$" a type 9 hash has, so a
CryptContext can hold both.