Check out the new USENIX Web site. next up previous
Next: Analysis Process Up: Integrity Analysis Previous: Integrity Analysis


Analysis Implementation


The integrity analysis for the proposed TCB in Section 2.3 is performed on the SELinux example policy for Linux 2.4.19. This policy consists of over 50,000 policy statements 4. In Gokyo, the SELinux example policy comprises over 700 subject types and type attributes, over 40,000 individual permissions, and over 100,000 explicit assignments between subject types and permissions.

The integrity of the SELinux system is represented by two integrity constraints between the set of proposed TCB subject types and the set of all other subject types as shown in Figure 4. To represent this we create two subject types, TCB subject types (high integrity) and non-TCB subject types (low integrity), and aggregate the subject types into their respective group. The permissions assigned to each subject type node are automatically propagated to the aggregate subject types.

Our integrity protection goal is expressed using two constraints: (1) read-integrity constraint and (2) read-write-integrity constraint. Read-integrity constraints are violated if the low integrity subject has write permission (i.e., a permission representing the ability to modify the data in that SELinux class) to an object type and class pair that high integrity subject type has read permission to. Read-write integrity is violated if the high-integrity subject also has write permission to the object type and class pair in addition to read permission.

To implement these constraints, Gokyo assigns the invalid permissions to the high integrity set. For read-integrity, Gokyo creates a permission with all read permissions assigned for each object type and class pair that the low integrity subject can write. Similarly, for read-write-integrity, Gokyo creates a permission with all write permissions assigned for each object type and class pair that the low integrity subject can write. In this case, constraint verification takes an intersection of the invalid permissions and the ones assigned to the TCB subject types (i.e., different types of constraints may have different algorithms).

Note that it may be more efficient to test this constraint in the opposite manner by determining if the low integrity set has write permissions to object type and class pairs that the high integrity subject can read. At this point, we actually create both integrity test sets, but we should determine which is smaller and test only that one instead.


Table 2: Integrity conflicts in the initial TCB proposal.
Trusted Type Conflict Type Object Type & Op Class Resolution
dpkg_t tmpreaper_t tmp_dpkg_t:file rw exclude exclude
initrc_t many file_type:blk/chr/file r sanitize sanitize
initrc_t useradd_t etc_t:file r trust trust
initrc_t hwclock_t clock_device_t:chr/blk rw trust trust
initrc_t gpm_t psaux_t:chr rw exclude exclude
initrc_t sound_t, xdm_t sound_device_t:chr rw trust exclude
initrc_t httpd_admin_xserver_t framebuf_device_t:chr rw deny exclude
initrc_t many initrc_t:fifo rw deny sanitize
kernel_t slapd_t, squid_t, + *:*_socket r sanitize sanitize
kernel_t dhcpc_t resolv_conf_t:file r trust exclude
kernel_t dhcpd_t var_run_dhcpd_t:file r trust exclude
kernel_t quota_t file_t:file r trust trust
local_login_t many proc_t:file r sanitize sanitize
local_login_t insmod_t local_login_t:process r exclude exclude
local_login_t logrotate_t local_login_t:process r trust trust
mount_t automount_t autofs_t:dir rw exclude trust
mount_t bootloader_t, fsadm_t fixed_disk_device_t:* rw trust trust
sysadm_t user_t misc_device_t:* rw deny exclude obj
sysadm_t many sysadm_devpts_t/ptyfile:* rw deny change
sysadm_t sysadm_*_t sysadm_home_t:* rw deny change/sanitize one file
sysadm_t sysadm_*_t sysadm_tmp_t:file rw exclude change
sysadm_t sysadm_irc_t sysadm_irc_t:file rw exclude change/sanitize
sysadm_t sysadm_xserver_t sysadm_xserver_t:shm rw exclude exclude
sysadm_t sysadm_xauth_t sysadm_home_xauth_t:file rw exclude exclude
sysadm_t admin kernel_t:system avc_toggle rw trust trust
sshd_t many sshd_devpts_t/userpty:* rw deny change

