Skip to main content

authorized_keys


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:



Then navigate to your /<username>/.ssh folder...



And you'll see these files. id_rsa is your private key and id_rsa.pub is the public key (which is why it ends in .pub :)

 
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:



Then, return your attacking box and type these commands:
# ssh-add
# ssh -i id_rsa <username>@<remote ip>
And voila! You have just exploited authorized_keys to get a shell!






Comments

Popular posts from this blog

Recursion

“So, what’s your number?” he asked me with innocent eyes, contemplating a number low enough to render me virtuous but high enough to guarantee some skill. In other words, n - 1.  I sighed and looked at ceiling. The scene was all too familiar. This time however, I wasn’t with a graduate student. Or an engineer. I was with a DJ.  “One time, I wrote a C program to remove the voice from a sound file,” I said shyly as he leaned in and grazed my earlobe.  Suddenly, he pulled back with disappointment.  “I’m really sorry, but I have to go to my show,” he said as he stuffed his headphones into his backpack. “I’ll see you later.”  The door slammed in the distance. I sighed and hung my head in shame. For I was embarking on the same destructive behavior, watching helplessly as my actions iterated miserably in a never-ending loop. Like recursion, a new romance temps with the promise of a memory address, such as the $user = “girlfriend” string as...

How To Run TOR as a Non-Root User

Hello Friends, Today I finally figured out something that had eluded for quite a while, and that is... the mysterious process of running TOR as a non-root user! Like many other novice hackers, I had tried to run TOR by adding a user in Kali Linux through the following CLI commands: $ useradd guest $ passwd guest $ runuser -l guest -c ./start-tor-browser.desktop Which gave me the lovely error message below: $ Tor Browser must be run within the X Window System This last output one gives us a clue: the X Window System is graphical interface, which means that we need to run this software outside the CLI (you can try downloading the xorg, but that proved to be much of a headache). To do this, go here: Log out as root and login as the user you created. The computer will load the GUI and you will now be able to run TOR as a non-root user! Please let me know if this tutorial helped you out! xoxo

RDP

  What is the name of the tool that we can use to initiate a desktop projection to our host using the terminal?  Answer: xfreerdp   Remember, RDP works for Windows machines. What is the name of the admin account on Windows? It is "Administrator'   You can attempt to RDP to windows machines using this: xfreerdp /v:10.129.1.13 /u:Administrator Press enter when prompted for password (might be poorly configured, and let you use an empty password).   How to use freerdp To install freerdp on Debian, Kali Linux, Linux Mint, Ubuntu and derivatives, run the command: sudo apt install freerdp2-x11 freerdp2-shadow-x11 If the freerdp2-x11 and freerdp2-shadow-x11 packages are not found, look for a package named freerdp . To install freerdp on Arch Linux and derivatives, run the command: 1 sudo pacman -S freerdp How to connect with freerdp command To connect to the remote desktop using xfreerdp , run a command of the form: 1 xfreerdp /f /u :USERNAME...