1 Summary
CVE number: CVE-2012-4886
Impact: High
Vendor homepage: http://www.wps.cn
Credit: Zhangjiantao of Hangzhou DPtech Technologies
2 Affected Prodects
Affected Version: http://wdl.cache.ijinshan.com/wps/download/special/WPS2012.12012.exe
The WPS office is a free desktop office suite (compatible with Microsoft office),popular in China.
3 Vulnerability Details
In module wpsio.dll, a BSTR string stored in the file is copied to the stack buffer, without strict length inspection, leading to a stack buffer overflow. This sample exploit this issue to cover an object stored in the stack, leading to crash during the virtual function call. Successfully exploited this vulnerability will lead to arbitrary code execution.
4 Crash info
crash info:
(b70.eb8): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0012c0a4 ebx=770f4b39 ecx=90909090 edx=0012be00 esi=0012c0a4 edi=0018bd54
eip=45e25208 esp=0012bdec ebp=0012bdf8 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00210246
wpsio!TxExport+0x37b1:
45e25208 ff5114 call dword ptr [ecx+14h] ds:0023:909090a4=????????
Second time,copy the same string, placed after the first string. var_234 is the length of the string. Total copy 0x2e0 bytes.
After copy,return address and SEH record has been overwritten.
0:000> k
ChildEBP RetAddr
WARNING: Stack unwind information not available. Following frames may be wrong.
0012c070 90909090 wpsio!TxExport+0xb3e1
0012c148 45e2a113 0x90909090
0:000> !exchain
0012c064: 90909090
Invalid exception stack at 90909090
The source data of memcpy is from the file poc.wps,offset 0x41d7.
6 Exploit
As described above, using a suitable data overwrite SEH record or return address, eip is controllable.
So,We think this is a security vulnerability.