Mustacchio
Last updated
Last updated
A quick glance at port 80 shows the following root page:
Browsing to port 8765 in a web browser reveals a login page:
I initially tried brute forcing a login and was unsuccessful. I also executed Dirsearch.py again this and did not pull any interesting information.
Back to port 80 I then run Dirsearch.py again it.
This leads to the discovery og the /custom/
directory. Viewing the /js
directory within /custom/
we find the file users.bak.
Opening the file in DB Browser we see the following information below:
We now have the username and hash of: admin:1868e36a6d2b17d4c2745f1659433a54d4bc5f4b
. Running the hash against hash-identifier
shows this is likely either a SHA-1 or MySQL5 hash.
Knowing this I then run the hash against Hashcat
. Specifying the rockyou.txt wordlist
With the password now cracked we have the complete credentials of: admin:bulldog19
. It is then possible to login on the admin panel on port 8765.
Viewing the source of the page we can see a comment left advising the user Barry can login with his SSH key.
Looking close again at the source code we see a directory path of /auth/dontforget.bak
.
Viewing the contents of dontforget.bak
:
Pasting this into the comment field on /home.php and submitted we can see the content being viewed.
We can take this and attempt to use the same format to perform XXE and retrieve a file from the target system.
Essentially below we are taking the skeleton of the XML request in dontforget.bak
. Ensuring the Name and author fields are still populated. The line '<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
' defines the file to read and binds it to the variable 'xxe'.
Then back at the XML shown below we are going to print the contents of the file defined in the 'xxe' variable into the comment field so it is viewable.
Where when the code above is run on /home.php we are able to view /etc/passwd.
Now that we know that the user Barry has a SSH key we can attempt to read it from the common SSH location.
After saving the key locally and setting the correct permissions with chmod
we are prompted for a passphrase.
ssh2john.py
can then be invoked to create a hash of the key ready for cracking.
Which can then be easily cracked using John.
We are then able to login as barry.
I then used SCP
to transfer over linpeas.sh to the target machine.
After running linpeas.sh it soon finds a custom SUID binary for /home/joe/live_log
.
Running the binary it looks like its grabbing the results from /var/log/nginx/access.log
as shown by linpeas.sh
We can see from running the strings command against the binary that at one point the binary will call the 'tails' binary. As we can see from below this has not been given an absolute path and is subject to being hijacked.
From here I then created a file called 'tail' in the home directory for barry with the following contents:
Then set the file to be executable.
Then exported a new path that calls into our home directory before looking anywhere else so we can run our tail binary before the intended one is executed.
Then when executing the SUID live_log binary this should call the tail binary in barry's home folder and spawn a root shell.