Skip to main content
XsiSec.com
HomeReposBlogProjectsPortfolio
© 2026 XsiSec.com
Security rules |security.txt
Updated 2026-08-15 · v1.0.0+2026-08-14.82f92cb · 82f92cb
← Back to overview
Security article

HTB Academy - NSE Scripts

HTB Academy - NSE Scripts: Use Nmap Scripting Engine (NSE) to enumerate a target, discover interesting HTTP paths, and recover the flag. I played with different script categories and then ran http-enum to quickly surface web paths like /robots.txt, which led to the flag. • HackTheBox • nmap

2022-10-261 tag
Tags

🎯 Objective

Use Nmap Scripting Engine (NSE) to enumerate a target, discover interesting HTTP paths, and recover the flag. I played with different script categories and then ran http-enum to quickly surface web paths like /robots.txt, which led to the flag.


🧠 NSE in a Nutshell

NSE lets me run Lua scripts alongside a scan to query or test specific services. Scripts are grouped into 14 categories so I can choose safe vs. aggressive behavior depending on scope.

Categories (cheat sheet)

CategoryWhat it focuses on
authFinding authentication creds / auth mechanisms
broadcastLAN discovery via broadcast (hosts auto-added to scan)
bruteBrute-force login attempts against services
defaultThe scripts used by -sC (conservative defaults)
discoveryService enumeration beyond banners
dosDoS checks (rarely used; can harm services)
exploitAttempts to exploit known vulns
externalLeverage external services/APIs for analysis
fuzzerSend varied inputs to find parsing/logic bugs (slow)
intrusiveMay be disruptive or high‑impact
malwareIndicators of malware / backdoors
safeLow‑impact, defensive enumeration
versionDeeper service fingerprinting
vulnCheck for specific, known vulnerabilities

Where scripts live

bash
ls /usr/share/nmap/scripts
# e.g. acarsd-info.nse, address-info.nse, afp-*.nse, http-*.nse, smb-*.nse, ...

I like to grep for families:

bash
ls /usr/share/nmap/scripts/*http*    # all HTTP-related NSE scripts

🧭 Run http-enum and pivot from findings

I ran http-enum against the target. It fingerprints common files/dirs and server frameworks.

bash
nmap 10.129.2.49 --script http-enum

Output (excerpt):

text
Starting Nmap 7.92 ( https://nmap.org ) at 2022-10-26 06:18 EDT
Nmap scan report for 10.129.2.49
Host is up (0.024s latency).
Not shown: 993 closed tcp ports (conn-refused)
PORT      STATE SERVICE
22/tcp    open  ssh
80/tcp    open  http
| http-enum:
|_  /robots.txt: Robots file
110/tcp   open  pop3
139/tcp   open  netbios-ssn
143/tcp   open  imap
445/tcp   open  microsoft-ds
31337/tcp open  Elite
Nmap done: 1 IP address (1 host up) scanned in 3.02 seconds

Screenshot from my run:


🔎 Pull robots.txt and follow the breadcrumbs

Once /robots.txt popped, I fetched it and chased the disallowed path(s). One of those endpoints exposed the flag.

bash
curl -s http://10.129.2.49/robots.txt
# Disallow: /<interesting-path>
curl -s http://10.129.2.49/<interesting-path> | head

Flag

text
<PASTE_FLAG_HERE>

🧾 Handy NSE one‑liners (copy/paste)

bash
# Default & safe scripts with versions on common ports
sudo nmap -sC -sV -p 22,80,110,139,143,445 10.129.2.49

# Broad HTTP script sweep (safe-ish)
sudo nmap -p80 --script "http-* and safe" 10.129.2.49

# Vulnerability checks (scoped/approved)
sudo nmap -p80 --script "http-vuln* or vuln" 10.129.2.49

# List what a category would run
nmap --script-help default
nmap --script-help vuln

🧪 Tips

  • Start with safe/default before intrusive/exploit/dos in a client network.
  • http-enum is a fast win; follow up with http-title, http-headers, http-methods.
  • Pair with -sV so version and script results reinforce each other.

🔒 Defense (notes to self)

  • Avoid leaking sensitive paths in robots.txt.
  • Lock down default web dirs; sanitize directory listings.
  • Monitor unusual HTTP enumeration patterns; rate-limit where possible.

Summary: NSE made it trivial—http-enum → /robots.txt → flag.

Navigate

In this post

  1. 01🎯 Objective
  2. 02🧠 NSE in a Nutshell
  3. 03Categories (cheat sheet)
  4. 04Where scripts live
  5. 05🧭 Run http-enum and pivot from findings
  6. 06🔎 Pull robots.txt and follow the breadcrumbs
  7. 07🧾 Handy NSE one‑liners (copy/paste)
  8. 08🧪 Tips
  9. 09🔒 Defense (notes to self)
Search
Explore

Popular tags

Browse all 30 tags

Comments

0 comments

No comments yet — be the first to comment.