|
|
Subscribe / Log in / New account

Security

An introduction to SELinux

September 22, 2004

This article was contributed by Jake Edge.

It has taken nearly four years for Security Enhanced Linux (SELinux) to make its way into some of the more mainstream distributions, but that process is accelerating. First released by the US National Security Agency (NSA), in December 2000, SELinux has been incorporated into Fedora Core 2 (and the test versions of Fedora Core 3), Debian and Gentoo and will likely see more distributions that support it and more deployments in the future. It seems like a good time to take an in-depth look at how SELinux can increase the security of Linux.

Linux, like UNIX, has its security based on what is known as Discretionary Access Control (DAC) which means that access to objects is governed by the identity of an authenticated user. It is discretionary because the user can (sometimes unwittingly) pass their permissions to others on the system. A simple "chmod a+w somefile" is an example of a command that a Linux user can execute that opens up permissions on a file to all other users in the system. In addition, any program that is run by a user has at least the permissions of that user. This allows malicious, badly configured, or exploitable programs to use the full permissions of the user executing them and can lead to unexpected security breaches. If, for example, the cat program had an exploitable buffer overrun bug and a particular file could trigger that bug and cause it to delete the files in a user's home directory, standard Linux access control would not prevent it. Any user that could be tricked into executing cat badfile would be susceptible.

SELinux, on the other hand, uses a Mandatory Access Control (MAC) mechanism that seeks to only allow a program the access it needs to do its job and not all the access that the user running it has. In the example above, cat could be configured to only have read access to any files that the user has read access to and any attempt to write or delete any file in the system would be prevented. The administrator can prevent programs from having unneeded access and only allow the user to grant that portion of their access that is needed by the normal functioning of the program. MAC embodies the idea that "those things which are not explicitly permitted are forbidden."

At its core, SELinux defines a security attribute called a type and assigns types to various resources handled by the kernel: processes, files, directories, sockets, etc. The usage of the term type is unfortunate in that it implies all files would be one type, all directories another, etc. This is not the case as each individual resource could have its own type. Each type in the system is associated with a set of rights for each other type in the system and those rights govern what kinds of operations can be performed. This model is known as Type Enforcement (TE) and is the subject of a patent granted to Secure Systems Corp. (SSC), one of the contractors that worked with the NSA on parts of SELinux. At one time there were concerns that the patent would preclude SELinux from being distributed under the GPL, but the SSC Statement of Assurance seems to have alleviated those concerns. SELinux augments the traditional TE model with the addition of Role-Based Access Control (RBAC). Instead of directly associating a user with a type, RBAC associates users with one or more roles in the system and associates one or more types with each of those roles. The permissions checks are still handled by the TE system and RBAC just provides a simpler way to manage users.

SELinux provides a much richer set of permissions than the read, write, execute permissions that UNIX users are used to. There are separate permissions that govern all of the kinds of operations you can do on a file (create, delete, rename, unlink, etc.) as well as specific kinds of permissions for directories, sockets, semaphores, etc. Permissions are stored as bits in an access vector and SELinux has three types of these vectors: allowed, auditallow, and auditdeny. The allowed vector governs whether the operation is permitted. Auditallow and auditdeny determine whether the operation is logged if it is allowed or denied.

It should be noted that all of the permissions checking that is done by SELinux is done after the normal Linux permissions checks are performed. If a user cannot read a file due to the rwx permissions, the SELinux access control mechanism is not consulted.

One would guess that with all of this fine-grained control over permissions, SELinux would be very complex to set up and that would be true, but the NSA and the distributions have done a great deal of the necessary groundwork. As part of their release, the NSA also released policy definitions to be used as a starting point for SELinux administrators. Various distributions have tweaked these definitions for their specific needs, but it is still a very complex and somewhat fragile framework. This author had difficulty with various cron jobs on a Fedora Core 2 SELinux system and the mailing list archives have quite a few queries from administrators trying to get the permissions set correctly for their specific needs. Based on this message it would appear that Fedora Core 3 has ratcheted down the checking that SELinux will do in the default install.

An upcoming article will give a more "hands-on" approach to exploring SELinux using Fedora Core 3 test2 including looks at the policies defined and how they are used to provide more protection than a standard Linux installation.

