SSH Private Keys (id_rsa)
1) Quick SSH test (30–60s)
ssh -i id_rsa user@TARGET -p PORT -o IdentitiesOnly=yes -o BatchMode=yes -vvv2) If SSH says key needs a passphrase or is rejected: — Then Check whether if key is passphrase-protected:
ssh-keygen -y -f id_rsa >/dev/null && echo “no passphrase” || echo “passphrase-protected or invalid”3) If passphrase-protected — quick crack workflow
ssh2john.py id_rsa > hash.txtjohn --wordlist=rockyou.txt hash.txt
4) Common Libcrypto/format errors
dos2unix ~/.ssh/id_rsa
vim --clean ~/.ssh/id_rsa
(inside vim: type :wq then hit Return)ssh -i id_rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa USER@IP5) Discover SSH Keys in a web application
The General Strategy
Trust the Key: If you have successfully extracted the key and ensured its permissions are correct (chmod 400 id_rsa), assume the key is valid and the issue lies with the username.
Enumerate Users: Use available information (such as the contents of /etc/passwd, web application user lists, or any credentials you've found) to compile a list of every possible user on the target machine.
Brute-Force Users with the Key: Systematically attempt to log in using the extracted key against every user on your list, including users like root or service accounts.
Last updated