Skip to content
RCE Write-up Advanced

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.

Security Shenanigans, on medium.com

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

  1. Run sudo -l to list allowed commands.
  2. Find a sudo script with no parameter validation.
  3. Inject a command to disable AppArmor.
  4. Wait for reboot, then use tcpdump -z to run a script as root.
  5. Scan the new network with SNMP using default credentials.
  6. 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.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.