Skip to content
20 services · 5 categories — see all Average reply: 2–24 hours
CTF Web Enumeration: From an nmap Version Scan to a Real RCE, Step by Step
TECH NEWS

CTF Web Enumeration: From an nmap Version Scan to a Real RCE, Step by Step.

If a version number is shoved in your face, there's probably a flaw: the port, version, robots.txt and searchsploit logic that turns a CTF box into full RCE.

TO CONTENT

If a version number is shoved in your face, there's probably a flaw: the port, version, robots.txt and searchsploit logic that turns a CTF box into full RCE.

CTF Web Enumeration: From an nmap Version Scan to a Real RCE, Step by Step — post content

One line on the screen gives it away: “sar2html Ver 3.2.1.” Any experienced penetration tester smiles when a version number is handed to them that plainly, because a version banner that obvious almost always points to a known, documented flaw. This is exactly how web vulnerability hunting works in CTF (Capture The Flag) challenges and authorized penetration tests: first you find what is running, then which version of it, and finally whether that version has a publicly recorded exploit. In this walkthrough we break down that enumeration logic step by step, as it played out on a legal training target (Offensive Security's Proving Grounds “Sar” box): from port discovery to version scanning, from directory brute-forcing to a real remote code execution (RCE) flaw.

Important notice: everything described here is meant to be used only against systems you own, inside a signed penetration-testing engagement, or on a legal CTF platform such as Proving Grounds, Hack The Box, or TryHackMe. Attempting any of this against a server you don't have written permission to test is a criminal offense in most jurisdictions. This article is written for defensive-minded web developers and business owners who want to understand how an attacker actually thinks.

Why does every CTF start with enumeration?

The most common beginner mistake is treating a penetration test as “find a ready-made exploit and fire it.” In reality, most of the work happens during ctf web enumeration: which services are open, which version each service is running, and which files and directories are reachable. Instead of throwing random attacks at a server, you first build a map, then you follow every marker on that map — an open port, a version string, a hidden directory. The “Sar” box is a textbook example of this discipline: a single neglected detail — an outdated internal reporting tool left reachable on the web — turns into full command execution on the server.

Step 1: port discovery — counting the target's doors

The first move is always the same: which ports are listening on the target? A fast nmap scan answers that; the “-Pn” flag keeps the scan running even if the host doesn't answer pings, “-n” skips DNS resolution to speed things up, and a full or targeted port range checks every door. On the “Sar” box, this scan returns exactly two open ports: 22 (SSH) and 80 (HTTP). SSH is open, but password-guessing is almost always the slowest and riskiest path; port 80 means a web application is running. An experienced tester makes the call right there: “we'll go after the web application.” Unlike a single SSH login prompt, a web app offers dozens of potential entry points — every parameter, every form, every uploaded file is a new attack surface.

Step 2: nmap -sV version scanning — the first real clue

Knowing a port is open isn't enough; you need to know exactly which software, and which version of it, is answering on that port. That's what nmap's version-detection mode (“-sV”) does: it connects to each service and tries to extract the software name and version from banners and response fingerprints. An OpenSSH version usually hints at the underlying operating system, while an Apache version reveals which modules and patch level are in play. The working intuition here is simple: if a version number is displayed this openly, the software has almost certainly been picked apart by other researchers before, and there is probably a documented security advisory for it somewhere. Version scanning is the cheapest, fastest piece of intelligence an attacker can gather.

Step 3: directory brute-forcing — opening the web server's hidden corners

A web server's homepage rarely tells the whole story; the real information usually sits in directories and files that aren't linked from anywhere visible. This is where a directory brute-forcing tool like gobuster or dirb comes in: it sends a long list of possible directory and file names to the target one by one and reads the HTTP status codes that come back. A 200 means “something is here and it's public,” a 403 means “something is here but access is restricted” — and even a 403 is valuable, because it confirms the path exists. Files like index.html, phpinfo.php, and robots.txt matter in particular: phpinfo.php can dump an entire server configuration, while robots.txt lists the exact paths site owners wanted hidden from search engines — which, often, is exactly what an attacker is looking for too.

Step 4: why robots.txt makes an attacker's job easier

robots.txt exists to tell search engine crawlers “don't index this,” but search engines aren't the only ones who can read it. Every “Disallow” line is, knowingly or not, the site owner pointing at a path and saying “something's here, and I don't want it visible.” That's exactly how it plays out on the “Sar” box: the file contains a line pointing to a “sar2html” directory that would never be found through normal browsing. Visiting it reveals an open-source server performance reporting tool — sar2html, version 3.2.1.

Step 5: mapping the version to a known exploit with searchsploit

Once you have the version number, the next step is checking whether a public exploit already exists for it. Running “searchsploit sar2html” queries the local Exploit Database mirror for matching entries and returns an August 2019 “Sar2HTML 3.2.1 - Remote Command Execution” record (Exploit-DB #47204). This is the moment the earlier intuition pays off: searchsploit lets you scan thousands of recorded vulnerabilities in seconds without touching a search engine, and it's one of the very first tools any penetration tester reaches for.

Step 6: how the command injection in the “plot” parameter actually works

sar2html's interface decides which server's performance report to display through a “plot” parameter appended to index.php. The root cause is simple but devastating: the application passes that parameter straight into an operating-system command without ever validating or sanitizing it. So when a semicolon-separated command is appended to the parameter — for example, “index.php?plot=;id” — the server runs your injected command inside the same shell it uses to generate the requested report. This vulnerability class is called OS command injection (CWE-78): it occurs whenever user-supplied data is handed to a system shell without validation or escaping. The flaw sat in Exploit-DB for years without a CVE number before it was formally registered as critical-severity CVE-2025-34030 in June 2025; according to VulnCheck's record, the Shadowserver Foundation had already observed evidence of exploitation on 4 February 2025, months before the CVE was published.

Step 7: the lesson — how this CTF logic maps onto real business websites

The most important part of this chain isn't the vulnerability itself — it's how fast it was found: combining port scanning, version detection, and searchsploit can surface a known flaw in minutes. For a real business website, the lesson is direct: no software version running on your server should be visible to outsiders, unused legacy tools (internal monitoring or reporting panels like sar2html) should never be left exposed to the public internet, and every piece of software needs regular updates. The same principle applies to every form field and URL parameter: no user-supplied input should ever be passed, unvalidated and unescaped, directly into a shell command, a database query, or a file path.

A repeatable ctf web enumeration checklist

Following the same sequence on every new target saves time, both in CTF challenges and authorized engagements. The order to follow:

  • Port discovery: use nmap to find out which ports are open, prioritizing web and SSH services.
  • Version scanning: run “nmap -sV” to pull the software name and version behind each open port.
  • Directory discovery: use gobuster or dirb to brute-force hidden directories and files, noting both 200 and 403 responses.
  • robots.txt check: visit every path listed under a Disallow line one by one — these lines often hide the most valuable clues.
  • searchsploit lookup: check whether a known exploit already exists for every software name and version you identify.
  • Verification and PoC: confirm whether the flaw has a current CVE record, and only ever test the exploit in an authorized environment.

The value isn't in memorizing these steps but in internalizing the logic behind them: each step opens the door to the next. Version scanning means nothing without port discovery first, and searchsploit means nothing without a version number to search for.

Frequently asked questions

Does nmap -sV always return the correct version information?

No, not reliably. nmap's version detection relies on banners and response fingerprints; some administrators deliberately alter or hide this information to return fake version strings. Treat the result as a lead, not proof — the real version is usually confirmed through directory scanning and traces left in the application's own interface.

What should I do if searchsploit returns no matches?

Not every flaw is recorded. If searchsploit comes up empty, manually check CVE databases (NVD, MITRE), run a general web search for the exact version, and if the tool is open source, review its source code yourself. Newer or less-known tools may simply not have a public exploit yet.

Does every Disallow line in robots.txt point to a vulnerability?

No — most of the time it's just an ordinary admin panel or a duplicate-content directory the owner wanted out of search results. Still, every line is worth checking, because occasionally — as with the “Sar” box — it points to an outdated, internet-exposed tool left there for internal use only.

Can I test these techniques on my own website?

Yes — running these steps against a system you own is entirely legal and a genuinely useful way to audit your own site through an attacker's eyes. Scanning someone else's site without explicit permission is a different matter and can carry legal consequences; always get written authorization first.

In short

Hunting for web vulnerabilities in a CTF isn't about getting lucky — it's a patient enumeration discipline running from port discovery to version scanning, from directory brute-forcing to robots.txt and searchsploit. As the “Sar” box shows, the most critical flaw is often hiding in the most ordinary oversight: a single tool left outdated, unhidden, and exposed to the internet. Any web developer or business owner who learns this logic gains the ability to spot that same clue on their own site before an attacker ever gets the chance to.

Author
· Ad agency owner
Helping brands enter the digital age since 2010.
About →
— Related posts
— Quick contact

Leave your name, we'll call you.

Questions about this post or a short call about your project. Leave your phone and I'll call you at a convenient time. Free consultation.

International numbers welcome
Response time: 2 hours · Mon-Fri 09:00-19:00 GMT+3 · Free consultation
📞
2 hours