Labs / Web Attacks / Running code and breaking access

Lab 4 of 4 · Running code and breaking access

CMS takeover: fingerprint, enumerate, guess, install

A magazine's CMS leaks its version and editors' handles, never locks accounts, and lets admins install plugins — chained, they hand you the site.

Start this lab 5 steps

The idea

Nadia has an authorised engagement against Caldera Review, an online magazine. It runs a content management system — the software most of the web's sites are published with — and she is going to take it over the way real CMS installs fall: not with one dramatic exploit, but by chaining four small, ordinary weaknesses until she is the editor-in-chief and can install code.

A CMS is a rich target because so much of it is designed to be told to anyone: what product it is, what version, who writes for it. Each of those conveniences is also a step on a ladder. The site tells you it is "Caldera CMS 2.4.1" (so you know its endpoints and its weak spots). Its public authors list leaks every editor's login handle and flags which one is the admin (so you know whose password to attack). The login has no rate limit or lockout and the editor-in-chief's password is weak (so a short guess list lands it). And the admin can install a plugin — the single most powerful thing a CMS account can do, because a plugin runs on the server.

You will climb all four rungs, then put the two that matter most back: a public list that no longer leaks handles, and a login that locks an account before a guess list can finish.

Four rungs, cut any one
Four rungs, cut any one

Steps

  1. Ask the CMS what it is

    You are on Nadia's box, kali, with the magazine at 10.0.1.20. Open it in the Viewer to see the public site, then ask the CMS to identify itself. Most CMSs expose a metadata endpoint for their own tooling; it is the attacker's first read too, because the product and exact version decide which weaknesses are worth trying.

    kali:~# curl -s http://10.0.1.20/api/meta
  2. Read the masthead's back door

    The public site shows writers by their byline — "Rhodri Maddox", "Pia Laurent". But the CMS endpoint behind that list, /api/authors, returns more than the page prints. Ask it directly and see what the magazine hands to anyone who calls its API.

    kali:~# curl -s http://10.0.1.20/api/authors
  3. Guess the editor-in-chief

    You have the admin's handle, r.maddox. Caldera's login answers every attempt the same way with no delay, no lockout, no limit — so you can try a list. Run a short, ordinary guess list against the login and see whether the editor-in-chief chose a weak password. The guesses are in one small program so this stays a single command.

    kali:~# python3 /tmp/brute.py /api/login
  4. Install a plugin, own the site

    Sign in as r.maddox with the password you found, keeping the session cookie, then do the thing only an admin can: install a plugin. On a CMS, installing or activating a plugin or theme means running its code on the server — it is the highest privilege the system has. Caldera's install is inert in this lab (only one bundled plugin exists, and all it does is read the site secret), but reaching it at all is the takeover.

    kali:~# curl -s -c /tmp/jar -H "Content-Type: application/json" -d '{"username":"r.maddox","password":"autumn2024"}' http://10.0.1.20/api/login
    kali:~# curl -s -b /tmp/jar -H "Content-Type: application/json" -d '{"name":"site-report"}' http://10.0.1.20/api/admin/plugins/install
  5. Cut the ladder's rungs

    You run Caldera now. You cannot un-invent plugins, but you can remove the rungs that got Nadia to the admin account: stop the public list leaking login handles, and stop the login answering an endless guess list. The safe endpoints do both. Read the safe authors list, then point the very same guess list at the safe login.

    kali:~# curl -s http://10.0.1.20/api/authors-safe
    kali:~# python3 /tmp/brute.py /api/login-safe

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