Lets exploit some web vulnerabilities!
002
Reto: http://momo.hackmyvm.eu/ch4ll3ng3002/ Descripción: Obten la flag, no se necesita fuerza bruta
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/ch4ll3ng3002/
<!doctype html>
<html lang="en">
<title>002</title>
Password to obtain the flag.
<form class="form-signin" action="passcheck.php" method="post">
<input type="password" name="password" id="password" placeholder="Password" required>
<input type="submit" value="Send">
<!-- isthisthepassword? -->
</form>
</body>
</html>
Como podemos ver en el curl se nos presenta un formulario, si miramos bien encontraremos un comentario, vamos a probar a ver si es la contraseña
┌─[bicho@balam]─[~]
└─[]=> curl -X POST -d "password=isthisthepassword?" http://momo.hackmyvm.eu/ch4ll3ng3002/passcheck.php
HMV{<redacted>}
009
Descripción: The flag is here. <!— HMV{infrontofme} ⇒
La flag se encuentra a simple vista, asumo que es porque se deberia interpretar el codigo pero se muestra como si fuese un <pre>
014
Descripción: Find the flag in the domain http://momo.hackmyvm.eu
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img {
display: block;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<img src="logo.png" alt="HMV" style="width:50%;">
</body>
</html>
Parece ser una pagina bastante simple, vamos a ver si el logo tuviese alguna información interesante
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/logo.png > logo.png
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13314 100 13314 0 0 155k 0 --:--:-- --:--:-- --:--:-- 156k
┌─[bicho@balam]─[~]
└─[]=> exiftool logo.png
ExifTool Version Number : 12.76
File Name : logo.png
Directory : .
File Size : 13 kB
File Modification Date/Time : 2024:06:02 14:45:08+02:00
File Access Date/Time : 2024:06:02 14:45:08+02:00
File Inode Change Date/Time : 2024:06:02 14:45:08+02:00
File Permissions : -rw-r--r--
File Type : PNG
File Type Extension : png
MIME Type : image/png
Image Width : 216
Image Height : 213
Bit Depth : 8
Color Type : RGB with Alpha
Compression : Deflate/Inflate
Filter : Adaptive
Interlace : Noninterlaced
SRGB Rendering : Perceptual
Gamma : 2.2
Pixels Per Unit X : 3779
Pixels Per Unit Y : 3779
Pixel Units : meters
Image Size : 216x213
Megapixels : 0.046
018
Descripción: http://momo.hackmyvm.eu/ZiP004JfyGh/
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/ZiP004JfyGh/
<!doctype html>
<html lang="en">
<title>018</title>
Maybe the flag is in <redacted>.php
</html>
La pagina inicial nos dice que puede ser que la flag este en un archivo .php
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/ZiP004JfyGh/<redacted>.php
Yes, I have the flag! :)
Nos dice que tiene la flag pero nada mas, sabemos que PHP admite tanto peticiones GET como POST así que vamos a probar a hacer una peticion POST
┌─[bicho@balam]─[~]
└─[]=> curl -X POST http://momo.hackmyvm.eu/ZiP004JfyGh/<redacted>.php
HMV{<redacted>}
020
Descripción: The flag is in http://momo.hackmyvm.eu/li0nsg3l9vhhe/
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/li0nsg3l9vhhe/
You are not coming from https://nepcodex.com/
Parece que no vamos a poder acceder a la flag si no venimos desde ese dominio, vamos a usar la cabecera referer para simular que venimos desde ahi
┌─[bicho@balam]─[~]
└─[]=> curl -e https://nepcodex.com/ http://momo.hackmyvm.eu/li0nsg3l9vhhe/
HMV{<redacted>}
024
Descripción: http://momo.hackmyvm.eu/XXXll3ng324
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/XXXll3ng324
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>
Como podemos ver obtenemos un HTML Code 301, esto implica una redirección, curl por defecto no sigue estas redirecciones, asi que vamos a usar la opción -L
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/XXXll3ng324 -L
HMV{<redacted>}
027
Descripción: The flag is in http://momo.hackmyvm.eu/t0r1k34s3/
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/t0r1k34s3/
Where is my flag?
Vamos a ver si los headers contienen más información
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/t0r1k34s3/ -v
* Host momo.hackmyvm.eu:80 was resolved.
* IPv6: (none)
* IPv4: 5.45.101.64
* Trying 5.45.101.64:80...
* Connected to momo.hackmyvm.eu (5.45.101.64) port 80
> GET /t0r1k34s3/ HTTP/1.1
> Host: momo.hackmyvm.eu
> User-Agent: curl/8.8.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< Server: nginx/1.18.0
< Date: Sun, 02 Jun 2024 19:36:14 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Flag: HMV{<redacted>}
<
* Connection #0 to host momo.hackmyvm.eu left intact
Where is my flag?
042
Descripción: http://momo.hackmyvm.eu/n1lsfr4hm/
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/n1lsfr4hm/
<a href="/index.php?user=1">John</a>
<a href="/index.php?user=2">Monroe</a>
<a href="/index.php?user=3">Vault</a>
<a href="/index.php?user=4">{</a>
<a href="/index.php?user=6">Wesley</a>
<a href="/index.php?user=7">Teresa</a>
<a href="/index.php?user=8">Fredric</a>
<a href="/index.php?user=9">}</a>
Como podemos ver hay muchos usuarios, si hacemos una solicitud desde el navegador a cualquiera de ellos veremos que es incorrecto ya que el enlace hace alusión a la raiz del servidor, no al subdirectorio, vamos a hacer las peticiones con curl
┌─[bicho@balam]─[~]
└─[]=> curl "http://momo.hackmyvm.eu/n1lsfr4hm/index.php?user=1"
<a href="/index.php?user=1">John</a>
<a href="/index.php?user=2">Monroe</a>
<a href="/index.php?user=3">Vault</a>
<a href="/index.php?user=4">{</a>
<a href="/index.php?user=6">Wesley</a>
<a href="/index.php?user=7">Teresa</a>
<a href="/index.php?user=8">Fredric</a>
<a href="/index.php?user=9">}</a>
<br><br><br>Hello%
┌─[bicho@balam]─[~]
└─[]=> curl "http://momo.hackmyvm.eu/n1lsfr4hm/index.php?user=2"
<a href="/index.php?user=1">John</a>
<a href="/index.php?user=2">Monroe</a>
<a href="/index.php?user=3">Vault</a>
<a href="/index.php?user=4">{</a>
<a href="/index.php?user=6">Wesley</a>
<a href="/index.php?user=7">Teresa</a>
<a href="/index.php?user=8">Fredric</a>
<a href="/index.php?user=9">}</a>
<br><br><br>Where%
Parece que va escribiendo un mensaje con cada petición, vamos a usar un pequeño script para que nos salga la entrada más limpia
┌─[bicho@balam]─[~]
└─[]=> for id in $(seq 1 9); do curl -s "http://momo.hackmyvm.eu/n1lsfr4hm/index.php?user=$id" | grep "\<br\>" | sed 's/<br>//g'; done
Hello
Where
Are
Your
o_O
Super
Easy
Flag
?
Como podemos ver dice que donde está nuestra flag super facil, pues si miramos en los enlaces, veremos que no existe el 5 (de ahi viene o_O), vamos a ver si encontramos donde está
#Solicitud id 5
┌─[bicho@balam]─[~]
└─[]=> curl "http://momo.hackmyvm.eu/n1lsfr4hm/index.php?user=5" -s | grep "<br>" | sed "s/<br>//g"
o_O
#Solicitud id 0
┌─[bicho@balam]─[~]
└─[]=> curl "http://momo.hackmyvm.eu/n1lsfr4hm/index.php?user=0" -s | grep "<br>" | sed "s/<br>//g"
#Solicitud id > 11
┌─[bicho@balam]─[~]
└─[]=> curl "http://momo.hackmyvm.eu/n1lsfr4hm/index.php?user=11" -s | grep "<br>" | sed "s/<br>//g"
There is no way...
050
Descripción: http://momo.hackmyvm.eu/0r1g04szt0p/
TIP
Para entender la solución te recomiendo que eches un vistazo a los retos anteriores, si ves este reto como una pagina usual puede que te cueste ver donde está la flag
Al hacer curl de la página web veremos una web con un archivo .css, y un texto que pone this looks so clean!
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/0r1g04szt0p/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HackMyVM - Sertor</title>
<link rel="icon" href="logo.png" type="image/png" sizes="16x16">
<link href="index.css" type="text/css" rel="stylesheet">
</head>
<body>
<p id="smoothkeyset">
THIS LOOKS SO CLEAN!
</p>
</body>
</html>
Vamos a ver el contenido de index.css
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/0r1g04szt0p/index.css
body
{
background: rgb(123, 0, 128);
background: linear-gradient(90deg, rgba(123, 0, 128, 1) 0%, rgba(205, 0, 187, 1) 34%, rgba(255, 0, 134, 1) 68%);
}
body #smoothkeyset
{
position: absolute;
right: 45vw;
top: 45vh;
color: white;
font-family: "Lucida Sans", "dGhpc2lzbXlrZXkuY3NzLnR4dA==", sans-serif;
font-size: large;
font-style: italic;
text-decoration: white underline solid 6px;
cursor: default;
}
En font-family podemos ver lo que parece ser un string en base64, vamos a comprobarlo
┌─[bicho@balam]─[~]
└─[]=> echo "dGhpc2lzbXlrZXkuY3NzLnR4dA==" | base64 -d
<redacted>.css.txt
Efectivamente, era un string en base64, vamos a hacer un curl al archivo que nos dice
┌─[bicho@balam]─[~]
└─[]=> curl http://momo.hackmyvm.eu/0r1g04szt0p/<redacted>.css.txt
HMV{<redacted>}