Enumeration

Nmap

Initial nmap scan revealed FTP, SSH, HTTP and 55743 ports were open.

00nmap

FTP Anonymous

FTP Anonymous login was enabled and there were log files.

03ftp anon

They included different paths and I think it was pentest logs.

04logs

So I tried to visit a path and it redirected me to login page which was SeaCMS site.

06seacms

Exploitation

SeaCMS 11.1 LFI

SeaCMS was vulnerable to LFI as seen below.

07lfi

So I checked logs and found database.php file.

08databasephp

Later, I tried to read it via LFI and found SSH credentials.

09ssh

And I simply logged in and got user shell.

10localflag

Privilege Escalation

bin_replacer binary and sudo NOPASSWD ps

I executed sudo -l and found NOPASSWD ps was allowed. Moreover, I checked $PATH and found $HOME/bin was also path variable.

11PATH

Then I executed pspy64 and found bin_replacer binary was running once a minute.

It was a script that replaces ($HOME/bin/.*) hidden files with binaries under /bin.

  • clean="${name#.}": this part removes preceding . from filename
  • if [[ -x "$DEST_DIR/$clean" ]]; then: this part checks if filename is really an executable binary name under /bin and if it is, it replaces files

12binreplacer

So I simply created a file named .ps that just executes /bin/bash as seen in below two images.

13ps

13ps2

And executing sudo /bin/ps aux got me root shell.

14gg


<
Previous Post
Nibbles - Proving Grounds Practice
>
Next Post
PayDay - Proving Grounds Practice