我正在运行一个bash脚本来复制一些日志文件,然后在Red Hat盒子上重启一个服务.每次执行脚本时,我都会在控制台上获得以下内容:
[root @ servername~] #sh /bin/restart_nss.sh
kernel.suid_dumpable = 1
停止服务:[确定]
开始服务:[确定]
[root @ servername~]#
在这种情况下,“kernel.suid_dumpable = 1”是什么意思?
谢谢,
IVR复仇者
一些背景:
setuid位:
可执行文件上的setuid位使得任何用户运行的可执行文件都像可执行文件的所有者一样运行.因此,如果setuid设置在root拥有的程序上,无论谁运行它,它都将以root权限运行.当然不是那么简单,请参阅this wikipedia文章,或者在Unix环境中获取Steven编程的副本.
核心转储:
核心转储是将程序的工作内存转储到文件中.见this wikipedia article.
suid_dumpable:
这控制是否可以如上所述从setuid程序转储核心.见下文.这是一个内核可调参数,您可以使用以下命令进行更改:
- sudo sysctl -w kernel.suid_dumpable=2
您可以在文件中找到关于此可编码的可调参数,如果已安装,您可以在以下目录中找到:/usr/src/linux-source-2.6.27/Documentation/sysctl/.在这种情况下,下面的引用位于该目录中的fs.txt中.使用uname -a命令查找内核版本.
为什么重要:
这可能是安全风险:
所以我的想法是,如果有核心转储并且普通用户可以读取它们,他们可能会发现特权信息.如果程序被很好地转储,它在内存中具有特权信息,并且用户可以读取转储,他们可能会发现该特权信息.
参考:
- This value can be used to query and set the core dump mode for setuid
- or otherwise protected/tainted binaries. The modes are
- 0 - (default) - traditional behavIoUr. Any process which has changed
- privilege levels or is execute only will not be dumped
- 1 - (debug) - all processes dump core when possible. The core dump is
- owned by the current user and no security is applied. This is
- intended for system debugging situations only.
- 2 - (suidsafe) - any binary which normally not be dumped is dumped
- readable by root only. This allows the end user to remove
- such a dump but not access it directly. For security reasons
- core dumps in this mode will not overwrite one another or
- other files. This mode is appropriate when adminstrators are
- attempting to debug problems in a normal environment.