update ssh2john to support all algs from openssh
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
It's not about John itself but one of the companion tool provided with it: ssh2john.
https://github.com/openwall/john/blob/bleeding-jumbo/run/ssh2john.py
ssh2john supports a very limited set of algorithms
Whereas most of the algs supported by openssh are not supported by ssh2john.
The following script can be used to generate a key for each alg and try to ssh2john it for each. You'll see a lot are not supported even if they are supported by John.
algs=("3des-cbc" "aes128-cbc" "aes128-ctr" "aes128-gcm@openssh.com" "aes192-cbc" "aes192-ctr" "aes256-cbc" "aes256-ctr" "aes256-gcm@openssh.com" "chacha20-poly1305@openssh.com")
for alg in "${algs[@]}"
do
ssh-keygen -o -N test12345 -t ed25519 -Z $alg -f test_$alg 1>/dev/null
ssh2john test_$alg > hash_$alg.txt
done
For example, EC with AES 128 looks supported but John but not by ssh2john
➜ ssh-keygen -o -N test12345 -t ecdsa -Z aes128-cbc -f test_ec+128
Generating public/private ecdsa key pair.
Your identification has been saved in test_ec+128
Your public key has been saved in test_ec+128.pub
The key fingerprint is:
SHA256:XIRSO83q23eYVERJDn7lBJ74bRm4tVWVw8LJcKL53lA noraj@norarch
The key's randomart image is:
+---[ECDSA 256]---+
| ....o=+*oB|
| . .=o.oX+O.|
| .oo+ oE*o+|
| . +. .o+.=|
| S o o.oo|
| . . + . |
| . o + |
| o + . |
| . .. . |
+----[SHA256]-----+
➜ ssh2john test_ec+128
Traceback (most recent call last):
File "/usr/bin/ssh2john", line 225, in <module>
read_private_key(filename)
File "/usr/bin/ssh2john", line 157, in read_private_key
raise Exception('Unknown encryption type')
Exception: Unknown encryption type
ssh2hon from John the Ripper 1.9.0-jumbo-1+bleeding-173b5629e8 2024-01-18 00:08:42 +0100 MPI + OMP [linux-gnu 64-bit x86_64 AVX AC]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with run/ssh2john.py, especially the encryption-type handling around the referenced lines, then compare it with the supported algorithms in src/ssh_fmt_plug.c. Run the provided ssh-keygen and ssh2john loop for each OpenSSH algorithm to reproduce unsupported cases. Done means the companion tool processes the relevant OpenSSH algorithms that John supports without the reported unknown-encryption error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- cryptography, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100