Comments (35 posted)

New vulnerabilities

Foomatic: Arbitrary command execution in foomatic-rip

Package(s):foomatic CVE #(s):CAN-2004-0801
Created:September 20, 2004 Updated:May 31, 2006
Description: There is a vulnerability in the foomatic-filters package. This vulnerability is due to insufficient checking of command-line parameters and environment variables in the foomatic-rip filter. This vulnerability may allow both local and remote attackers to execute arbitrary commands on the print server with the permissions of the spooler.
Alerts:
SuSE SUSE-SA:2006:026 foomatic-filters 2006-05-30
Fedora-Legacy FLSA:2076 foomatic 2004-11-05
Conectiva CLA-2004:880 foomatic-filters 2004-10-27
Fedora FEDORA-2004-303 foomatic 2004-09-21
Gentoo 200409-24 foomatic 2004-09-20

Comments (none posted)

FreeRADIUS: denial of service

Package(s):freeradius CVE #(s):CAN-2004-0938 CAN-2004-0960 CAN-2004-0961
Created:September 22, 2004 Updated:February 2, 2005
Description: FreeRADIUS (through version 1.0.1) suffers from several denial of service vulnerabilities in its packet reception code.
Alerts:
Fedora-Legacy FLSA:2187 freeradius 2005-02-01
Red Hat RHSA-2004:609-01 freeradius 2004-11-12
Gentoo 200409-29 freeradius 2004-09-22

Comments (none posted)

glFTPd: Local buffer overflow vulnerability

Package(s):glFTPd CVE #(s):
Created:September 21, 2004 Updated:September 22, 2004
Description: The glFTPd server is vulnerable to a buffer overflow in the 'dupescan' program. This vulnerability is due to an unsafe strcpy() call which can cause the program to crash when a large argument is passed. A local user with malicious intent can pass a parameter to the dupescan program that exceeds the size of the buffer, causing it to overflow. This can lead the program to crash, and potentially allow arbitrary code execution with the permissions of the user running glFTPd, which could be the root user.
Alerts:
Gentoo 200409-27 glftpd 2004-09-21

Comments (none posted)

heimdal: root escalation

Package(s):heimdal CVE #(s):CAN-2004-0794
Created:September 16, 2004 Updated:September 22, 2004
Description: The Heimdal FTP daemon has several bugs that can allow a remote attacker to gain root privileges.
Alerts:
Debian DSA-551-1 lukemftpd 2004-09-21
Gentoo 200409-19 heimdal 2004-09-16

Comments (none posted)

imagemagick: buffer overflow vulnerability

Package(s):imagemagick CVE #(s):CAN-2004-0827
Created:September 16, 2004 Updated:November 30, 2004
Description: The ImageMagick graphics library has several buffer overflow vulnerabilities that allow an attacker to crash the reading process by creating mal-formed video or image files in the AVI, BMP, or DIB format.
Alerts:
Ubuntu USN-35-1 imagemagick 2004-11-30
Ubuntu USN-7-1 imagemagick 2004-10-27
Red Hat RHSA-2004:480-01 ImageMagick 2004-10-20
Red Hat RHSA-2004:494-01 ImageMagick 2004-10-20
Mandrake MDKSA-2004:102 ImageMagick 2004-09-22
Debian DSA-547-1 imagemagic 2004-09-16

Comments (none posted)

libxpm4: stack and integer overflows

Package(s):libxpm4 CVE #(s):CAN-2004-0687 CAN-2004-0688
Created:September 16, 2004 Updated:February 14, 2005
Description: There are several stack and integer overflow bugs in the libXpm code of XFree86 that may be used for a denial of service.
Alerts:
Conectiva CLA-2005:924 XFree86 2005-02-14
Red Hat RHSA-2005:004-01 lesstif 2005-01-12
Red Hat RHSA-2004:537-01 openmotif 2004-12-02
Ubuntu USN-27-1 libxpm4 2004-11-17
Mandrake MDKSA-2004:124 xorg-x11 2004-11-04
Debian DSA-561-1 xfree86 2004-10-11
Gentoo 200410-09 lesstif 2004-10-09
Debian DSA-560-1 lesstif1-1 2004-10-07
Red Hat RHSA-2004:479-01 XFree86 2004-10-06
Red Hat RHSA-2004:478-01 XFree86 2004-10-04
Gentoo 200409-34 xorg-x11 2004-09-27
SuSE SUSE-SA:2004:034 XFree86-libs, 2004-09-17
Mandrake MDKSA-2004:099 XFree86 2004-09-15
Mandrake MDKSA-2004:098 libxpm4 2004-09-15

Comments (none posted)

mozilla products: arbitrary code execution and other vulnerabilities

Package(s):mozilla firefox thunderbird CVE #(s):CAN-2004-0902 CAN-2004-0903 CAN-2004-0904 CAN-2004-0905 CAN-2004-0908
Created:September 20, 2004 Updated:January 13, 2005
Description: Several vulnerabilities exist in the Mozilla web browser and derived products, the most serious of which could allow a remote attacker to execute arbitrary code on an affected system. See the CERT advisory for details.
Alerts:
Gentoo 200501-03 mozilla 2005-01-05
Fedora-Legacy FLSA:2089 mozilla 2004-10-27
Conectiva CLA-2004:877 mozilla 2004-10-22
Mandrake MDKSA-2004:107 mozilla 2004-10-19
SuSE SUSE-SA:2004:036 mozilla 2004-10-06
Red Hat RHSA-2004:486-01 mozilla 2004-09-30
Slackware SSA:2004-266-03 mozilla 2004-09-22
Gentoo 200409-26 mozilla 2004-09-20

Comments (none posted)

mpg123: buffer overflow bug

Package(s):mpg123 CVE #(s):CAN-2004-0805
Created:September 16, 2004 Updated:January 11, 2005
Description: The mpg123 audio playing utility has a buffer overflow bug that may allow arbitrary execution of code.
Alerts:
Gentoo 200501-14 mpg123 2005-01-10
Debian DSA-564-1 mpg123 2004-10-13
Mandrake MDKSA-2004:100 mpg123 2004-09-22
Gentoo 200409-20 mpg123 2004-09-16

Comments (none posted)

phpGroupWare: cross site scripting vulnerability

Package(s):phpgroupware CVE #(s):
Created:September 16, 2004 Updated:September 22, 2004
Description: The wiki module in phpGroupWare has a cross-site scripting vulnerability.
Alerts:
Gentoo 200409-22 phpgroupware 2004-09-16

Comments (none posted)

SnipSnap: HTTP errors

Package(s):snipsnap-bin CVE #(s):
Created:September 22, 2004 Updated:September 22, 2004
Description: SnipSnap, a content management system, is vulnerable to several "HTTP response splitting" attacks, leading to cross-site scripting and cache poisoning problems. Version 1.0_beta1 fixes things.
Alerts:
Gentoo 200409-23 snipsnap-bin 2004-09-17

Comments (none posted)

xine-lib: buffer overflows

Package(s):xine-lib CVE #(s):CAN-2004-1379
Created:September 22, 2004 Updated:April 10, 2006
Description: xine-lib (through version 1_rc6) contains buffer overflows in the subtitle parsing and DVD sub-picture decoder code.
Alerts:
Fedora-Legacy FLSA:152873 xine 2006-04-04
Debian DSA-657-1 xine-lib 2005-01-25
Mandrake MDKSA-2004:105 xine-lib 2004-10-06
Slackware SSA:2004-266-04 xine 2004-09-22
Gentoo 200409-30 xine-lib 2004-09-22

Comments (none posted)

Resources

Tool announcement: fakebust

Michal Zalewski has announced the availability of "fakebust," which is "a simple, open-source, user-friendly, intuitive and very rapid malicious code analyzer that can partly replace and in certain aspects outperform an expensive, strictly controlled sandbox setup."

Full Story (comments: none)

The Phishing Guide

NGS has released a new white paper entitled "The Phishing Guide." "This paper covers the technologies and security flaws Phishers exploit to conduct their attacks, and provides detailed vendor-neutral advice on what organisations can do to prevent future attacks."

Full Story (comments: none)

Page editor: Jonathan Corbet
Next page: Kernel development>>


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