LWN.net Logo

Security

A privilege escalation flaw in udev

By Jake Edge
April 22, 2009

A vulnerability in udev, the user-space tool that manages the Linux /dev tree, has left unpatched systems vulnerable to a local root privilege escalation. Exploits are already circulating on the full-disclosure mailing list, so it is rather important for users and administrators to update their systems. The problem was caused by the way udev processes the messages it receives—certain kinds of messages, which could be generated by user processes, were not considered. That oversight led to the vulnerability.

The ever-expanding nature of the /dev tree, along with the rise of more dynamic hardware environments, led to the creation of udev in 2003. It replaced the devfs filesystem that was an earlier attempt to solve those problems. Unfortunately, devfs codified device naming policy into the kernel—something the kernel hackers try to avoid. By moving those decisions to user space with udev, that problem—along with a number of others—was resolved.

In order for udevd (the udev daemon) to do its job, it needs a way to be informed by the kernel when devices come and go—typically because the user attached or detached some device. A standard Linux way to send messages between the kernel and user space is via a netlink socket. Netlink sockets are an inter-process communication (IPC) mechanism that is geared for kernel to user space (and vice versa) IPC. It provides the well-understood sockets API to user space programs and is a much more flexible IPC mechanism than other possible choices.

One of the nice features of netlink sockets is the ability to multicast messages (i.e. a message sent to multiple recipients). Each netlink protocol type can have up to 32 multicast groups associated with it. Typically, multicast messages can only be sent and received by root, though some netlink protocol types will allow non-root processes to send and/or receive multicast messages. In fact, a recent change to the kernel allows non-root processes to receive—but not send—the udev multicast messages (which are also known as uevents).

Since only root processes can send the multicast uevents, it would seem there is no hole to exploit. Unfortunately, no one considered unicast messages. Any process can send a unicast netlink message to any other process, just by addressing it to a particular pid. It is up to the recipient to decide whether to accept and process the message. Because these unicast messages fell through the cracks, udevd would happily process them—creating devices as specified by a potentially malicious user. One of the more obvious exploits would be to create world-writeable block device corresponding to the root filesystem—other, nastier exploits are likely possible as well.

The fix was straightforward: enabling credentials (a header placed on each message by the kernel that includes the uid and pid of the sender) for the netlink socket, then requiring that all messages received have a uid of zero, which Kay Sievers added on April 8. Scott James Remnant added some additional checks shortly thereafter, requiring that messages received are not unicast and have been sent by the kernel.

