Recon >>

Add <IP> to /etc/hosts domain as seasurfer.thm

Nmap >

Website > WordPress >>

Nothing special, I try to test in wpscan, but nothing interesting. So we can try look for sub-domains.

Subdomains >>

And there is result >

Add a internal subdomain to /etc/hosts. And we can look on web site >

There is a generator for receipts, so we can inspect how it works. Let’s look on output >

We can download and look what modul generate a pdf >

And here is a rabbit hole, we can able to use SSRF to LFI more is there:

https://hassankhanyusufzai.com/SSRF-to-LFI

So let’s do this >>

SSRF to FLI race >>>

Prepare attacker machine >>

We create a exploit.php file like this >>

And run a php server on attacker machine >>

Testing payload >>

We create testing payload like this >

And add to “Item” box >

After that is generate this output >

So it is working, we can try to look for some possibilities to get a reverse shell or get some credentials. I tryed get a ssh key to user kyle but no luck.

So on seasurfer.thm is running WordPress, we can get a database connection. Let’s try it >

First what we can inspect is domain .conf file I hade luck with internal.conf and wordpress.conf there are outputs >>

/etc/apache2/sites-available/internal.conf >

/etc/apache2/sites-available/wordpress.conf >

Which is more interesting >

So we know root WordPress CMS location let’s look on wp-config.php >

And there are some spice information >>

So can we use it ? We need more recon >>

And success and we can found and kyle user hash to WordPress CMS >

After we can crack this hash >

Reverse shell >>>

After login on page http://seasurfer.thm/wp-admin , we can modify all template files or plugins. I use really simple rev. shell from PHP PentestMonkey > https://www.revshells.com/

And simply modify header.php file.

And we can get a reverse shell as www-data >>

But we need upgrade to kyle user…

Kyle user shell >>>

After recon we can find one options every minute is there runing backup script (pspy64) /bin/sh -c /var/www/internal/maintenance/backup.sh

So can not write in to the script, but we can read it >

And there can be tar wildcard exploit use :-).

https://exploit-notes.hdks.org/exploit/linux/privilege-escalation/tar-wildcard-injection-privesc

Exploitation >>

And after while we get a kyle user shell >>

And we can upgrade to full ssh connection add our own public key generated.

And on victim machine add our public key to /home/kyle/.ssh/authorized_keys

And we have full ssh connection 🙂

So USER flag is DONE!


ROOT Path >>>

After recon we can found this >>

So we can exploit it by sudo token >

Exploitaiton >>

https://github.com/nongiach/sudo_inject

we need upload a file activate_sudo_token, exploit.sh and make local instalation gdb

So let’s do this >>

We have to download gdb for example from >

http://en.archive.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_9.1-0ubuntu1_amd64.deb

We make local instalatoin of gdb >>

Add /home/kyle/usr/bin to PATH >>

Download a exploit and activate_sudo_token and try to run

If all good you can get this >>

Sea Surfer was PWNed !!

Enjoy and Happy hacking !!

Leave a Reply

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