the_asymptote
Challenge
Imported from local notes.md.
Solution
Original Notes
the_asymptote
Challenge Summary
- Given: A remote service at
nc 34.131.216.230 1338with no downloadable files. - Goal: Recover the flag from the remote file reader.
- Constraints: Flag format is
IIITL{...}.
Initial Recon / Triage
- Observations: Connecting to the service drops the user into a shell-like environment containing
challenge,flag.txt, andwelcome.txt. - File identification:
challengeis executable but not readable byctf.flag.txtis group-readable only byflag_group. The working directory itself is writable byctf. - Entry points: The
challengeprogram always readswelcome.txtand prints it.
Hypotheses & Approach
- Hypothesis 1:
challengemight accept a filename as an argument. Testing showed it ignores argv and still readswelcome.txt. - Hypothesis 2: The binary performs a permission check and then opens
welcome.txt, making it vulnerable to a symlink-swap race. This was correct.
Execution Steps (Reproducible)
Stage 1
Commands:
nc 34.131.216.230 1338
ls -l
./challenge
Results:
- The shell exposes:
challengeflag.txtwelcome.txt
- Running
./challengeprints the contents ofwelcome.txt.
Stage 2
Commands:
rm -f welcome.txt && ln -s flag.txt welcome.txt
./challenge
rm -f welcome.txt && ln -s welcome.bak welcome.txt
./challenge
Results:
- Pointing
welcome.txtatflag.txtcauses:Security Alert: You don't have permission to read welcome.txt - Pointing
welcome.txtat a readable file succeeds. - This indicates a time-of-check/time-of-use style permission bug on the path target.
Stage 3
Commands:
python3 /root/incognito2026CTF/the_asymptote/artifacts/exploit.py
Results:
exploit.pyconnects to the remote shell.- It preserves the original
welcome.txtaswelcome.bak. - It starts a tight background loop that flips
welcome.txtbetweenwelcome.bakandflag.txt. - It repeatedly runs
./challengeuntil the permission check passes on the readable file and the subsequent open lands onflag.txt. - The successful output contains the flag:
IIITL{4cc355_ch3ck_p4553d_bu7_f1l3_5w4pp3d_07b404a5c3f2}
Artifacts Produced
artifacts/exploit.py- final remote exploit script.artifacts/solve.py- simple wrapper to run the exploit as the standard solver entry point.artifacts/exploit_output.txt- captured transcript of the successful exploit run.
Flag
IIITL{4cc355_ch3ck_p4553d_bu7_f1l3_5w4pp3d_07b404a5c3f2}