Analyzing integrity protection is basically a task of identifying all integrity conflicts and classifying them into their best legal classification. We have found that the number of conflicts that exist in the entire SELinux policy is too large to be effectively considered together. Fortunately, conflicts are independent. That is, the existence of one conflict has no effect on another. This means that a classification to eliminate one conflict cannot be undone by another conflict. For example, if we find that we can sanitize the use of a particular conflicting permission, the emergence of a conflict later does not impact this sanitization. This is true for all classifications. The one caveat is that we may find that a particular subject requires so many sanitizations that it should be trusted or excluded, but these cases are not excessive and easily handled. Usually, we determine whether a subject should be trusted or excluded before we do the hard work of figuring out a sanitization.

The result is that we can consider the conflicts in small groups, and make classifications based on a subset of the information. Currently, we use Gokyo in a mode in which it identifies a single conflict for each invalid permission (i.e., constraint-generated). Sometimes, attribute assignments result in multiple, unique conflicts, but Gokyo only presents the attribute assignment once. Gokyo generates a log containing all conflicts and the assignment paths between nodes involved in the conflict, including the line numbers in which the assignments are specified. This assists with the manual analysis phase. However, addition metadata, such as the frequency of conflict for a particular invalid permission, would also be useful. The log of a constraint violation is shown below (class.conf is SELinux policy file, kernel.cst is our constraint file, and kernel.cfg contains aggregate subject type definitions):


On constraint: kernel.cst(25)
Role 151: mount_t 
	has constraint:  "integrity protected" 
with node: Role 882: non-mount

Violating Assignments: 
  Permission 2876: autofs_t:dir 00110000  
  (1) From: class.conf (60810) Perm 2876: 
	autofs_t:dir 00110000  
  (2) to: class.conf (60759) Role 151: mount_t

Violating Preclusions:
  Permission 45131: autofs_t:dir 003fffff 
  (3) From: kernel.cst (25) Role 882: non-mount 
  (4) to: class.conf (60759) Role 151: mount_t 
  (5) to: class.conf (0) Perm 42608: 
	autofs_t:dir 003e1c7e  
  (6) to: class.conf (60639) Perm 2857: 
	autofs_t:dir 003e1c7f  
  (7) to: kernel.cfg (94) Role 148: automount_t 
  (8) to: kernel.cfg (91) Role 882: non-mount

The violating assignments is the permission assigned to mount_t whose integrity may be violated. Line (1) indicates where the permission was assigned to mount_t, and line (2) indicates where mount_t was identified as a subject. The file class.conf is a truncated version of policy.conf for SELinux 2.4.19. For the violating preclusions, the path for the assignment of the constraint-generated invalid permission is shown. Line (3) refers to declaration of the aggregate subject type (Gokyo-specific), and line (4) is the same as line (2). Line (5) refers to the generated permission (no file line number because it is generated), and line (6) shows the assignment of autofs_t permissions to automount_t. Lines (7) and (8) show that automount_t is assigned to the non-TCB aggregate.

For each conflict, Gokyo estimates the classifications based on: (1) the number of subject type conflicts (for trust); (2) whether the subject type or object type is required, see below (for excluding subject types); and (3) whether the conflict is read-integrity or read-write-integrity (for considering sanitization). Our proposal for removing object types based on whether the object type is created by only excluded subject types has not been implemented yet, so we use the object types required by our focal subject type.

For required subject types, we assumed that the purpose of our system was to run an Apache web server. Thus, we include all Apache subject types (i.e., those starting with httpd) and all those subject types that transition to an Apache subject type, directly or indirectly. In addition to our TCB subject types, we require dpkg_t (i.e., the Debian package manager), rlogind, several user subject types. Ultimately, we will choose to exclude rlogind, but include user_t in the analysis. Users may be actively involved in script generation (e.g., for personal pages in a corporate server). Because so few other required subject types are found this way, we will add others later. Note that the set of required object types includes the types accessible to the Apache subject types only.


next up previous
Next: Analysis Process Up: Integrity Analysis Previous: Integrity Analysis
Trent Jaeger
2003-05-11