04-23-07 12:17 AM
pascaldamian2@gmail.com writes:
> Can I block access to certain system calls from non-privileged users?
Yes, but not easily.
> For example, restricting statfs() so normal users would not be able to
> see results of 'df' command.
On Linux, you can patch your kernel source to return EACCESS from
sys_statfs() unless 0 == current->uid.
You can probably write a kernel module that will do the above patch
at load time.
You can also add a special interposer library that will return
error from statfs64() unless 0 == getuid() [1], and arrange for
that library to be preloaded everywhere via /etc/ld.so.preload
However this last method is easily bypassed: the user could
statically link his own copy of "df".
Cheers,
[1] better implement your own getuid() via direct syscall.
If you do not, the user can preload his own interposer that answers
0 to getuid(), bypassing your protection using the same trick you
used to implement the protection.
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
[ Post a follow-up to this message ]
|