--- trunk/1.6.x/ccs-patch/README.ccs 2008/01/24 03:18:27 924 +++ trunk/1.6.x/ccs-patch/README.ccs 2008/04/08 05:48:22 1093 @@ -1,7 +1,7 @@ Notes for TOMOYO Linux project This is a handy Mandatory Access Control patch for Linux kernels. -This patch is released under the GPL. +This patch is released under the GPLv2. Project URL: http://tomoyo.sourceforge.jp/ @@ -933,8 +933,8 @@ @ Fix ReadAddressGroupPolicy() bug. - ReadAddressGroupPolicy() fails if both "path_group" and "address_group" are used - because I forgot to set "head->read_var1 = NULL". + ReadAddressGroupPolicy() fails if both "path_group" and "address_group" + are used because I forgot to set "head->read_var1 = NULL". Fix 2007/07/10 @@ -949,14 +949,15 @@ @ Remove mount-flags manipulation. - Until now, administrator is permitted to turn on/off specific mount options - regardless of mount options passed to kernel. + Until now, administrator is permitted to turn on/off specific mount + options regardless of mount options passed to kernel. I removed this feature because "exact option matching" sounds better than "automatic option enabler/disabler". @ Remove /proc/ccs/info/mapping . - I removed /proc/ccs/info/mapping because nobody seems to use this feature. + I removed /proc/ccs/info/mapping because nobody seems to use this + feature. @ Call external policy loader automatically. @@ -980,7 +981,8 @@ can handle interactive operations by opening /dev/console . Now, there is no difference between init=/sbin/ccs-init and call_usermodehelper("/sbin/ccs-init"), and users no longer need to - add init=/sbin/ccs-init parameter to load policy before /sbin/init starts. + add init=/sbin/ccs-init parameter to load policy before /sbin/init + starts. Fix 2007/08/14 @@ -1142,17 +1144,235 @@ rather than in_interrupt() because in_atomic() returns nonzero whenever scheduling is not allowed. -Fix 2008/01/24 +Fix 2008/02/05 + + @ Use find_task_by_vpid() instead of find_task_pid(). + + Kernel 2.6.24 introduced PID namespace. + To search PID given from userland, the kernel needs to use + find_task_by_vpid() instead of find_task_pid(). + +Fix 2008/02/14 + + @ Add execve() parameter checking. + + Until now, it was impossible to check argv[] and envp[] parameters + passed to execve(). + I expanded conditional permission syntax so that + { argc, envc, argv[] , envp[] } parameters can be checked if needed. + This will allow administrator permit execution of /bin/sh only when + /bin/sh is invoked in the form of "/bin/sh -c" and environment variable + HOME is set by specifying + + allow_execute /bin/sh if exec.argv[1]="-c" exec.envp["HOME"]!=NULL + + in the policy. + This extension will make exploit codes difficult to start /bin/sh because + they unlikely set up environment variables and unlikely specify "-c" + option when invoking /bin/sh , whereas proper functions likely set up + environment variables and likely specify "-c" option. + +Fix 2008/02/18 + + @ Add process state checking. + + Until now, it was impossible to change ACL without executing program. + I added three variables for performing stateful checking within a domain. + You can set current process's state like: + + allow_network TCP accept @TRUSTED_HOSTS 1024-65535 ; set task.state[0]=1 + allow_network TCP accept @UNTRUSTED_HOSTS 1024-65535 ; set task.state[0]=0 + + and you can use the state like + + allow_read /path/to/important/file if task.state[0]=1 + + in the policy. + The state changes when the request was granted by the MAC's policy, + so please be careful with situations where the state has changed + successfully but the request was not processed because of other reasons + (e.g. out of memory). + +Fix 2008/02/26 @ Support /proc/ccs/ access by non-root user. Until now, only root user can access /proc/ccs/ interface. - But to permit /proc/ccs/ access by non-root user so that - it won't require ssh login by root user when administrating - from remote host, I eased restrictions on this interface. - - (current->uid == 0 && current->euid == 0) || - (current->uid != 0 && current->uid == inode->i_uid) || - (current->gid != 0 && current->gid == inode->i_gid) + But to permit /proc/ccs/ access by non-root user so that it won't require + ssh login by root user when administrating from remote host, + I made "(current->uid == 0 && current->euid == 0)" requirement optional. + If this requirement is disabled, only "conventional DAC permission + checks" and "/proc/ccs/manager checks" are used. + +Fix 2008/02/29 + + @ Add sleep_on_violation feature. + + Some exploit codes (e.g. trans2open for Samba) continue running + until it achieves the purpose of the exploit code (e.g. invoke /bin/sh). + + If such code is injected due to buffer overflow but the kernel + rejects the request, it triggers infinite "Permission denied" loop. + As a result, the CPU usage becomes 100% and gives bad effects to + the rest of processes. + This is a side effect of rejecting the request from the exploit code + which wouldn't happen if the request from the exploit code was granted. + + To avoid such CPU consumption, I added a penalty that forcibly + sleeps for specified period when a request is rejected. + + This penalty doesn't work if the exploit code does nothing but + continue running, but I think most exploit code's purpose is + to start some program rather than to slow down the target system. + + @ Add alt_exec feature. + + Since TOMOYO Linux's approach is "know all essential requests in advance + and create policy that permits only them", you can regard anomalous + requests as attacks (if you want to do so). + + Common MAC implementations merely reject requests that violate policy. + But I added a special handler for execve() to TOMOYO Linux. + + This handler is triggered when a process requested to execute a program + but the request was rejected by the policy. + This handler executes a program specified by the administrator + instead of a program requested by the process. + + Most attackers attempt to execute /bin/sh to start something malicious. + Attackers execute an exploit code using buffer overflow vulnerability + to steal control of a process. But this handler can get back control + if an exploit code requests execve() that is not permitted by policy. + + By default, this handler does nothing (i.e. merely reject execve() + request). You can specify any program to start what you want to do. + + You can redirect attackers to somewhere else (e.g. honey pot). + This makes it possible to act your Linux box as an on-demand honey pot + while keeping regular services for your usage. + + You can collect information of the attacker (e.g. IP address) and + update firewall configuration. + + You can silently terminate a process who requested execve() + that is not permitted by policy. + +Fix 2008/03/03 + + @ Add "force_alt_exec" keyword. + + To be able to fully utilize "alt_exec" feature, + I added "force_alt_exec" keyword so that + all execute requests are replaced by the execute request of a program + specified by alt_exec feature. + + If this keyword is specified for a domain, the domain no longer + executes any programs regardless of the mode of file access control + (i.e. the domain won't execute even if MAC_FOR_FILE=0 ). + Instead, the domain executes the program specified by alt_exec feature + and the program specified by alt_exec feature validates the execute + request and executes it if it is appropriate to execute. + + If you can tolerate that there is no chance to return an error code + to the caller to tell the execute request was rejected, + this is more flexible approach than in-kernel execve() parameter + checking because we can do argv[] and envp[] checking easily. + +Fix 2008/03/04 + + @ Use string for access control mode. + + An integer expression for access control mode sometimes confuses + administrators because profile number is also an integer expression. + To avoid confusion between profile number and access control mode, + I introduced a string expression for access control mode. + + Modes which take an integer between 0 and 3. + + 0 -> disabled + 1 -> learning + 2 -> permissive + 3 -> enforcing + + Modes which take 0 or 1. + + 0 -> disabled + 1 -> enabled + +Fix 2008/03/10 + + @ Rename "force_alt_exec" keyword to "execute_handler". + + To be able to use different programs for validating execve() parameters, + I moved the location to specify the program's pathname from profile + to domain policy. + + The "execute_handler" keyword takes one pathname which is + invoked whenever execve() request is issued. Thus, any "allow_execute" + keywords in a domain with "execute_handler" are ignored. + This keyword is designed for validating expected/desirable execve() + requests in userspace, although there is no way to tell the caller + that the execve() request was rejected. + + @ Rename "alt_exec" keyword to "denied_execute_handler". + + The "denied_execute_handler" keyword takes one pathname which is + invoked only when execve() request was rejected. In other words, + this program is invoked only when the following conditions are met. + + (1) None of "allow_execute" keywords in the domain matched. + (2) The execve() request was rejected in enforcing mode. + (3) "execute_handler" keyword is not used by the domain. + + This keyword is designed for handling unexpected/undesirable execve() + requests, to redirect the process issuing such requests to somewhere. + +Fix 2008/03/18 + + @ Fix wrong/redundant locks in pre-vfs functions. + + lock_kernel()/unlock_kernel() in pre_vfs_rename() were redundant for + 2.6 kernels. + + Locking order in pre_vfs_link() and pre_vfs_unlink() for 2.4 kernels + after 2.4.33 were different from before 2.4.32 . + +Fix 2008/03/28 + + @ Disable execute handler loop. + + To be able to use "execute_handler" in a "keep_domain" domain, + ignore "execute_handler" and "denied_execute_handler" keywords + if the current process is executing programs specified by + "execute_handler" or "denied_execute_handler" keyword. + + This exception is needed to avoid infinite execute handler loop. + If a domain has both "keep_domain" and "execute_handler", + any execute request by that domain is handled by an execute handler, + and the execute handler attempts to process original execute request. + But the original execute request is handled by the same execute handler + unless the execute handler ignores "execute_handler". + + @ Update coding style. + + I rewrote the code to pass scripts/checkpatch.pl as much as possible. + Function names were changed to use only lower letters. + +Version 1.6.0 2008/04/01 Feature enhancement release. + +Fix 2008/??/?? + + @ Fix "Compilation failures" and "Initialization ordering bugs" + with kernels before 2.4.30/2.6.11 . + + 2.6 kernels before 2.6.9 didn't have include/linux/hardirq.h , + resulting compilation error at #include . + I added #elif condition. + + 2.6 kernels before 2.6.11 calls do_execve() before initialization of + ccs_alloc(), resulting NULL pointer dereference. + I changed __initcall to fs_initcall. - The inode's uid and gid are set using chown/chgrp commands. + Some distributions with 2.6.9 kernels backported kzalloc() from 2.6.14 , + resulting compilation error at kzalloc(). + I modified prototype of kzalloc().