Ubuntu ppp's CVE-2020-15704 wrap-up
Ubuntu's ppp package contained a setuid-root binary that invoked modprobe without clearing environment variables, allowing an attacker to pass arbitrary options via MODPROBE_OPTIONS. This could lead to loading arbitrary kernel modules or reading arbitrary files, depending on kernel configuration and AppArmor profiles.
synacktiv.com
Published on synacktiv.com
Rédigé par Thomas Chauchefoin - 03/09/2020 - dans Exploit - Téléchargement
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 pppd called modprobe using execl without sanitising the environment, allowing the MODPROBE_OPTIONS variable to inject arbitrary arguments.
Impact
An attacker could load arbitrary kernel modules, potentially leading to privilege escalation, or read arbitrary files (such as /etc/shadow) when AppArmor profiles restrict module loading but allow file reads.
What the attacker needed
Ppp package installed; user in dip group; kernel without built-in ppp_generic (for module loading); AppArmor profile allowing file read (for file read)
The fix
The vulnerable patch was removed, as the ppp_generic module is now built into the kernel on most images.
How it was found
- Ensure the ppp package is installed and the user is in the dip group.
- Make the open of /dev/ppp fail, for example by using a kernel without the ppp_generic module built-in.
- Set the MODPROBE_OPTIONS environment variable to point to a malicious module configuration.
- Run /sbin/pppd, which will invoke modprobe with the attacker-controlled options.
- Observe that the arbitrary kernel module is loaded (e.g., via dmesg).
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 setuid program runs with the privileges of its owner (here root), so it can do things normal users cannot. This program called another tool (modprobe) but did not clean the environment variables it passed along, so a user could sneak in extra options. Those options let the user load a kernel module (a piece of code that runs with high privileges) or read files they should not access.
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.