Messages in this thread Patch in this message | | | Date | Wed, 25 Jun 1997 14:23:25 -0500 | From | Tall cool one <> | Subject | Ext2 immutable problem. |
| |
Hello,
I mailed Remy Card about this already, but haven't heard back from him, so I thought I'd post this to the list to make sure it got out there. A couple of weeks ago I was playing with the ext2 immutable and append flags and noticed that it is possible to overwrite an immutable or append only file simply by renameing a non-immutable file over the old immutable file! Definately defeats the purpose of immutable files.
The problem is that the new_inode isn't checked to make sure it's not immutable before the rename is done. The following patch corrects the problem (patched against 2.0.30):
----------------- diff -u --recursive linux-orig/fs/ext2/namei.c linux/fs/ext2/namei.c --- linux-orig/fs/ext2/namei.c Sat Nov 30 05:21:20 1996 +++ linux/fs/ext2/namei.c Tue Jun 10 11:57:52 1997 @@ -1019,6 +1019,8 @@ current->fsuid != new_inode->i_uid && current->fsuid != new_dir->i_uid && !fsuser()) goto end_rename; + if (IS_APPEND(new_inode) || IS_IMMUTABLE(new_inode)) + goto end_rename; if (S_ISDIR(old_inode->i_mode)) { retval = -ENOTDIR; if (new_inode && !S_ISDIR(new_inode->i_mode)) ----------------- BTW, has there been any work done on making it impossible to write to the raw device if the secure level has been set? There is no security if someone can just open the raw device and start flipping bits at will, install new kernels, change inode times/permissions/ownerships, etc...
Later...
- Steve
.--------------------------------------------------. # * # # # # # # | Steve Baker | Barely Working | # ## # # # # # | ice@mama.indstate.edu | System Administrator | # # # # # # # # | Red-Hat Rulz! | Will work for hardware | # # # ## # # # # `--- SYS-ADMIN FOR HIRE, HAVE UNIX, WILL TRAVEL ---' #### # # # ## # #
| |