Dear Diary,
Today I learned how to configure ssh to login to a remote machine without a password!
So, SSH uses public key cryptography (i.e. that chapter that bored you to death in the Security+ textbook). Which means that is uses a private key and public key to create a connection (does that jog your memory?).
First, type this command in the attacking computer to generate a key pair:
$ ssh-keygen
This will output the following:

Now, navigate to the /home/<username>/.ssh/ directory on the target machine and copy and paste the contents of id_rsa.pub to to the authorized_keys file. It looks something like this:

# ssh-add
# ssh -i id_rsa <username>@<remote ip>
And voila! You have just exploited authorized_keys to get a shell!
Comments
Post a Comment