Labs / Break into a box / Get a foothold: find the way in, then walk through it

Lab 1 of 2 · Get a foothold: find the way in, then walk through it

Find the way in

Map a target box with nmap, read its services, and pick the one soft opening worth attacking — and say why.

Start this lab 5 steps

The idea

You are on the Kali attacker box, alone on a small network with one other machine: a depot appliance at 10.0.1.20 that Harlow Dispatch runs to route its couriers. You have no login to it — yet. Breaking in starts with the quiet part: map the box with nmap, read what each open port is really running, and make one call — which opening is the way in. Real boxes offer more than one, and they are not equal: an old service version is a lead you would still have to find an exploit for; a login left on its shipped default password is a confirmed way in. This lab is all recon, no attack. The next one walks through the door you pick.

Steps

  1. What is even listening

    You cannot attack a door you have not found, so start by finding every door. A plain nmap <host> knocks on the box's thousand most common ports and reports which ones answer. It touches no login and sends no password — it only asks each port whether a program is listening behind it.

    Two ports answering is already the shape of the box: every open port is one service you can talk to, and one more thing that can be left weak. A box with a dozen open ports has a dozen chances to be the way in; this one has two.

    attacker:~# nmap 10.0.1.20
  2. What is really running

    That first scan guessed ssh and http from the port numbers — a convention, not evidence. A service can listen on any port. To learn what truly answers, add -sV: nmap opens each port, reads the greeting the service sends (its banner), and names the software and version from it.

    Why a version matters: it is the first thing an attacker looks up. A known-vulnerable build with a public exploit can be a way straight in. But read the next sentence carefully — a version is a lead, not a win. Knowing a port runs a given OpenSSH build tells you nothing about whether this build has a usable flaw. You would still have to find an exploit, confirm it fits this exact version, and get it to work. Hold that thought.

    attacker:~# nmap -sV --version-light -p 22,80 10.0.1.20
  3. What the default scripts volunteer

    nmap can do more than read a banner. The -sC flag runs its default scripts — a safe, standard set that each ask an open port one useful question and print what comes back. On port 22 it reads the SSH host key; on port 80 it fetches the page and prints the site's title.

    This is still recon, not attack: the scripts only ask what the service freely answers. But the answers aim you. A web server's title names what the site is for, and knowing that is often what turns "a port is open" into "here is where to look next."

    attacker:~# nmap -sC -p 22,80 10.0.1.20
  4. Read the console the recon pointed at

    The title pointed you at a web app, so read it the way an attacker does — fetch the pages with curl and look at what the site tells the world about itself. Start at the home page. A brand-new appliance often leaves setup leftovers on its web root: install notes, a readme, a default config, each written for the admin and readable by anyone who asks.

    This is the misconfiguration on this box. The home page links a first-boot setup note — one left in place that should have been deleted at go-live. Fetch the page, see the link, then fetch the note.

    attacker:~# curl http://10.0.1.20/
    attacker:~# curl http://10.0.1.20/setup-notes.txt
  5. Pick the opening — and the defender's answer

    Lay the findings side by side and make the call. You have three kinds of opening in front of you, and they are not equal:

    • A known-vulnerable version. The OpenSSH 9.7 build that -sV named on port 22. A lead: you would have to find a public exploit, confirm it fits this exact build, and get it to run. Slow, and it may lead nowhere.
    • A misconfiguration. The exposed /setup-notes.txt. By itself it is only information — but here it hands you the next thing.
    • A default credential. ops / ops over SSH, the login the appliance shipped with and nobody changed. A real account on an open port: a confirmed way in you can use right now.

    The pick is the default credential on port 22. You take the confirmed opening over the gamble every time — the version exploit stays in your pocket only if this one fails. That is the whole call: confirmed beats clever.

    The defender's answer to this stage. Hiding versions and banners buys almost nothing — a scan still finds the open ports, and the real leak here was never the version. Delete setup leftovers before go-live, change every shipped default password, and close any port a service does not need. The opening you found exists because two of those three were skipped.

Run these steps on real machines

Keep reading

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab