LWN.net Logo

Security

Filesystem capabilities in Fedora 10

By Jake Edge
January 7, 2009

Linux capabilities have been around for a long time, but they are finally starting to get to the point where they can actually be used. There are still no mainstream distributions that make use of them, but Fedora 10 has all of the requisite functionality available, as Ulrich Drepper recently pointed out in a blog posting. There are now systems available for administrators to begin to try out capabilities to see what advantages they offer.

Note that this article concerns Linux/POSIX capabilities and not the other security approach of the same name.

The canonical test program for capabilities seems to be ping; that is what Drepper used, as did Chris Friedhoff in his capabilities documentation. Currently in Fedora 10, ping is a setuid-root program as it needs privileges that normal users do not have. Removing the setuid bit with

    chmod u-s /bin/ping 
results in normal users getting the following error:
    ping: icmp open socket: Operation not permitted
But, ping can be left without the setuid bit, by proper application of capabilities.

By using the setcap command, a root user can give the required capabilities to the ping program. These get stored as extended attributes (xattrs) in the filesystem and queried by the kernel when filesystem capabilities are enabled. It should be noted that not all filesystems support xattrs, but for those that do, setcap will add the "capability" attribute with a 20-byte value representing the capability information.

The capability required by ping is CAP_NET_RAW, so an administrator who wants to have a non-setuid-root ping must do:

    setcap cap_net_raw=ep /bin/ping
This sets the CAP_NET_RAW bit in both the "effective" (e) and "permitted" (p) capability sets. These two sets, along with the "inheritable" set, govern the capabilities that a process has or can set. Serge Hallyn's developerWorks article is a good reference for how those sets interact.

But, how does one find out what capabilities a particular program needs? In some ways similar to the audit2allow method sometimes used to determine SELinux policies, one can look for permission denied errors as Friedhoff describes:

    $ strace ping localhost 2>&1 | grep EPERM
    socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = -1 EPERM (Operation not permitted)
In this case, ping tried to open a raw socket which requires CAP_NET_RAW. Hallyn's article also has code for a capable_probe kernel module that can be used to see what capabilities are requested. As with the SELinux method, one must be careful that the capabilities requested are actually reasonable for the program's task before granting them.

Now that capabilities are available, folks have started to wonder when things like ping will have their setuid bit removed in standard distributions. Panu Matilainen asked on fedora-devel: "Are we ready to start considering moving away from SUID bits to capabilities, in Fedora 11 maybe?" The answer in the resulting thread seems to be "no", mostly because there is concern about folks building their own kernel without support for capabilities. It is a bit of a weak argument because Fedora depends on any number of kernel options. Drepper is characteristically blunt: "That's nonsense since there are many other options we rely on and which can be compiled out."

Other distributions may handle things differently, though, so we may see Linux-capability-based systems elsewhere. For now, administrators can turn off setuid and instead set capabilities on programs in Fedora 10, "unfortunately you have to do it every time the program is updated again," Drepper notes. Capabilities were originally added to Linux in the 2.1 kernel series, around ten years ago, so it is nice to see them finally getting to the point of usability for regular users and administrators. It will be interesting to see where things go from here.

Comments (15 posted)

Brief items

25C3: MD5 collisions crack CA certificate (heise online)

Researchers presenting at the 25th Chaos Communication Congress (25C3) have used MD5 collisions to generate bogus, but trusted, SSL certificates as reported by heise online. This would allow nefarious web sites to generate a certificate purporting to be from any other site—greatly increasing the reach of phishing and other scams. "Using a weakness in the MD5 cryptographic hash function, which allows different messages to generate the same MD5 hash – known as an MD5 'collision', the international team of Alexander Sotirov, Marc Stevens, Jacob Appelbaum, Arjen Lenstra, David Molinar, Dag Arne Osvik and Benne De Weger, have used one attack scenario to create a certificate which will be trusted by all browsers because it appears to be signed by one of the root CAs that browsers trust by default. The certificate can also be used to sign other certificates, which could allow attackers to carry out 'practically undetectable phishing attacks'."

Comments (47 posted)

New vulnerabilities

OpenSSL: certificate verification flaw

