Enumeration

Nmap

Initial Nmap scan revealed SSH, HTTP, FTP and SMB ports were open. Moreover, some non standard ports were open too.

00 - nmap

Failed Attempts

I tried anonymous FTP and it was not allowed. Then tried Guest SMB and it was allowed but no share was readable. Then applied directory brute forcing for HTTP and 8088 ports and it did not reveal anything.

01 - smb guest

Web Enumeration

Later I applied directory brute forcing to the non standard port, which revealed SSH keys and password lists.

02 - ffuf 0

03 - secrets

10 - found id_Rsa

At first I checked passwd.bak and shadow.bak but it showed rabbit hole :D so I did not even try to brute force it.

04 - rabbit hole

Exploitation

Brute Forcing

Then with the found password list I applied FTP brute forcing and found a valid login.

05 - ftp creds

Then simply logged in and got the user flag.

06 - user

Privilege Escalation

Checking users

Current user was seppuku user. There were 2 other users.

13 - users

seppuku user

The seppuku user had NOPASSWD sudo privileges over ln binary, but I could not do anything useful with it.

07 - sudo l

Moreover, the user was in restricted bash environment. So I forced SSH session to open bash with -t flag.

08 - rbash

09 - rbash bypass

And, there was .passwd file in the home directory which showed a password like text. I noted it.

14 - password

tanto user

Then I ran linpeas. And while checking I found out the tanto user had .ssh in his home page but id_rsa was missing. So I thought maybe I can use the SSH private key I found before. And it worked.

11 - tanto ssh

12 - tanto login

The tanto user could not do anything. I could not understand why I pwned that user.

samurai user

Later, I tried the password I found from .passwd file against samurai user and it worked. I ran ‘sudo -l’ and found out I can run /home/tanto/.cgi_bin/bin /tmp/* as sudo NOPASSWD.

15 - logged in

So that was why I pwned tanto. To create a malicious binary. In tanto SSH session, I created .cgi_bin directory and malicious binary.

16 - file creation

Then using samurai’s privileges and wildcard ‘*’, I applied path traversal to give /bin/bash SUID privileges. And simply got the root.

17 - root


<
Previous Post
Tre - Proving Grounds Play
>
Next Post
BTRSys2.1 - Proving Grounds Play