Home > Ask the Software Quality Experts > Questions & Answers > Binary over JPEG
Ask The Software Quality Expert: Questions & Answers
EMAIL THIS

Binary over JPEG

Michael Cobb EXPERT RESPONSE FROM: Michael Cobb

Pose a Question
Other Software Quality Categories
Meet all Software Quality Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 28 November 2005
Can you please explain "binary over JPEG" -- the mechanism for transferring a Trojan horse code by hiding it in a JPEG image, to be activated when the user downloads the image? I'm familiar with x86 assembler, and with the JPEG format, but do not understand how such code "comes alive" when the passive JPEG image is opened.

>
EXPERT RESPONSE
Many Microsoft products, including the Office Suite programs, Internet Explorer, Windows XP and Windows Server 2003, use a dynamic link library (DLL) file called GDIPlus.dll. It contains libraries for the Graphical Device Interface Plus (GDI+) application programming interface (API). This allows programmers to represent graphical objects and transmit them to output devices, such as monitors and printers. This DLL includes the capability to process JPEG image files. Sadly, the way it handles malformed JPEG images can cause a heap-based buffer overflow. Heap-based buffer vulnerabilities occur if the unchecked copy of data is written to a buffer that is located on the heap. This allows non-executable stack protection mechanisms to be bypassed, leaving the system vulnerable.

In this instance, the overflow arises because the DLL normalizes the declared length of the area designed for comments in a JPEG file prior to checking its value. This area can store up to 65,533 bytes of data, but takes up only two bytes if no comment is added to the image. If the malicious hacker sets the comment length value to 1 or 0, it will result in a heap-based overflow, overwriting the heap management structures. This allows the hacker to point the next process to code they wish to run, which ironically they can store in the comment area of the JPEG file!

In order to exploit the flaw, an attacker only needs the victim to view the doctored JPEG image. This file is typically sent in an HTML e-mail or displayed on a Web site. The JPEG image can also be embedded in a Word, PowerPoint or other Microsoft Office document. Once viewed, the embedded Trojan horse code will run on the infected system with the privileges of the application that opened the JPEG file. This vulnerability was announced in September 2004 and due to its severity, Microsoft released a patch very quickly to correct the problem. It is covered in Microsoft Security Bulletin MS04-028 "Buffer Overrun in JPEG Processing (GDI+) Could Allow Code Execution (833987)".

You can download the file containing the source code for a proof-of-concept at http://www.macconvert.com/archives/docs/JPEGdownloader.doc.sitx. This should help you understand how the attack works.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Threat modeling
Web application security and the PCI DSS
The essentials of Web application threat modeling
How to implement security in Java EE and Java ME
Application security shouldn't involve duct tape, Band-Aids or bubble gum
Stop SQL injection attacks on applications
How to counter XSS attacks
Breaking the same origin barrier of JavaScript
Protection against "zero-minute" exploits
Denial of service and Ajax
CSRF attack vector with Ajax serialization

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Software Quality - Software Maintenance, Software Requirements, Software Standards
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2006 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts