CVE-2023–22809
A privilege escalation flaw in sudo versions 1.8.0 to 1.9.12p1 allows a local attacker with sudoedit privileges to edit the /etc/sudoers file and gain root access. The attacker can then run any command as root, compromising the system.
medium.com
Published on medium.com
A privilege escalation vulnerabilityCVE-2023–22809 that was found in the sudo utility 1.8.0 up to 1.9.12p1 versions. Sudo is a program for Unix-like operating systems which allows users to run programs as the root or another user belonging to a group that is not the root user.
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 sudoedit feature does not properly sanitise environment variables, allowing an attacker to inject extra arguments that cause sudo to edit arbitrary files such as /etc/sudoers.
Impact
An attacker with sudoedit privileges could gain root access, allowing them to modify system files, steal data, install malware, or disable security controls.
What the attacker needed
Local user with sudoedit privileges; sudo version 1.8.0 to 1.9.12p1
The fix
Upgrade sudo to a version newer than 1.9.12p1, restrict sudoedit for non-privileged users, and enforce secure environment variables.
How it was found
- Check the sudo version with sudo -V to see if it is between 1.8.0 and 1.9.12p1.
- Verify the user's sudo permissions with sudo -l to confirm sudoedit access.
- Use sudoedit to edit /etc/sudoers and add a line granting full privileges.
- Run sudo su root to gain root access.
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.
Sudo is a tool that lets normal users run commands as the administrator (root). This bug lets someone who is allowed to edit files with sudo (using sudoedit) trick the system into letting them edit the main sudo configuration file, which controls who can do what. Once they change that file, they can give themselves full admin rights.
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.