> For the complete documentation index, see [llms.txt](https://psdon.gitbook.io/hackworld/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://psdon.gitbook.io/hackworld/writeup/cyberseclab/fuel.md).

# Fuel

## nmap

```
mkdir nmap
sudo rustscan -a 172.31.1.28 --ulimit 5000 -- -T4 -A -oA nmap/all-ports-service-scan  
```

A web server on port 80 is open

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwuzrwL6qDhyviv3qF%2Fimage.png?alt=media&amp;token=979ac7da-a684-415a-a8f1-3e2ad34aa695" alt=""></div>

And looks like it is running Fuel CMS on version 1.4

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwvDCjNyIDK_zWFLH3%2Fimage.png?alt=media&amp;token=25aef74b-ca43-4a70-a3de-084b8ae65178" alt=""></div>

I found an RCE exploit on `searchsploit`

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-Miww3QJ6VNypJzKi_8u%2Fimage.png?alt=media&amp;token=301665d0-4d3d-4c27-a7ee-7a9caf5dcab7" alt=""></div>

## Exploitation

First, let's mirror the exploit to our machine

```
searchsploit -m linux/webapps/47138.py
```

Edit the IP address portion in the script, as well as the `proxy` part but if you will going to use burp suite, it's fine to leave it like that. And also make sure you're running it with Python 2, and `requests` library is installed.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwxXwHpaMhyEn845Ya%2Fimage.png?alt=media&amp;token=a6f45e8a-c506-478f-adef-baaa0c6f4302" alt=""></div>

When you run the script it will look like this.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwxzQERTH-6h-DEYBL%2Fimage.png?alt=media&amp;token=33c3af7c-7dc1-4c8b-af2d-8a5f6a770b93" alt=""></div>

&#x20;Now we got an initial shell, but let's stabilize this by uploading a PHP reverse shell

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwyO6ESbhnu3Ky0w3G%2Fimage.png?alt=media&amp;token=b52fcc29-a005-4095-b89f-c2c069652d32" alt=""></div>

## Reverse shell

Save any PHP reverse shell in a file, but I used this shell in this walkthrough: <https://github.com/ivan-sincek/php-reverse-shell>

Before uploading make sure your HTTP server is setup

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwzJVFEfYB_Z7g7qYb%2Fimage.png?alt=media&amp;token=72f3e7d7-5c43-4dd4-90fa-f3e302c94ce3" alt=""></div>

Set a netcat listener and upload your shell

```
nc -lvnp 80
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwzQJ8yEvD3ncrWmqL%2Fimage.png?alt=media&amp;token=fffd9727-c1e9-4188-8cb3-a53e25b76244" alt=""></div>

To trigger your shell, you have to go to your browser and visit `/<shellname>.php`

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-MiwzwU09o2p2_p3MYiE%2Fimage.png?alt=media&amp;token=4e8b2451-3b25-4a77-b10b-7540beec49ba" alt=""></div>

And you should have received your shell

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-Mix-EguTOH0UABBvD7j%2Fimage.png?alt=media&amp;token=4b288ffb-4ee4-4270-bf1b-0e1e6252ed02" alt=""></div>

## Privilege Escalation

In the home directory of user moira, you will notice that the `.bash_history` is not empty.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-Mix-vVOFiWTWbCWihrj%2Fimage.png?alt=media&amp;token=4b0ea47a-f288-4aa3-8e75-3166bc43d4b9" alt=""></div>

And when we open the file, you can see the password of this user.

```
less .bash_history
```

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-Mix0I4kvYY-H35bMEqp%2Fimage.png?alt=media&amp;token=032a7829-c15d-4df8-a4e9-751916a5df07" alt=""></div>

Run `su` and enter the password you have found to get a root shell

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-Miwulpp6BLbaqdxahZk%2F-Mix0UTUTZARSPIOErKZ%2Fimage.png?alt=media&amp;token=ab4ae6c4-53ae-49b8-baa3-9b0001437565" alt=""></div>
