Phantom 5: File Authority — Escalating from Group Membership to Root (A Linux Privilege Escalation CTF Walkthrough)
The user phantom5 was a member of the shadow group, which allowed reading /etc/shadow and obtaining the root password hash. The root account had a weak password that was cracked, enabling privilege escalation to root.
Published on infosecwriteups.com
Our user belongs to an interesting group. Groups determine what you can access.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the user was incorrectly added to the shadow group, and the root account used a weak dictionary password.
Impact
An attacker with shadow group membership could read password hashes and crack a weak root password to gain root access.
What the attacker needed
User in shadow group; weak root password
The fix
Remove regular users from the shadow group and enforce strong, non-dictionary passwords.
How it was found
- Enumerate group membership with the groups command.
- Read /etc/gshadow to see group structure and membership.
- Read /etc/shadow because of shadow group membership.
- Filter out locked and disabled accounts to find crackable hashes.
- Crack the root hash with John the Ripper using rockyou.txt.
- Use su to become root with the cracked password and read the flag.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
In Linux, groups control who can read certain files. The shadow group normally lets only system programs read the file that stores password hashes. Here, a regular user was in that group, so they could read the hashes. Then, because the root password was a common word, it was easy to crack and become root.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.