Bashed - Easy

OSCP Prep Box

Introduction@Bashed:~$

Name

IP

10.10.10.68

Os

Linux

Points

20

Difficulty

Easy

Creator

Release Date

09 / December / 2017

Enumeration

Nmap

There is only one opened port which is HTTP 80.

Web

phpbash is a standalone, semi-interactive web shell. It's main purpose is to assist in penetration tests where traditional reverse shells are not possible. The design is based on the default Kali Linux terminal colors, so pentesters should feel right at home. https://github.com/Arrexel/phpbash

Now we should try to scan directory with dirsearch.

Directory Scan

If we go uploads directory or config.php file, it was just a blank page and there is no interesting things. But in /dev/ directory, we can see there is two file which is phpbash .

In phpbash.php file:

We can see its was just like terminal and get a shell which is users as a www-data .

We can get user.txt in arrexel 's home directory. When we get a shell, we should always try sudo -l in an easy box.

We can use sudo without password for scriptmanager but this shell does not has persistance, so we can't escalate to scriptmanager user. We should try to get reverse shell to us. In this case, we can't get a reverse shell with some one liner reverse shell because of may be some filter in the backend .But we can download reverse.php to uploads and get a shell.

php-reverse-shell.php

Getting Rev Shell

You can search this php reverse shell in your kali or parrot by using locate command.And change your ip address, port and listen with netcat .

I created a web server to transfer that reverse shell file.

We can use wget to download file, go to uploads directory and download it.

Now , If we go to this url, we will get a shell .

I used rlwrap in front of nc to get usable left and right key.

Privilege Escalation

Now we can escalate to scriptmanager user by using this command.

After some enumeration, I found a folder which is own by scriptmanager name called scripts

It runing with cronjob . To get root access, we need to modify test.py file. In this case I just gave special user permission to /bin/bash and you can use python reverse shell to get root access.

Now we pwned it.

https://app.hackthebox.com/profile/237587

Last updated