~/write-ups/writeup-b0a7d93542
Web Application Penetration Testing CTF 1
Imported from Notion: Web Application Penetration Testing CTF 1
Pistas
-
Sometimes, important files are hidden in plain sight. Check the root (’/’) directory for a file named ‘flag.txt’ that might hold the key to the first flag.
-
Explore the structure of the server’s directories. Enumeration might reveal hidden treasures.
-
The login form seems a bit weak. Trying out different combinations might just reveal the next flag.
-
The login form behaves oddly with unexpected inputs. Think of injection techniques to access the ‘admin’ account and find the flag.
Empezamos con un escaneo para ver que puertos hay abiertos:
nmap -sSV target.ine.local
Vemos que podemos ver 4 archivos en la web, la ruta es: http://192.196.107.3/view_file?file=file1.txt
La pista dice que esta en la raíz a si que probamos manualmente un Local File Inclusion :
http://192.196.107.3/view_file?file=../../../../../../flag.txt

Flag 1: FLAG1_7163ec3e80644de4bbf0f4106042afb3
La segunda pista habla sobre enumerar directorios, a si que usaremos gobuster
gobuster dir -u http://target.ine.local -w /usr/share/wordlists/dirb/common.txt

Vemos un directorio interesante llamado secured a si que vamos al navegador a ver que hay ahi.

Vemos que hay dentro un archivo llamado flag.txt a si que lo ponemos en el navegador para ver su contenido:

Tenemos la flag 2: FLAG2_ae14a2e0b87d427f80f759f3d9db994f
Ahora vamos con la tercera y cuarta, que habla sobre el panel login, a si que abramos burpsuite para intentar logearnos.
Clickamos en la extension foxyproxy y habilitamos burpsuite

Pondremos user: test password: test para testear y ver respuesta al dar en el boton log in.


Lo mandamos al repeater.

Podemos ver que arroja un mensaje de error: Invalid username or password
Vamos a probar si es vulnerable a SQLi introduciendo en el parametro username : admin' --

Lo es, a si que vamos a hacerlo manual en el panel login.


Tenemos la flag 4: FLAG4_9be2406a4a534cf2bcd798e561c3df7f
Para la flag 3 debemos enumerar usuarios, a si que mandaremos al intruder lo que teniamos previamente en el repeater.

En el intruder, cubrimos admin con el ratón.

clickamos en Add§ y vamos a la pestaña Payloads

En Payload settings damos a load y cargamos nuestra wordlist que en este caso será /usr/share/wordlist/metasploit/unix_users.txt
Ahora damos arriba a la derecha a start attack y empezará el ataque probando users en nuestro SQLi , buscamos Status code 302 como nos da admin , tras un rato, vemos que un usuario guest nos arroja status code 302

Probamos en el panel log in de la web:
-
user:
guest' -- -
password:
CUALQUIER COSA
ya que ' -- lo que hace es ignorar el resto de la query


Tenemos la flag 3: FLAG3_4edc5a60eb314564aaa2b03476875875
- EOF -
<< back_to_index