exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

toStaticHTML HTML Sanitizing Bypass

toStaticHTML HTML Sanitizing Bypass
Posted Jul 11, 2012
Authored by Adi Cohen | Site blog.watchfire.com

The *toStaticHTML* component, which is found in Internet Explorer versions greater than 8, SharePoint and Lync is used to sanitize HTML fragments from dynamic and potentially malicious content. An attacker is able to create a specially formed CSS that will overcome * toStaticHTML*'s security logic; therefore, after passing the specially crafted CSS string through the *toStaticHTML* function, it will contain an expression that triggers a JavaScript call.

tags | exploit, javascript, xss
advisories | CVE-2012-1858
SHA-256 | 250fdc51b42fbad45e46c18cf75919ff7aaf7e27a4da2764383c71b6233a3cdb

toStaticHTML HTML Sanitizing Bypass

Change Mirror Download
toStaticHTML: The Second Encounter (CVE-2012-1858)

*HTML Sanitizing Bypass -
*CVE-2012-1858<http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-1858>

Original advisory -
http://blog.watchfire.com/wfblog/2012/07/tostatichtml-the-second-encounter-cve-2012-1858-html-sanitizing-information-disclosure-introduction-t.html

Introduction

The *toStaticHTML* component, which is found in Internet Explorer > 8,
SharePoint and Lync is used to sanitize HTML fragments from dynamic and
potentially malicious content.

If an attacker is able to break the filtering mechanism and pass malicious
code through this function, he/she may be able to perform HTML injection
based attacks (i.e. XSS).

It has been a year since the first
encounter<http://blog.watchfire.com/wfblog/2011/07/tostatichtml-html-sanitizing-bypass.html>
was
published, we've now returned with a new bypass method.

Vulnerability

An attacker is able to create a specially formed CSS that will overcome *
toStaticHTML*'s security logic; therefore, after passing the specially
crafted CSS string through the *toStaticHTML* function, it will contain an
expression that triggers a JavaScript call.

The following JavaScript code demonstrates the vulnerability:

*<script>document.write(toStaticHTML("<style>
div{font-family:rgb('0,0,0)'''}foo');color=expression(alert(1));{}
</style><div>POC</div>"))</script>*

In this case the function's return value would be JavaScript executable:

*<style>
div{font-family:rgb('0,0,0)''';}foo');color=expression(alert(1));{;}</style>
<div>POC</div>*



The reason this code bypasses the filter engine is due to two reasons:

1. The filtering engine allows the string "expression(" to exists in
"non-dangerous" locations within the CSS.
2. A bug in Internet Explorer's CSS parsing engine doesn't properly
terminate strings that are opened inside brackets and closed outside of
them.

When combining these two factors the attacker is able to "confuse" the
filtering mechanism into "thinking" that a string is open when in fact it
is terminated and vice versa. With this ability the attacker can trick the
filtering mechanism into entering a state of the selector context which is
considered safer where in fact the code is just a new declaration of the
same selector, thus breaking the state machine and bypassing the filter.



Impact

Every application that relies on the *toStaticHTML* component to sanitize
user supplied data had probably been vulnerable to XSS.



Remediation

Microsoft has issued several updates to address this vulnerability.

MS12-037 - http://technet.microsoft.com/en-us/security/bulletin/ms12-037

MS12-039 - http://technet.microsoft.com/en-us/security/bulletin/ms12-039

MS12-050 - http://technet.microsoft.com/en-us/security/bulletin/MS12-050
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    0 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close