Password Profiler writeup

Descripción
We intercepted a suspicious file from a system, but instead of the password itself, it only contains its SHA-1 hash. Using OSINT techniques, you are provided with personal details about the target. Your task is to leverage this information to generate a custom password list and recover the original password by matching its hash.
Download the following files:
- userinfo: Contains the personal details.
- hash: Contains the SHA-1 hash of the password.
- check_password: Script to test passwords against the hash.
Password Profiler solución
Para completar este CTF será necesario instalar CUPP (Common User Passwords Profiler).
git clone https://github.com/Mebus/cupp
cd cupp
python3 cupp.py -h
Con este último comando veremos todas las opciones posibles. Ahora generaremos el archivo de posibles contraseñas:
python3 cupp.py -i
En este caso, no debemos usar la opción ‘-w’, sino ‘-i’ y rellenar la información requerida manualmente:

Ahora, abriremos el archivo ‘check_password.py’ para ver de qué archivo toma las posibles contraseñas:
codium check_password.py
El código será el siguiente:
#!/usr/bin/env python3
import hashlib
HASH_FILE = "hash.txt"
WORDLIST_FILE = "passwords.txt" # wordlist that was generated using CUPP
def load_hash():
with open(HASH_FILE, "r") as f:
return f.read().strip()
def crack_password(target_hash):
with open(WORDLIST_FILE, "r", encoding="utf-8", errors="ignore") as f:
for password in f:
password = password.strip()
if hashlib.sha1(password.encode()).hexdigest() == target_hash:
return password
return None
if __name__ == "__main__":
target_hash = load_hash()
result = crack_password(target_hash)
if result:
print(f"Password found: picoCTF{{{result}}}")
else:
print("No match found.")
Con lo que cambiamos el nombre al archivo generado por CUPP a ‘passwords.txt’:
mv alice.txt ../passwords.txt
Y ejecutaremos el programa para comprobar las contraseñas:
python3 check_password.py
Obteniendo así la flag:

Consultor de ciberseguridad especializado en continuidad de negocio y respuesta ante incidentes. Interesado en analizar tecnologías desde una perspectiva de seguridad y descubrir su comportamiento real.