Package(s):OpenSSL CVE #(s):CVE-2008-5077
Created:January 7, 2009 Updated:July 27, 2011
Description: From the Red Hat advisory: the Google security team discovered a flaw in the way OpenSSL checked the verification of certificates. An attacker in control of a malicious server, or able to effect a "man in the middle" attack, could present a malformed SSL/TLS signature from a certificate chain to a vulnerable client and bypass validation.
Alerts:
SUSE SUSE-SU-2011:0847-1 2011-07-27
openSUSE openSUSE-SU-2011:0845-1 2011-07-27
Gentoo 200904-05 2009-04-05
Mandriva MDVSA-2009:271 2009-10-12
Mandriva MDVSA-2009:037 2008-02-16
Gentoo 200902-02 2009-02-12
Slackware SSA:2009-014-01 2009-01-15
Fedora FEDORA-2009-0419 2009-01-14
Fedora FEDORA-2009-0543 2009-01-14
SuSE SUSE-SA:2009:006 2009-01-23
rPath rPSA-2009-0008-1 2009-01-20
Slackware SSA:2009-014-03 2009-01-15
CentOS CESA-2009:0004 2009-01-07
Debian DSA-1701-1 2009-01-12
Fedora FEDORA-2009-0331 2009-01-08
Red Hat RHSA-2009:0004-01 2009-01-07
Fedora FEDORA-2009-0544 2009-01-14
Fedora FEDORA-2009-0547 2009-01-14
Slackware SSA:2009-014-02 2009-01-15
Fedora FEDORA-2009-0325 2009-01-08
Ubuntu USN-704-1 2009-01-07

Comments (none posted)

p7zip: unknown vulnerability

Package(s):p7zip CVE #(s):
Created:January 7, 2009 Updated:January 7, 2009
Description: The p7zip file archiver suffers from "archives formats issues." Such information as is available can be found in this bugzilla entry.
Alerts:
Fedora FEDORA-2008-11868 2008-12-30
Fedora FEDORA-2008-11891 2008-12-30
Fedora FEDORA-2008-11843 2008-12-30

Comments (none posted)

php-xajax: cross-site scripting

Package(s):php-xajax CVE #(s):CVE-2007-2739
Created:December 29, 2008 Updated:January 7, 2009
Description:

From the Debian advisory:

It was discovered that php-xajax, a library to develop Ajax applications, did not sufficiently sanitise URLs, which allows attackers to perform cross-site scripting attacks by using malicious URLs.

Alerts:
Debian DSA-1692-1 2008-12-27

Comments (none posted)

samba: privilege escalation

Package(s):samba CVE #(s):CVE-2009-0022
Created:January 6, 2009 Updated:October 5, 2009
Description: From the Ubuntu advisory: Gunter Höckel discovered that Samba with registry shares enabled did not properly validate share names. An authenticated user could gain access to the root filesystem by using an older version of smbclient and specifying an empty string as a share name. This is only an issue if registry shares are enabled on the server by setting "registry shares = yes", "include = registry", or "config backend = registry", which is not the default.
Alerts:
Fedora FEDORA-2009-10172 2009-10-03
Mandriva MDVSA-2009:042 2009-02-18
Fedora FEDORA-2009-0160 2009-01-07
SuSE SUSE-SR:2009:001 2009-01-12
Fedora FEDORA-2009-0268 2009-01-07
Slackware SSA:2009-005-01 2009-01-06
Ubuntu USN-702-1 2009-01-05

Comments (none posted)

xen: DOS and symlink vulnerabilities

Package(s):xen CVE #(s):CVE-2008-4405 CVE-2008-4993
Created:January 7, 2009 Updated:September 15, 2009
Description: The Xen package, as shipped by Red Hat (at least), contains a pair of vulnerabilities. Unprivileged DomU domains are able to overwrite "xenstore values," enabling the killing of arbitrary processes. And the qemu-dm.debug script has a symbolic link vulnerability exploitable by a local attacker.
Alerts:
SuSE SUSE-SR:2009:015 2009-09-15
Mandriva MDVSA-2009:016 2009-01-16
CentOS CESA-2009:0003 2009-01-08
Red Hat RHSA-2009:0003-01 2009-01-07

Comments (none posted)

xterm: arbitrary code execution

Package(s):xterm CVE #(s):CVE-2008-2383 CVE-2008-7236
Created:January 5, 2009 Updated:March 11, 2009
Description:

From the Debian advisory:

Paul Szabo discovered that xterm, a terminal emulator for the X Window System, places arbitrary characters into the input buffer when displaying certain crafted escape sequences.

Alerts:
Slackware SSA:2009-069-03 2009-03-11
Gentoo 200902-04 2009-02-12
Debian DSA-1694-1 2009-01-02
Fedora FEDORA-2009-0059 2009-01-07
Fedora FEDORA-2009-0154 2009-01-07
Fedora FEDORA-2009-0091 2009-01-07
CentOS CESA-2009:0018 2009-01-07
Mandriva MDVSA-2009:005 2009-01-11
Red Hat RHSA-2009:0019-01 2009-01-07
Red Hat RHSA-2009:0018-01 2009-01-07
SuSE SUSE-SR:2009:003 2009-02-02
SuSE SUSE-SR:2009:002 2009-01-19
Ubuntu USN-703-1 2009-01-06
Debian DSA-1694-2 2009-01-06

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