Skip to content

Lateral Movement

A foothold on one box is a door to the next. Real operators rarely exploit every machine: they loot a key, pull a backup, or read a DNS record and let one breach open three more. This page covers the quiet ways across a network, where no new exploit fires on the target itself.

Admins reuse SSH keys across a network. Loot one off a box you own and you can log straight into the internal machine that trusts it: no password, no exploit on the target itself. This is how real operators move sideways.

1. Find it. A breached gateway holds an admin’s private key in their home directory:

Command What it reveals
cat /home/<user>/.ssh/id_rsa The private key (this is the loot)
cat /home/<user>/.ssh/id_rsa.pub Its comment names user@target-host
cat /home/<user>/.ssh/config Names the host it opens

2. Take it. Download the key to your own box:

Terminal window
download /home/<user>/.ssh/id_rsa

It lands in /home/downloads/rsa_keys/ as <host>_id_rsa. Keys get their own folder and a host-prefixed name so a big haul stays sortable, and creds prints the exact path.

3. Unlock it. A good admin key is passphrase-protected, so crack it (a key with no passphrase is usable as-is):

Terminal window
john /home/downloads/rsa_keys/<host>_id_rsa

4. Use it. From a foothold on the gateway, where you can reach the target, log into the internal box:

Terminal window
ssh -i /home/downloads/rsa_keys/<host>_id_rsa root@<internal-ip>

An admin’s key lands you as root on the box it manages, with no privilege escalation needed. A regular user’s key lands you as that user. Your looted keys are listed by creds and john --show.

The gateway login itself needs a second factor, and a key will not bypass it. Beyond exploiting a phone on its LAN, you can intercept the code by OSINT. Employee records, directory files and email footers on the box leak a person’s city and district. Take that to the Signal Decoupler app: scan their sector, lock their handset, and intercept the SMS or MFA code. With a live code, an ordinary ssh into the gateway clears 2FA with no exploit needed, which is the durable way in on hardened targets where an exploit can be patched out from under you.

Some boxes answer on port 21. ftp <ip> opens a session straight away, no breach required. It is a file channel, not a shell: you can browse and pull files, but it never roots the box and never counts as an exploit. It is the honest way to knock on port 21 and see what the login hands you.

ftp <ip> prints the server banner and asks for a name and password.

  • anonymous (any password) works on about half of FTP boxes, the ones set to allow it. You land in /pub, a public share and upload drop, with backups and classified folders locked. Low-value recon.
  • A real user needs a name the box accepts and a password you actually hold, cracked with hydra, reused via john, or lifted from a .netrc or a backup archive.

This is the whole game of it. Most users are jailed to their own home directory. A few on the box’s chroot list, usually admin and backup_ops, are not jailed at all, so their login roams the full tree: the dated backups, the classified share, all of it. Weak creds give you a closet. The right creds give you the house.

Standard FTP verbs work:

Command What it does
ls List the current directory
cd Change directory
pwd Print the working directory
get <file> Pull a file to your rig
put <file> Upload a file
binary Switch to binary transfer mode
bye Close the session

get drops the file into /home/downloads on your rig, same as download, so you can sell it or attach it to a dead drop from there. The 45 MB backups take real time to pull, because they are really that big.

The payoff: pull a backup archive, unpack it with tar, and crack what falls out with john. backup_v2.tar.gz carries embedded credentials on purpose, and those often open ssh on the gateway the box reports to. A file grab becomes a foothold.

smbmap enumerates the SMB shares on a target (port 445, or 139 on older Windows) and shows exactly what you can reach. Like FTP, it grants no shell: it is recon and a file channel, not an exploit.

Command What it does
smbmap -H <ip> List the shares. With no credentials this is a null session: you see the share names but most read NO ACCESS (IPC$ shows READ ONLY).
smbmap -H <ip> -u <user> -p <pass> Authenticate with credentials you cracked (john / hydra). Shares you can reach now show READ or READ, WRITE. Creds you already hold for the box are used automatically.
smbmap -H <ip> -R [share] Recursively list a readable share (all readable shares if none given). -r lists a single directory level.
smbmap -H <ip> --download <share>/<path> Pull a file from a readable share to /home/downloads. The transfer leaves a connection log on the box, like any other download.

On a domain controller the shares are sysvol and netlogon, where the logon scripts and the Group Policy drive maps live: read them to learn which file servers exist and how the network maps its drives. Windows member servers expose the admin shares C$, ADMIN$ and IPC$.

Every domain answers to a name server. dig queries it and prints the DNS records: addresses, mail servers, and TXT records. TXT is where admins stash notes, and where careless ones leave things they should not. It is pure recon: dig discovers nothing and touches nothing, it just reads what the registrar will tell anyone who asks.

Command What it returns
dig <domain> The A record (address), NS, SOA
dig <domain> TXT Text records, read these
dig <domain> ANY Every record type
dig +short <domain> TXT Just the values, no ceremony
dig -x <ip> Reverse: an address back to a name

Some TXT records are plain. Others are encoded, a wall of base64, hex, or scrambled letters. That is a breadcrumb someone tried to hide in plain sight. Decode it:

Command Decodes
base64 -d <string> Base64 (aGVsbG8= to hello)
xxd -r -p <string> Hex (68656c6c6f to hello)
rot13 <string> ROT13 (uryyb to hello)

They read piped input too, so you can chain straight off dig:

Terminal window
dig +short movie.review.io TXT | base64 -d

A wrap=double hint means it was wrapped twice. High-value targets protect their notes: peel the outer layer, then the inner (usually base64 -d then rot13).

Decoded breadcrumbs are optional leads, never required, but worth the effort: which internal box holds the juicy database, an admin whose key is overdue for rotation, a person’s office city and district (feed it to the Signal Decoupler), or which sister domain really runs an org’s ops. The bigger the target, the more it tried to hide.