Description
This is an official writeup for the challenge "winkey" which was the finals challenge for the UrchinSec DTS Finals CTF. The challenge was to perform a blackbox pentest, and get the highest privileges but also patch any available vulnerability/misconfigration/bug/flaw that might lead to another malicious actor gaining access!
This box was authored/created by tahaafarooq
Challenge Summary
The box had 2 ports accessible, SSH and Nginx. Provided with hostname winkey.urc nginx has 2 virtual hosts which are api.winkey.urc and archive.winkey.urc. The API is vulnerable to command injection vulnerability. Where after exploiting it the attacker will find that the binary sed has SUID bit and there is a cron-job running which splits the path to root in two! By either using sed to write into shadows/passwd or monitoring processes and exploiting a race condition binary.
Enumeration
First begin by running an nmap scan: