Labs / Break into a network / Break into a network: discover, pivot, move, take

Lab 3 of 4 · Break into a network: discover, pivot, move, take

Lateral movement: reuse one password to land on the core database

Reaching the core is not owning a machine on it. Reuse a password from the machine you own to log in to the database.

Start this lab 5 steps

The idea

Stage 2 left you a way into the core: a relay through the web server you own, reaching the whole core network. But you have only reached the core — you own no machine on it. This stage moves you onto one. The target is the inventory database tdw-core-db at 10.0.2.35, where staff log in over SSH. You do not break it: the web server you own keeps a note admitting the same password works there too. Through the relay, that one shared login opens a session on a machine your own computer never had a path to.

Steps

  1. Pick up the relay and the target

    You carry stage 2's relay — a door through the web server you own, out onto the core network. The lab has it open again for you. But reaching a machine's SSH port is not the same as having a login for it, so first find which machine to aim at.

    Read the core portal's list of machines through the relay. proxychains sends an ordinary command out through the relay instead of straight from Kali, so the request arrives on the core side. The list names the target: the inventory database tdw-core-db at 10.0.2.35.

    kali:~# proxychains curl -s http://10.0.2.30/hosts
  2. The web server leaks the password

    You do not need to break the database. Read the deploy note left on the web server you already own. It names the core database — and admits, in a "to-do" nobody did, that the same deploy login works there too.

    One password shared between an internet-facing machine and an internal one is the whole opening. Own the exposed machine and you own every machine that shares its password, with nothing to crack.

    kali:~# ssh webbox 'cat /opt/deploy/README'
  3. Land on the database

    Ride the relay onto the database. proxychains ssh sends the login out through the relay, from the web server, to 10.0.2.35 — and the reused password lets you in. This is the one command in the stage where you type the password, because the shared password is the whole trick: your own machine has no path to 10.0.2.35, yet through the relay, with a login that already worked elsewhere, you get a shell on a core machine.

    That session is the thing you carry into the last stage.

    kali:~# sshpass -p 'D3ploy-rollout!24' proxychains ssh coredb 'echo LANDED on $(hostname); id'
  4. Read what the database holds

    From the session, read the database's inventory records. They list the core machines — and point at the backup machine at 10.0.2.40, a nightly copy of the crown-jewel store.

    That pointer is the last stage's target. A full copy of the most sensitive data is worth more than this database's own records, and it is usually guarded less.

    kali:~# sshpass -p 'D3ploy-rollout!24' proxychains ssh coredb 'cat /opt/inventory/records.csv'
  5. Stop the reuse — the defender's answer

    This move cost no exploit and nothing to crack. It cost one reused password. The defender's answer is the boring, decisive one:

    • A different login on every machine. Never share a deploy password between an internet-facing machine and an internal one. Owning the web server should open nothing on the database.
    • SSH keys, not shared passwords. A per-machine key cannot be "reused" by reading a note, and key use is logged and can be switched off.
    • Short-lived, vaulted secrets. Deploy logins handed out per task and changed often, so a stale note names nothing that still works.
    • Watch for one account on many machines. The same login signing in across networks within minutes is a strong sign of someone moving.

    Running this against a network whose owner has not authorised you in writing is a crime under laws like the UK Computer Misuse Act and the United States' CFAA — the signed engagement is what makes it a test and not an offence.

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