Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More

Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More

Services
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

Database Security

Prevent unauthorized access and exceed compliance requirements.

Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Microsoft Security
Unlock the full power of Microsoft Security
Offensive Security
Solutions to maximize your security ROI
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats

The Technical Aspects of Exploiting IE Zero-Day CVE-2013-3897

Just two days ago we announced thediscovery of in-the-wild attacks that used the zero-day which is now known as CVE-2013-3897.At that time we also promised to provide a more detailed analysis of theexploit.

Now we have the opportunityto provide a fully and detailed analysis of the vulnerability (CVE-2013-3897) itselfthat has been used by the attacker, and examine the patterns used by theattacker comparing to the previous zero-day attack (CVE-2013-3893).

According to our research a shorter version of this exploitcan be used in order to trigger the same vulnerability.

Let's go over the building blocks of thisattack:

1. Create a TEXTAREA and apply a different element asa child using applyElement. This will place the address elementas the child of the textarea element.

9278_51e86835-d686-481a-93ab-aea35774abdb

2. Trigger a select event on the TEXTAREAelement to create an instance of DisplayPointer.

7899_0de00d62-afbc-4abc-8674-a435b58fe425

3. Inside onselect event change the value propertyof the TEXTAREA element, which in turn will fire the event onpropertychange.For example, usage of appendChild or swapNode will cause this behavior.

12009_d484611b-9fc0-4b7a-af4a-e66485762802

Notice that id_2 ("address" element) is a child ofthe TEXTAREA element. By swapping that element we remove it from layout of "textarea"and insert a different element, therefore the value property changes.

4. The event onpropertychange is triggered

8227_1d951587-031d-4436-afc9-03fb9b221b3c

5. In the next stage we basically need to change the positionof the display pointer within the TEXTAREA layout. In the original exploit document.execCommand("UnSelect")was used. However, selecting a different element, executing the SelectAllcommand or any operation that causes a DisplayPointer position change will alsowork.

 

11035_a536a3d3-d1d3-45c5-9613-a0575a90cce7
The attacker used "UnSelect" command



 

6. The JavaScriptselection causes a call to CDisplayPointer::ScrollIntoView, which tries to seta new position for the DisplayPointer. At this stage, the reference toCMarkupPointer is already released by the CDisplayPointer::Release function (asa result of the "UnSelect" command) and therefore points to an attacker-controlledheap area.

The flow eventually gets into QIClassID, which tries toexecute "CMarkupPointer::QueryInterface" (located at offset 0x0 in CMarkupPointer'svirtual table).

QIClassID:

 

9428_597ba722-fffd-4005-b92b-3d9170616aba
QIClassID disassemble crash point



 

At the crash we end up with the following stack trace:

8538_2e7c6f39-ccdf-4b6b-b7c3-5d5feebc4aba

 

CMarkupPointer freed and then used by QIClassID:

8388_26f4cf50-6c7a-49ac-b17f-5f3371fd2ae5

Samesame but different?

As mentioned in our previous blog, the discovered samplesexploiting CVE-2013-3893 and CVE-2013-3897 share many similarities, a few of themare listed below:

Controlling EIP

The two zero-day exploits use the same technique in order tocontrol the victim EIP – both append a heap-address value to the titleattribute of div elements created inside an array context. Using this techniquethe attacker can override "freed" memory with predefined heap memory address (pointing to the malicious shellcode) which can later be called by EIP.

CVE-2013-3893 code snippet:

12773_f859bab5-3c04-46c6-8925-0432cc81155a

CVE-2013-3897 code snippet:

10176_7cb9646c-2a25-4124-8c47-10a75150605a

'unescape' function

Both exploits use a similar dedicated function that receive hexadecimal values, converts them into a Unicode representation and returns those values decoded.

CVE-2013-3893 code snippet:

12653_f2bdc020-d801-4dc9-85a8-35d6f7ecf3f3

CVE-2013-3897 code snippet:

8147_19ca87be-6396-4e74-8222-636f3e992846

Variable Names

Both zero-day exploits contain similar variables andfunction names.

CVE-2013-3893 code snippet:

10170_7c4e0bfc-ac8e-4ca4-a2c4-cfe8add61d20

CVE-2013-3897 code snippet:

11888_ce60e427-bf41-4585-bf89-56235efa02d7

Despite all the similarities presented above, the malwarethat is used to infect the victims of both attacks seems a lot different. Theoriginal CVE-2013-3893 malware was a sensitive info stealer that targeted financialand technological organizations. The malware that was used by the CVE-2013-3897exploit (as already described) was a banking/online games info stealer.

Moreover, the shellcode used in these attacks is completelydifferent. The exploit for CVE-2013-3893 used a 'simple' download-and-execute shellcode;while the CVE-2013-3897 shellcode is an advanced piece of program that will tryto detect the presence of several Antivirus products.

All of this may suggest that the two exploits were writtenand/or sold by the same cybercriminal group to a different criminal identitythat used the zero-days for completely different purposes.

Trustwave's Secure Web Gateway blocked the known attacks.However we recommend that all users install the latest Microsoft patch (MS13-080)via Windows Update. For cases where theapplication environment is of high importance and risk we recommend usingMicrosoft's EMET toolwhich is capable of mitigating even zero-day exploits like this one. We alsowould like to thank our friends at AhnLab for working with us on notifying the owner of a compromised Koreanwebsite related to this investigation.

Contributors to this post: Daniel Chechik, Ben Hayak and Dan Meged.

ABOUT TRUSTWAVE

Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.

Latest Intelligence

Discover how our specialists can tailor a security program to fit the needs of
your organization.

Request a Demo