<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="chinese">
	<id>https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=Microsoft_Excel_2007_SP2%E7%B7%A9%E8%A1%9D%E5%8D%80%E8%A6%86%E8%93%8B%E6%BC%8F%E6%B4%9E</id>
	<title>Microsoft Excel 2007 SP2緩衝區覆蓋漏洞 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=Microsoft_Excel_2007_SP2%E7%B7%A9%E8%A1%9D%E5%8D%80%E8%A6%86%E8%93%8B%E6%BC%8F%E6%B4%9E"/>
	<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=Microsoft_Excel_2007_SP2%E7%B7%A9%E8%A1%9D%E5%8D%80%E8%A6%86%E8%93%8B%E6%BC%8F%E6%B4%9E&amp;action=history"/>
	<updated>2026-04-13T16:27:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://pwnwiki.com/index.php?title=Microsoft_Excel_2007_SP2%E7%B7%A9%E8%A1%9D%E5%8D%80%E8%A6%86%E8%93%8B%E6%BC%8F%E6%B4%9E&amp;diff=716&amp;oldid=prev</id>
		<title>Pwnwiki: Created page with &quot;==EXP== &lt;pre&gt; Abysssec Research  1) Advisory information    Title             :  Microsoft Excel 2007 SP2 Buffer Overwrite Vulnerability   Analysis          :  Abysssec.com...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=Microsoft_Excel_2007_SP2%E7%B7%A9%E8%A1%9D%E5%8D%80%E8%A6%86%E8%93%8B%E6%BC%8F%E6%B4%9E&amp;diff=716&amp;oldid=prev"/>
		<updated>2021-03-27T03:25:47Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==EXP== &amp;lt;pre&amp;gt; Abysssec Research  1) Advisory information    Title             :  Microsoft Excel 2007 SP2 Buffer Overwrite Vulnerability   Analysis          :  Abysssec.com...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==EXP==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Abysssec Research&lt;br /&gt;
&lt;br /&gt;
1) Advisory information&lt;br /&gt;
&lt;br /&gt;
  Title             :  Microsoft Excel 2007 SP2 Buffer Overwrite&lt;br /&gt;
Vulnerability&lt;br /&gt;
  Analysis          :  Abysssec.com&lt;br /&gt;
  Vendor            :  http://www.microsoft.com&lt;br /&gt;
  Impact            :  Critical&lt;br /&gt;
  Contact           :  info [at] abysssec.com&lt;br /&gt;
  Twitter           :  @abysssec&lt;br /&gt;
