Authorised Keys

In Linux, users can authenticate through SSH using either passwords or asymmetric keys. In order to be able to use keys, the option should be enabled in the SSH configuration file and the public key of the user should be included within the /<User-Home>/.ssh/authorized_keys file.

A key pair can be generated using the command,

ssh-keygen

Once the keys are generated, the key.pub has to be included within the authorized_keys file.

This attack vector can be useful for both initial foothold as well as privilege escalation.

If the process/method being exploited belongs to root, then the key can be included within the root's authorized_keys file and the user can login as root using the private key.

ssh -i <private_key> root@192.179.4.22

Last updated