👽Bashed Writeup

[File Misconfiguration] [Web]

Nmap

  • -sC: Performs a script scan using the default set of scripts

  • -sV: Probe open ports to determine service/version info

  • -O: Enable OS detection

  • -oA: Output in the three major formats at once

Visiting the URL http://10.10.10.68/ will bring us to the following web page.

Gobuster

  • dir: Uses directory/file enumeration mode

  • -w: Path to the wordlist

  • -u: The target URL

  • -f: Append / to each request

  • -x: File extension(s) to search for

Visiting the URL http://10.10.10.68/dev/ will bring us to a directory with the following files:

Dirbuster

Fuzzing for the extension sh, py, pl using Dirbuster.

Input the following fields into the Dirbuster's GUI:

  • Target URL

  • File with list of dirs/files

  • File extension

Visiting the URL http://10.10.10.68/dev/phpbash.php seems to execute a shell session.

We can execute the following commands to test it:

  • echo $0: Check the name of the running process. In this case, it is 'sh'.

  • whoami: Display the username of the current user.

  • sudo -l: list user's privileges or check a specific command.

Since I know the flag for the user is in the file 'user.txt', I executed the following command to find it:

Netcat

Execute 'nc -lvnp 5566' to create a listener on another terminal.

Reverse Shell

Test if the system has Python installed

  • which python

We are able to get the Python reverse shell code from https://pentestmonkey.netarrow-up-right

Netcat

Head back to the the terminal where we executed the Netcat listener code.

Sudo

sudo -l: list user's privileges or check a specific command

Last updated