Sony PC Companion 2.1 (Load()) Stack-based Unicode Buffer Overload SEH

Title: Sony PC Companion 2.1 (Load()) Stack-based Unicode Buffer Overload SEH
Advisory ID: ZSL-2012-5118
Type: Local/Remote
Impact: System Access, DoS
Risk: (4/5)
Release Date: 20.12.2012
Summary
PC Companion is a computer application that acts as a portal to Sony Xperia and operator features and applications, such as phone software updates, management of contacts and calendar, media management with Media Go, and a backup and restore feature for your phone content.
Description
The vulnerability is caused due to a boundary error in PimData.dll when handling the value assigned to the 'File' item in the Load function and can be exploited to cause a stack-based buffer overflow via an overly long string which may lead to execution of arbitrary code on the affected machine.

--------------------------------------------------------------------------------

STATUS_STACK_BUFFER_OVERRUN encountered
(59c.162c): Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=5f392b80 ecx=75b1de28 edx=0019dd59 esi=00000000 edi=002891c4
eip=75b1dca5 esp=0019dfa0 ebp=0019e01c iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
KERNEL32!FormatMessageA+0x13c85:
75b1dca5 cc int 3
0:000> !exchain
0019e00c: KERNEL32!RegSaveKeyExA+3e9 (75b49b72)
Invalid exception stack at 00420042
0:000> d edi
002891c4 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
002891d4 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
002891e4 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
002891f4 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
00289204 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
00289214 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
00289224 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
00289234 41 00 41 00 41 00 41 00-41 00 41 00 41 00 41 00 A.A.A.A.A.A.A.A.
0:000>

--------------------------------------------------------------------------------

Vendor
Sony Mobile Communications AB - http://www.sonymobile.com
Affected Version
2.10.115 (Production 27.1, Build 830)
2.10.108 (Production 26.1, Build 818)
Tested On
Microsoft Windows 7 Ultimate SP1 (EN) 32bit
Vendor Status
[09.11.2012] Vulnerability discovered in version 2.10.108 (Production 26.1, Build 818).
[15.11.2012] Contact with the vendor.
[16.11.2012] Vendor responds asking more details.
[18.11.2012] Sent detailed information to the vendor.
[21.11.2012] Asked vendor for status update.
[21.11.2012] Vendor is investigating the issue.
[30.11.2012] Vendor confirms the vulnerability.
[30.11.2012] Working with the vendor.
[03.12.2012] Version 2.10.115 (Production 27.1, Build 830) is released, still vulnerable.
[05.12.2012] Asked vendor for status update.
[06.12.2012] Vendor investigates, promising to share an update soon.
[12.12.2012] Asked vendor for scheduled patch release date.
[17.12.2012] No reply from vendor.
[18.12.2012] Asked vendor for status update.
[19.12.2012] No reply from vendor.
[19.12.2012] Notified the vendor that the advisory will be published on 20th of December.
[20.12.2012] Vendor promises patch in the first quarter of 2013.
[20.12.2012] Public security advisory released.
[29.01.2013] Vendor releases version 2.10.136 (Production 28) to address this issue.
PoC
sonypccompanion2_bof.txt
Credits
Vulnerability discovered by Gjoko Krstic - <gjoko@zeroscience.mk>
References
[1] http://www.sonymobile.com/gb/tools/pc-companion/
[2] http://www.securityfocus.com/bid/57016
[3] http://cxsecurity.com/issue/WLB-2012120166
[4] http://www.exploit-db.com/exploits/23567/
[5] http://www.osvdb.org/show/osvdb/88628
[6] http://xforce.iss.net/xforce/xfdb/80774
[7] http://packetstormsecurity.org/files/119022
Changelog
[20.12.2012] - Initial release
[21.12.2012] - Added reference [3] and [4]
[22.12.2012] - Added reference [5] and [6]
[23.12.2012] - Added reference [7]
[04.02.2013] - Added vendor status
Contact
Zero Science Lab

Web: http://www.zeroscience.mk
e-mail: lab@zeroscience.mk