Sievers says that either patch "alone would be sufficient" to fix the problem and that doing both is, in some sense, defensive programming. The credentials check is needed for upcoming changes, he said, and Remnant's checks will take care of a theoretical concern: "a confined root process inside SELinux or AppArmor jail, which in fact is not root in the usual sense, has no privileges, but could have the uid 0". While Sievers didn't think the theory was particularly viable, checking for a sender pid of zero (as Remnant's change does) will take care of that problem as well.

This vulnerability illustrates a fairly common mistake: not considering all of the ways that input can reach a program. Every input mechanism factors into the "attack surface" of a program (or system). In this case, messages that—up until very recently at least—couldn't even be seen by non-root processes, could be sent by them. It is not uncommon for developers to focus on the "normal" usage of an input mechanism and miss a lesser, but still valid, use.

It is interesting to see that this vulnerability has a strange overlap with the capabilities flaw we reported on last week. In both cases, an exploit would use a device node created by mknod(), which is, itself, an uncommonly-used system call. These are the kinds of places that attackers are likely to focus their efforts. One hopes that other users of netlink sockets—routing daemons, netfilter, firewall applications, and others—have examined their code for similar problems.

Comments (26 posted)

Brief items

The voting machine industry looks at open source

Here is a report from the Election Technology Council [PDF] giving the voting machine industry's view of open source software. It's ... interesting. "The level of accountability present within an open source product offering is weakened due to its diffuse contributor base and lack of clear liability. Public oversight is arguably just as diminished in an open source environment since the layperson is unable to read and understand software source code adequately enough to ensure total access and comprehension. If a third party is charged with this oversight function to remedy this situation, this is would be no different than any other regulatory process that institutionalizes an oversight function." (Seen on Freedom To Tinker, where Dan Wallach adds several comments of his own).

Comments (25 posted)

The details on loading rootkits via /dev/mem

For the curious, here is the paper describing rootkit injection via /dev/mem [PDF]. As expected, there's not a whole lot that's truly new, though there are some clever techniques for getting the kernel to allocate memory for the injected code. The authors note that, indeed, the STRICT_DEVMEM configuration option will block this attack. "Until recently there was no protection inside the kernel main- line, although SELinux has limited seeks above the first megabyte of memory for a few years. Users of RHEL and other distributions have been safe for some time now."

Comments (62 posted)

New vulnerabilities

apt: return code not checked

Package(s):apt CVE #(s):CVE-2009-1300
Created:April 21, 2009 Updated:April 27, 2009
Description: From the Ubuntu advisory: Alexandre Martani discovered that the APT daily cron script did not check the return code of the date command. If a machine is configured for automatic updates and is in a time zone where DST occurs at midnight, under certain circumstances automatic updates might not be applied and could become permanently disabled.
Alerts:
Ubuntu USN-762-1 2009-04-20
Debian DSA-1779-1 2009-04-26

Comments (none posted)

clamav: multiple vulnerabilities

Package(s):clamav CVE #(s):CVE-2008-6680 CVE-2009-1270
Created:April 16, 2009 Updated:December 8, 2009
Description: Clamav has three vulnerabilities, from the Debian alert:

CVE-2008-6680 Attackers can cause a denial of service (crash) via a crafted EXE file that triggers a divide-by-zero error.

CVE-2009-1270 Attackers can cause a denial of service (infinite loop) via a crafted tar file that causes (1) clamd and (2) clamscan to hang.

(no CVE Id yet) Attackers can cause a denial of service (crash) via a crafted EXE file that crashes the UPack unpacker.

Alerts:
Mandriva MDVSA-2009:327 2009-12-08
Gentoo 200909-04 2009-09-09
Mandriva MDVSA-2009:097 2009-04-24
Debian DSA-1771-1 2009-04-15

Comments (none posted)

cups: integer overflow

Package(s):cups CVE #(s):CVE-2009-0163
Created:April 17, 2009 Updated:March 15, 2010
Description: From the Debian advisory: It was discovered that the imagetops filter in cups, the Common UNIX Printing System, is prone to an integer overflow when reading malicious TIFF images.
Alerts:
Mandriva MDVSA-2009:282-1 2009-12-07
Mandriva MDVSA-2009:282 2009-10-19
Mandriva MDVSA-2009:283 2009-10-19
Mandriva MDVSA-2009:281 2009-10-19
Fedora FEDORA-2009-3753 2009-04-21
Fedora FEDORA-2009-3769 2009-04-21
CentOS CESA-2009:0429 2009-04-20
Gentoo 200904-20 2009-04-23
CentOS CESA-2009:0428 2009-04-20
Ubuntu USN-760-1 2009-04-16
rPath rPSA-2009-0061-1 2009-04-17
Red Hat RHSA-2009:0429-01 2009-04-16
Debian DSA-1773-1 2009-04-17
Red Hat RHSA-2009:0428-01 2009-04-16

Comments (none posted)

cups: multiple vulnerabilities

Package(s):cups CVE #(s):CVE-2009-0146 CVE-2009-0147 CVE-2009-0166 CVE-2009-0799 CVE-2009-0800 CVE-2009-1179 CVE-2009-1180 CVE-2009-1181 CVE-2009-1182 CVE-2009-1183
Created:April 17, 2009 Updated:August 18, 2010
Description: From the Red Hat advisory:

Multiple buffer overflow flaws were found in the CUPS JBIG2 decoder. An attacker could create a malicious PDF file that would cause CUPS to crash or, potentially, execute arbitrary code as the "lp" user if the file was printed. (CVE-2009-0146, CVE-2009-1182)

Multiple integer overflow flaws were found in the CUPS JBIG2 decoder. An attacker could create a malicious PDF file that would cause CUPS to crash or, potentially, execute arbitrary code as the "lp" user if the file was printed. (CVE-2009-0147, CVE-2009-1179)

Multiple flaws were found in the CUPS JBIG2 decoder that could lead to the freeing of arbitrary memory. An attacker could create a malicious PDF file that would cause CUPS to crash or, potentially, execute arbitrary code as the "lp" user if the file was printed. (CVE-2009-0166, CVE-2009-1180)

Multiple denial of service flaws were found in the CUPS JBIG2 decoder. An attacker could create a malicious PDF file that would cause CUPS to crash when printed. (CVE-2009-0799, CVE-2009-1181, CVE-2009-1183)

Multiple input validation flaws were found in the CUPS JBIG2 decoder. An attacker could create a malicious PDF file that would cause CUPS to crash or, potentially, execute arbitrary code as the "lp" user if the file was printed. (CVE-2009-0800)

Alerts:
Mandriva MDVSA-2011:175 2011-11-15
Ubuntu USN-973-1 2010-08-17
CentOS CESA-2010:0400 2010-05-28
Mandriva MDVSA-2010:096 2010-05-17
CentOS CESA-2010:0399 2010-05-08
Red Hat RHSA-2010:0400-01 2010-05-06
Red Hat RHSA-2010:0399-01 2010-05-06
Mandriva MDVSA-2010:087 2010-04-29
Mandriva MDVSA-2010:055 2010-03-04
Mandriva MDVSA-2009:346 2009-12-29
Mandriva MDVSA-2009:331 2009-12-10
Mandriva MDVSA-2009:282-1 2009-12-07
Mandriva MDVSA-2009:283 2009-10-19
Mandriva MDVSA-2009:282 2009-10-19
Fedora FEDORA-2009-10694 2009-10-21
Mandriva MDVSA-2009:281 2009-10-19
Fedora FEDORA-2009-6972 2009-06-27
SuSE SUSE-SR:2009:012 2009-07-03
Fedora FEDORA-2009-6973 2009-06-27
Fedora FEDORA-2009-6982 2009-06-27
CentOS CESA-2009:0431 2009-05-19
CentOS CESA-2009:0480 2009-05-15
Red Hat RHSA-2009:0480-01 2009-05-13
SuSE SUSE-SR:2009:010 2009-05-12
Slackware SSA:2009-129-01 2009-05-11
Debian DSA-1793-1 2009-05-06
Debian DSA-1790-1 2009-05-05
CentOS CESA-2009:0458 2009-05-03
Red Hat RHSA-2009:0458-01 2009-04-30
Fedora FEDORA-2009-3753 2009-04-21
Fedora FEDORA-2009-3769 2009-04-21
rPath rPSA-2009-0059-1 2009-04-17
Red Hat RHSA-2009:0429-01 2009-04-16
Gentoo 200904-20 2009-04-23
SuSE SUSE-SA:2009:024 2009-04-22
Fedora FEDORA-2009-3820 2009-04-21
Fedora FEDORA-2009-3794 2009-04-21
CentOS CESA-2009:0429 2009-04-20
CentOS CESA-2009:0430 2009-04-20
Ubuntu USN-759-1 2009-04-16
rPath rPSA-2009-0061-1 2009-04-17
Red Hat RHSA-2009:0431-01 2009-04-16
Red Hat RHSA-2009:0430-01 2009-04-16

Comments (none posted)

firefox: multiple vulnerabilities

Package(s):firefox CVE #(s):CVE-2009-0652 CVE-2009-1302 CVE-2009-1303 CVE-2009-1304 CVE-2009-1305 CVE-2009-1306 CVE-2009-1307 CVE-2009-1308 CVE-2009-1309 CVE-2009-1310 CVE-2009-1311 CVE-2009-1312
Created:April 22, 2009 Updated:September 14, 2009
Description: Firefox prior to the 3.0.9 release contains a list of vulnerabilities of varying severity.
Alerts:
Debian DSA-1886-1 2009-09-14
Fedora FEDORA-2009-7614 2009-07-15
Fedora FEDORA-2009-7567 2009-07-15
Debian DSA-1830-1 2009-07-12
Slackware SSA:2009-178-01 2009-06-29
Mandriva MDVSA-2009:141 2009-06-17
Ubuntu USN-782-1 2009-06-25
CentOS CESA-2009:1126 2009-06-26
Red Hat RHSA-2009:1126-01 2009-06-25
Red Hat RHSA-2009:1125-01 2009-06-25
SuSE SUSE-SR:2009:010 2009-05-12
Mandriva MDVSA-2009:111 2009-05-12
Debian DSA-1797-1 2009-05-09
Slackware SSA:2009-112-01 2009-04-23
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3893 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Fedora FEDORA-2009-3875 2009-04-22
Ubuntu USN-764-1 2009-04-23
Fedora FEDORA-2009-3875 2009-04-22
CentOS CESA-2009:0436 2009-04-23
CentOS CESA-2009:0437 2009-04-23
Red Hat RHSA-2009:0437-02 2009-04-21
Red Hat RHSA-2009:0436-02 2009-04-21
Gentoo 201301-01 2013-01-07

Comments (none posted)

git-core: privilege escalation

Package(s):git-core CVE #(s):
Created:April 21, 2009 Updated:April 22, 2009
Description: From the Debian advisory: Peter Palfrader discovered that in the Git revision control system, on some architectures files under /usr/share/git-core/templates/ were owned by a non-root user. This allows a user with that uid on the local system to write to these files and possibly escalate their privileges.
Alerts:
Debian DSA-1777-1 2009-04-21

Comments (none posted)

kernel: privilege escalation

Package(s):kernel CVE #(s):CVE-2009-1072
Created:April 16, 2009 Updated:July 2, 2009
Description: The kernel has a privilege escalation vulnerability. From the SUSE alert:

nfsd in the Linux kernel does not drop the CAP_MKNOD capability before handling a user request in a thread, which allows local users to create device nodes, as demonstrated on a filesystem that has been exported with the root_squash option.

Alerts:
Ubuntu USN-793-1 2009-07-02
Red Hat RHSA-2009:1132-01 2009-06-30
CentOS CESA-2009:1106 2009-06-19
Red Hat RHSA-2009:1106-01 2009-06-16
SuSE SUSE-SA:2009:033 2009-06-16
SuSE SUSE-SA:2009:031 2009-06-09
SuSE SUSE-SA:2009:030 2009-06-08
Red Hat RHSA-2009:1081-01 2009-06-03
SuSE SUSE-SA:2009:028 2009-05-20
Debian DSA-1800-1 2009-05-15
SuSE SUSE-SA:2009:021 2009-04-16

Comments (none posted)

mpg123: user-assisted execution of arbitrary code

Package(s):mpg123 CVE #(s):CVE-2009-1301
Created:April 17, 2009 Updated:December 8, 2009
Description: From the Gentoo advisory: The vendor reported a signedness error in the store_id3_text() function in id3.c, allowing for out-of-bounds memory access. A remote attacker could entice a user to open an MPEG-1 Audio Layer 3 (MP3) file containing a specially crafted ID3 tag, possibly resulting in the execution of arbitrary code with the privileges of the user running the application.
Alerts:
Mandriva MDVSA-2009:093-1 2009-12-08
Gentoo 200904-15 2009-04-16
Mandriva MDVSA-2009:093 2009-04-22

Comments (none posted)

phpMyAdmin: insufficient output sanitizing

Package(s):phpMyAdmin CVE #(s):CVE-2009-1285
Created:April 16, 2009 Updated:April 22, 2009
Description: phpMyAdmin has a vulnerability involving insufficient output sanitizing. The phpMyAdmin security report states:

Setup script used to generate configuration can be fooled using a crafted POST request to include arbitrary PHP code in generated configuration file. Combined with ability to save files on server, this can allow unauthenticated users to execute arbitrary PHP code. This issue is on different parameters than PMASA-2009-3 and it was missed out of our radar because it was not existing in 2.11.x branch.

Alerts:
Fedora FEDORA-2009-3700 2009-04-15
Fedora FEDORA-2009-3692 2009-04-15

Comments (none posted)

poppler: multiple vulnerabilities

Package(s):poppler CVE #(s):CVE-2009-1187 CVE-2009-1188
Created:April 17, 2009 Updated:May 24, 2010
Description: From the rPath advisory: Previous versions of poppler contain multiple vulnerabilities, the most serious of which could allow an attacker to cause a denial of service or execute arbitrary code as the user executing the application.
Alerts:
Mandriva MDVSA-2011:175 2011-11-15
Debian DSA-2050-1 2010-05-24
Mandriva MDVSA-2010:087 2010-04-29
Debian DSA-2028-1 2010-04-05
Mandriva MDVSA-2010:055 2010-03-04
Fedora FEDORA-2010-1377 2010-02-19
Fedora FEDORA-2010-1805 2010-02-19
Mandriva MDVSA-2009:287-1 2009-12-04
Fedora FEDORA-2010-1842 2010-02-19
Fedora FEDORA-2009-10648 2009-10-21
Red Hat RHSA-2009:1512-01 2009-10-15
Mandriva MDVSA-2009:287 2009-10-22
Fedora FEDORA-2009-10694 2009-10-21
Red Hat RHSA-2009:1502-01 2009-10-15
CentOS CESA-2009:1512 2009-10-16
CentOS CESA-2009:1503 2009-10-16
CentOS CESA-2009:1501 2009-10-16
CentOS CESA-2009:1502 2009-10-30
Red Hat RHSA-2009:1501-01 2009-10-15
Fedora FEDORA-2009-6972 2009-06-27
Fedora FEDORA-2009-6973 2009-06-27
Fedora FEDORA-2009-6982 2009-06-27
Red Hat RHSA-2009:1503-01 2009-10-15
CentOS CESA-2009:0480 2009-05-15
Red Hat RHSA-2009:0480-01 2009-05-13
Ubuntu USN-759-1 2009-04-16
rPath rPSA-2009-0059-1 2009-04-17

Comments (none posted)

slurm-llnl: privilege escalation

Package(s):slurm-llnl CVE #(s):
Created:April 21, 2009 Updated:April 22, 2009
Description: From the Debian advisory: It was discovered that the Simple Linux Utility for Resource Management (SLURM), a cluster job management and scheduling system, did not drop the supplemental groups. These groups may be system groups with elevated privileges, which may allow a valid SLURM user to gain elevated privileges.
Alerts:
Debian DSA-1776-1 2009-04-21

Comments (none posted)

udev: multiple vulnerabilities

Package(s):udev CVE #(s):CVE-2009-1185 CVE-2009-1186
Created:April 16, 2009 Updated:December 3, 2009
Description: udev has two vulnerabilities, from the Debian alert:

Sebastian Kramer discovered two vulnerabilities in udev, the /dev and hotplug management daemon.

CVE-2009-1185 udev does not check the origin of NETLINK messages, allowing local users to gain root privileges.

CVE-2009-1186 udev suffers from a buffer overflow condition in path encoding, potentially allowing arbitrary code execution.

Alerts:
Mandriva MDVSA-2009:103-1 2009-12-03
Mandriva MDVSA-2009:104 2009-04-30
Mandriva MDVSA-2009:103 2009-04-30
Slackware SSA:2009-111-01 2009-04-21
SuSE SUSE-SA:2009:020 2009-04-16
SuSE SUSE-SA:2009:025 2009-04-22
Slackware SSA:2009-111-02 2009-04-22
Gentoo 200904-18 2009-04-18
CentOS CESA-2009:0427 2009-04-20
rPath rPSA-2009-0063-1 2009-04-17
Fedora FEDORA-2009-3711 2009-04-16
Fedora FEDORA-2009-3712 2009-04-16
Ubuntu USN-758-1 2009-04-15
Debian DSA-1772-1 2009-04-16
Red Hat RHSA-2009:0427-01 2009-04-16

Comments (none posted)

xine-lib: integer overflow

Package(s):xine-lib CVE #(s):CVE-2009-0698
Created:April 21, 2009 Updated:June 1, 2010
Description: From the CVE entry: Integer overflow in the 4xm demuxer (demuxers/demux_4xm.c) in xine-lib 1.1.16.1 allows remote attackers to cause a denial of service (crash) and possibly execute arbitrary code via a 4X movie file with a large current_track value, a similar issue to CVE-2009-0385.
Alerts:
Gentoo 201006-04 2010-06-01
Mandriva MDVSA-2009:319 2009-12-05
Mandriva MDVSA-2009:298 2009-11-13
Mandriva MDVSA-2009:299 2009-11-13
Ubuntu USN-763-1 2009-04-20

Comments (none posted)

Page editor: Jake Edge
Next page: Kernel development>>

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds