Top Banner
An in depth analysis of CVE-2013-3906 Frank Boldewin
18

An in depth analysis of CVE-2013-3906

Feb 24, 2016

Download

Documents

Rupert

An in depth analysis of CVE-2013-3906. Frank Boldewin. CVE-2013-3906 Description. GDI+ integer overflow in Microsoft Windows Vista SP2 Server 2008 SP2 Office 2003 SP3 Office 2007 SP3 Office 2010 SP1 and SP2 - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An in depth analysis of CVE-2013-3906

An in depth analysis ofCVE-2013-3906

Frank Boldewin

Page 2: An in depth analysis of CVE-2013-3906

2

CVE-2013-3906 Description

GDI+ integer overflow in Microsoft Windows Vista SP2 Server 2008 SP2 Office 2003 SP3 Office 2007 SP3 Office 2010 SP1 and SP2

Allows remote attackers to execute arbitrary code via a crafted TIFF image embedded in a Word document

First seen exploited in the wild in October 2013

http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-3906

Page 3: An in depth analysis of CVE-2013-3906

Infection via mail with MS Office attachment

3

Page 4: An in depth analysis of CVE-2013-3906

Opened docx file looks harmless

4

Page 5: An in depth analysis of CVE-2013-3906

Unzipped docx file – cyrillic characters give hints to its origin

5

Unzipped docx file – evil TIFF image causing the integer overflow

Page 6: An in depth analysis of CVE-2013-3906

Unzipped docx file – ActiveX directory

6

Page 7: An in depth analysis of CVE-2013-3906

ActiveX heap-spraying

New technique introducted for the first time in CVE-2013-3906

Winword performs heap-spray, so no extra code is needed

As usual shellcode is sprayed multiple times in memory by activex.bin

Shellcode uses decryption loop to avoid detection by known patterns

7

Page 8: An in depth analysis of CVE-2013-3906

Officemalscanner decryption loop detection

8

Page 9: An in depth analysis of CVE-2013-3906

Short introduction to the TIFF file format

Created by Aldus and Microsoft in 1986 Widely supported by publishing and page layout

applications for: Faxing Scanning Word processing Character recognition

TIFF files are organized into three sections Image File Header (IFH) Image File Directory (IFD) Bitmap data

9

Page 10: An in depth analysis of CVE-2013-3906

Short introduction to the TIFF file format

Each IFD contains one or more data structures called tags

Tags are identified by its values, e.g. ImageWidth = 256

Each tag has a 12-bytes record, containing infos about the bitmapped data, e.g. Compression type X+Y Resolution StripByteCounts (Important for exploitation!) JPEGInterchangeFormat (Important for exploitation!) JPEGInterchangeFormatLength (Important for

exploitation!)

10

Page 11: An in depth analysis of CVE-2013-3906

Integer Overflow to 0 by adding StripByteCounts values + JPEGInterchangeFormatLength (0x1484) together

11

Page 12: An in depth analysis of CVE-2013-3906

Modified JFIF inside TIFF File (Length 0x1484)

12Take note of the large amount of 08 values !!!

Page 13: An in depth analysis of CVE-2013-3906

Exploit Trace – Calculation and 0-Bytes allocation

13

Page 14: An in depth analysis of CVE-2013-3906

Exploit Trace

Memcpy of JFIF to 0-Bytes allocated HEAP-memory

14

Overwritten vftable from evil JFIF points to address 0x08080808

Page 15: An in depth analysis of CVE-2013-3906

Vftable before and after corruption

15

Page 16: An in depth analysis of CVE-2013-3906

ROP Stage with MSCOMCTL.OCX code to bypass DEP

16

Page 17: An in depth analysis of CVE-2013-3906

Payload decryption in shellcode inside activeX1.bin

17

Encrypted payload

Decrypted payload

Page 18: An in depth analysis of CVE-2013-3906

18

Cheers to

Elia FlorioEP_X0FF

Aleks MatrosovThug4lif3