boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources
boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources

SSH

SSH gives a secure way to administer a remote system over the network, and the same protocol can be used to move files. This note covers connecting, what SSH guarantees, and copying files with SCP.

Checking for Usernames in Public Keys

When pulling keys off a box, grab the id_rsa.pub files as well as the id_rsa files. Use mget, get, or wget depending on the service. Usernames are often written at the end of the .pub file:

more id_rsa.pub

Copying a File with SCP

scp mark@10.10.224.54:/home/mark/book.txt ~ copies the remote file to ~, the current user's home directory on the attacker.

scp

SCP is secure file transfer built on SSH.

What SSH Does

Secure Shell (SSH) was created to provide a secure way for remote system administration. In other words, it lets you securely connect to another system over the network and execute commands on the remote system. Put simply, the "S" in SSH stands for secure, which can be summarized simply as:

  1. You can confirm the identity of the remote server
  2. Exchanged messages are encrypted and can only be decrypted by the intended recipient
  3. Both sides can detect any modification in the messages

The above three points are ensured by cryptography. In more technical terms, they are part of confidentiality and integrity, made possible through the proper use of different encryption algorithms.

To use SSH, you need an SSH server and an SSH client. The SSH server listens on port 22 by default. The SSH client can authenticate using:

Connecting to a Server

On Linux, macOS, and MS Windows builds after 2018, you can connect to an SSH server using the following command ssh username@10.10.224.54. This command will try to connect to the server of IP address 10.10.224.54 with the login name username. If an SSH server is listening on the default port, it will ask you to provide the password for username. Once authenticated, the user will have access to the target server's terminal. The terminal output below is an example of using SSH to access a Debian Linux server.

Terminal

user@TryHackMe$ ssh mark@10.10.224.54
mark@10.10.224.54's password: XBtc49AB

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 20 13:53:17 2021
mark@debian8:~$ 

In the example above, we issued the command ssh mark@10.10.224.54. Then, once we entered the correct password, we got access to the remote system's terminal. SSH is very reliable for remote administration because our username and password were sent encrypted; moreover, all commands we execute on the remote system will be sent over an encrypted channel.

Verifying the Server Fingerprint

Note that if this is the first time we connect to this system, we will need to confirm the fingerprint of the SSH server's public key to avoid man-in-the-middle (MITM) attacks. As explained earlier, MITM takes place when a malicious party, E, situates itself between A and B, and communicates with A, pretending to be B, and communicates with B pretending to be A, while A and B think that they are communicating directly with each other. In the case of SSH, we don't usually have a third party to check if the public key is valid, so we need to do this manually. This attack is shown in the image below.

Transferring Files with SCP

We can use SSH to transfer files using SCP (Secure Copy Protocol) based on the SSH protocol. An example of the syntax is as follows: scp mark@10.10.224.54:/home/mark/archive.tar.gz ~. This command will copy a file named archive.tar.gz from the remote system located in the /home/mark directory to ~, i.e., the root of the home directory of the currently logged-in user.

Another example syntax is scp backup.tar.bz2 mark@10.10.224.54:/home/mark/. This command will copy the file backup.tar.bz2 from the local system to the directory /home/mark/ on the remote system.

Terminal

user@TryHackMe$ scp document.txt mark@10.10.224.54:/home/mark
mark@10.10.224.54's password: 
document.txt                                        100% 1997KB  70.4MB/s   00:00

As a closing note, FTP could be secured using SSL/TLS by using the FTPS protocol which uses port 990. It is worth mentioning that FTP can also be secured using the SSH protocol which is the SFTP protocol. By default this service listens on port 22, just like SSH.