root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat busqueda.md
// writeups

Busqueda

8 Apr 2023 · 20 min read · root access
Busqueda - maquina de Hack The Box

Executive summary — Busqueda exposes a Flask application that builds search-engine URLs on top of the Searchor 2.4.0 library, vulnerable to CVE-2023-43364 (eval() injection). The unusual part — and the most instructive lesson of the box — is that the application's own code is correct: it validates the engine against a whitelist and runs the subprocess with an argument list, without shell=True. The flaw isn't in that code; it's in the dependency declared in requirements.txt, invisible to any review of the application's own source. From there, a .git/ mistakenly deployed to production and three separate password reuses chain the access all the way to a sudo script that invokes another script through a relative path — the one thing sudo never sanitizes is the working directory.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.129.228.217

Attack map

[80] searcher.htb — Flask "Searcher" app, builds search-engine URLs
   │  the footer declares the dependency: Searchor 2.4.0
   ▼
[RCE]  CVE-2023-43364 — Searchor interpolates the query into an f-string, then eval()s it
   │  the app's own code is correct (subprocess with an argument list, no shell=True);
   │  the flaw lives one layer down, in the dependency
   ▼
[RCE]  svc  (unauthenticated command execution, via an HTTP return channel)
   │  /var/www/app/.git/config (mistakenly deployed) leaks Gitea credentials:
   │  cody:jh1usoih2bkjaspwe92 — the same password works for system SSH
   ▼
[SSH]  svc  (user.txt)
   │  sudo (root) /usr/bin/python3 /opt/scripts/system-checkup.py *
   │  unrestricted docker-inspect leaks the Gitea DB password, reused as the Gitea
   │  admin password -> source code confirms a relative path: system-checkup.py
   │  invokes './full-checkup.sh'
   ▼
[ROOT]  attacker-controlled CWD + relative path -> our own full-checkup.sh runs
        as root (root.txt)

1. Reconnaissance

nmap -p- --min-rate 5000 -T4 -Pn -oN nmap-allports.txt 10.129.228.217
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Not shown: 65290 closed tcp ports (reset), 243 filtered tcp ports (no-response)

The 243 "filtered" ports are an artifact of the aggressive --min-rate (nmap warns it hit the retransmission cap), not a selective firewall. Real surface: two ports, and the vector has to be on 80.

nmap -sCV -p22,80 -Pn -oN nmap-services.txt 10.129.228.217
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.1 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.52
|_http-title: Did not follow redirect to http://searcher.htb/
|_http-server-header: Apache/2.4.52 (Ubuntu)
Service Info: Host: searcher.htb; OS: Linux

OpenSSH 8.9p1 + Apache 2.4.52 pins the OS to Ubuntu 22.04 LTS. More useful still: the line Did not follow redirect to http://searcher.htb/ reveals the vhost name with no fuzzing needed — Apache hands it over for free by redirecting on plain IP access. That cheap check is worth running before firing thousands of ffuf requests.

With no sudo password on the attacking box to edit /etc/hosts, resolution was handled with curl --resolve, which injects the resolution at the request level without touching the system:

#!/bin/bash
# c.sh — curl against searcher.htb without touching /etc/hosts
exec curl -s --resolve searcher.htb:80:10.129.228.217 "$@"

The app (./c.sh http://searcher.htb/) looks harmless: a POST /search form with three parameters (engine, query, auto_redirect) that builds the chosen engine's search URL. The decisive finding comes from reading the full HTML, not just the visible part — the footer voluntarily declares its main dependency:

<p class="copyright">Powered by
  <a href="https://flask.palletsprojects.com">Flask</a> and
  <a href="https://github.com/ArjunSharda/Searchor">Searchor 2.4.0</a></p>

No need to guess the stack or infer it from behavior: the app states outright which library processes user input, and which version. And Searchor 2.4.0 has a known, critical vulnerability: CVE-2023-43364.

🔒 Clearance required

This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.

See Root Access plans

No account? Create one free then upgrade from your console.