CVE-2022-30526 (Fixed): Zyxel Firewall Local Privilege Escalation
A local privilege escalation vulnerability in Zyxel firewalls allows a low-privileged user (such as 'nobody') to become root by abusing a setuid binary that permits writing to the cron table. An attacker who already has shell access can thus gain full control of the device.
Published on rapid7.com
Rapid7 discovered a local privilege escalation vulnerability affecting Zyxel firewalls. The vulnerability allows a low privileged user, such as nobody, to escalate to root on affected firewalls.
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
The setuid binary zysudo.suid allows low-privileged users to execute an allow-listed set of commands with root privileges, including file-copy commands that can overwrite the cron table.
Impact
An attacker with low-privileged shell access can escalate to root, gaining full control of the firewall.
What the attacker needed
Shell access as a low-privileged user
The fix
Zyxel released a fix for this issue on July 19, 2022.
How it was found
- Copy the active crontab to a temporary location.
- Create a script that will run a reverse shell.
- Make the script executable.
- Append a cron job to the temporary crontab that runs the script as root.
- Use zysudo.suid to copy the modified crontab back to /var/zyxel/crontab.
- Wait for cron to execute the job and obtain a root shell.
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.
This is a local privilege escalation bug: someone who already has a low-level shell on the firewall can use a special program (zysudo.suid) to run certain commands as the root user. By overwriting the system's scheduled task list (crontab), they can make the system run their own code as root, giving them complete control.
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.