&lt;br /&gt;
Microsoft :&lt;br /&gt;
A remote code execution vulnerability exists in the way that Microsoft&lt;br /&gt;
Excel handles specially crafted Excel files.&lt;br /&gt;
An attacker who successfully exploited this vulnerability could take&lt;br /&gt;
complete control of an affected system.&lt;br /&gt;
An attacker could then install programs; view, change, or delete data;&lt;br /&gt;
or create new accounts with full user rights.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
each excel file can contain multiple  BOF (2057) records . This record&lt;br /&gt;
specifies the first substream associated with workbook.&lt;br /&gt;
One of the fields in these records, specify substream recordd to come&lt;br /&gt;
with. This field can be extracted from sub_3018F0C2 function.&lt;br /&gt;
&lt;br /&gt;
.text:301A0C87                 push    [ebp+arg_2C]&lt;br /&gt;
.text:301A0C8A                 mov     ecx, [ebp+var_14]&lt;br /&gt;
.text:301A0C8D                 push    1&lt;br /&gt;
.text:301A0C8F                 call    sub_3018F0C2&lt;br /&gt;
.text:301A0C94                 mov     ecx, eax&lt;br /&gt;
.text:301A0C96                 mov     eax, [ebp+arg_24]&lt;br /&gt;
.text:301A0C99                 cmp     eax, ebx&lt;br /&gt;
.text:301A0C9B                 mov     [ebp+var_10], ecx&lt;br /&gt;
.text:301A0C9E                 jz      short loc_301A0CA2&lt;br /&gt;
.text:301A0CA0                 mov     [eax], ecx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the field value is equal with 400, sub_3019DFBA function is called to&lt;br /&gt;
check file type. if file type is xls EXCEL.exe will display a message If&lt;br /&gt;
approved it will continue to run the code.if you change file extension&lt;br /&gt;
to xlb there will be any message. After this step sub_3053F626 function&lt;br /&gt;
will be executed. This function will parse the next BOF records.&lt;br /&gt;
&lt;br /&gt;
.text:304D4E9D                 cmp     [ebp+arg_20], ebx&lt;br /&gt;
.text:304D4EA0                 jnz     short loc_304D4EC6&lt;br /&gt;
.text:304D4EA2                 test    dword ptr word_30EDCF9C, 2000000h&lt;br /&gt;
.text:304D4EAC                 jnz     short loc_304D4EC6&lt;br /&gt;
.text:304D4EAE                 mov     edx, [ebp+arg_C]&lt;br /&gt;
.text:304D4EB1                 mov     ecx, [ebp+arg_8]&lt;br /&gt;
.text:304D4EB4                 push    3Fh&lt;br /&gt;
.text:304D4EB6                 call    sub_3019DFBA&lt;br /&gt;
.text:304D4EBB                 cmp     eax, ebx&lt;br /&gt;
.text:304D4EBD                 mov     [ebp+var_8], eax&lt;br /&gt;
.text:304D4EC0                 jz      loc_304D4FD3&lt;br /&gt;
.text:304D4EC6&lt;br /&gt;
.text:304D4EC6 loc_304D4EC6:                           ; CODE XREF:&lt;br /&gt;
sub_301A0BC7+3342D9j&lt;br /&gt;
.text:304D4EC6                                         ;&lt;br /&gt;
sub_301A0BC7+3342E5j&lt;br /&gt;
.text:304D4EC6                 push    ebx&lt;br /&gt;
.text:304D4EC7                 push    dword_30EB89A4&lt;br /&gt;
.text:304D4ECD                 push    [ebp+var_C]&lt;br /&gt;
.text:304D4ED0                 call    sub_3053F626&lt;br /&gt;
.text:304D4ED5                 cmp     dword_30F5E64C, ebx&lt;br /&gt;
.text:304D4EDB                 mov     [ebp+var_8], eax&lt;br /&gt;
.text:304D4EDE                 jz      short loc_304D4EE7&lt;br /&gt;
.text:304D4EE0                 cmp     eax, ebx&lt;br /&gt;
.text:304D4EE2                 jz      short loc_304D4EE7&lt;br /&gt;
&lt;br /&gt;
one of records may come after BOF,is undocumented record which have&lt;br /&gt;
record type equal to 0xA7 (167).&lt;br /&gt;
for truly parsing this record should come with another record with 0x3C&lt;br /&gt;
(60) record type. if it meet this requirement&lt;br /&gt;
the length of records will be read and copied to the stack.&lt;br /&gt;
&lt;br /&gt;
the function which operation of copying data records in the stack is&lt;br /&gt;
sub_30199E55. This function takes three arguments.&lt;br /&gt;
The first argument specifies the number of bytes to copy, which will&lt;br /&gt;
read from file. The second argument specifies the&lt;br /&gt;
destination of the copy and the third argument specifies the maximum&lt;br /&gt;
amount of data can be copied. values of the second&lt;br /&gt;
and third arguments based on the amount of computing reading from file&lt;br /&gt;
and into this cumpoting,computational error which may occur here ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.text:3053F830                 call    sub_301A0A01&lt;br /&gt;
.text:3053F835                 cmp     eax, 3Ch&lt;br /&gt;
.text:3053F838                 mov     [ebp+var_ED4], eax&lt;br /&gt;
.text:3053F83E                 jnz     loc_30540488&lt;br /&gt;
.text:3053F844                 call    sub_301A0A01&lt;br /&gt;
.text:3053F849                 mov     ecx, [ebp+var_EDC]&lt;br /&gt;
.text:3053F84F                 imul    ecx, [ebp+var_F00]&lt;br /&gt;
.text:3053F856                 mov     edi, eax&lt;br /&gt;
.text:3053F858                 mov     eax, [ebp+var_EE0]&lt;br /&gt;
.text:3053F85E                 lea     ebx, [ecx+eax+3]&lt;br /&gt;
.text:3053F862                 call    sub_301A0ABE&lt;br /&gt;
.text:3053F867                 push    0FFFFFFFDh&lt;br /&gt;
.text:3053F869                 pop     edx&lt;br /&gt;
.text:3053F86A                 sub     edx, ecx&lt;br /&gt;
.text:3053F86C                 add     eax, edx&lt;br /&gt;
.text:3053F86E                 push    eax             ; Dst&lt;br /&gt;
.text:3053F86F                 push    ebx             ; int&lt;br /&gt;
.text:3053F870                 mov     eax, edi&lt;br /&gt;
.text:3053F872                 call    sub_30199E55&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 the vulnerability that exists here is that we can change the value of&lt;br /&gt;
parameter 3 whith our own values.&lt;br /&gt;
 program will not correcly controll third argument of sub_30199E55 this&lt;br /&gt;
