Why you should always scan UDP ports (2/2)
A sudo-allowed script lacked parameter validation, allowing command injection to disable AppArmor and later exploit tcpdump's -z flag for root. Attackers also used default SNMP credentials to extract MySQL hashes and private SSH keys, gaining root on a cluster.
medium.com
Published on medium.com
We finished part 1 having gained unprivileged access to a host in a new network. Afterwards, we wanted to gain privileges to continue.
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 a sudo-allowed script passed user input to a shell without validation, and default SNMP credentials exposed sensitive data.
Impact
Attackers could gain root on the initial host and then root access to every server in a cluster, accessing sensitive data.
What the attacker needed
Unprivileged access to a host; sudo permission for a vulnerable script; default SNMP credentials
How it was found
- Run sudo -l to list allowed commands.
- Find a sudo script with no parameter validation.
- Inject a command to disable AppArmor.
- Wait for reboot, then use tcpdump -z to run a script as root.
- Scan the new network with SNMP using default credentials.
- Extract MySQL hashes and private SSH keys from the database.
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.
A script run with high privileges accepted extra commands from user input, letting attackers run their own commands as root. Separately, network devices used default passwords, leaking database credentials and SSH keys that gave full server access.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.