and can result in the desired&lt;br /&gt;
 amount and location of desired data can overwrite in the stack.&lt;br /&gt;
&lt;br /&gt;
.text:30199E60                 cmp     edi, [esp+4+Dst]&lt;br /&gt;
.text:30199E64                 ja      loc_303EE1B7&lt;br /&gt;
.text:30199E6A                 mov     ecx, [esp+4+arg_0]&lt;br /&gt;
.text:30199E6E                 push    ebx&lt;br /&gt;
.text:30199E6F                 mov     ebx, dword_30F726C0&lt;br /&gt;
.text:30199E75                 push    ebp&lt;br /&gt;
.text:30199E76                 mov     ebp, nNumberOfBytesToRead&lt;br /&gt;
.text:30199E7C                 push    esi&lt;br /&gt;
.text:30199E7D                 mov     [esp+10h+Dst], ecx&lt;br /&gt;
....&lt;br /&gt;
.text:30199E93                 mov     eax, [esp+10h+Dst]&lt;br /&gt;
.text:30199E97                 push    esi             ; Size&lt;br /&gt;
.text:30199E98                 lea     edx, dword_30F6E6B8[ebx]&lt;br /&gt;
.text:30199E9E                 push    edx             ; Src&lt;br /&gt;
.text:30199E9F                 push    eax             ; Dst&lt;br /&gt;
.text:30199EA0                 sub     edi, esi&lt;br /&gt;
.text:30199EA2                 call    memcpy&lt;br /&gt;
.text:30199EA7                 add     [esp+1Ch+Dst], esi&lt;br /&gt;
.text:30199EAB                 add     ebx, esi&lt;br /&gt;
.text:30199EAD                 add     esp, 0Ch&lt;br /&gt;
.text:30199EB0                 test    edi, edi&lt;br /&gt;
.text:30199EB2                 mov     dword_30F726C0, ebx&lt;br /&gt;
.text:30199EB8                 jnz     loc_301E0DB3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Exploiting :&lt;br /&gt;
&lt;br /&gt;
Stack overflows are not hard to exploit at all ! but as we have both /GS&lt;br /&gt;
, SAFESEH here.&lt;br /&gt;
because given that we are destined to memcpy we can change it so that it&lt;br /&gt;
begins to overwrite the stack after GS.&lt;br /&gt;
and from there when the return comes , our values contained in the ESP&lt;br /&gt;
and we can call it with simple call esp and game is over !!!&lt;br /&gt;
&lt;br /&gt;
exploit can be download from here :&lt;br /&gt;
&lt;br /&gt;
http://www.abysssec.com/blog/wp-content/uploads/2011/11/MS11-021.zip&lt;br /&gt;
&lt;br /&gt;
EDB mirror :&lt;br /&gt;
&lt;br /&gt;
http://www.exploit-db.com/sploits/18067.zip&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pwnwiki</name></author>
	</entry>
</feed>