BugTraq
MSIE 9-11 MSHTML PROPERTYDESC::HandleStyleComponentProperty OOB read details Nov 09 2016 08:44PM
Berend-Jan Wever (berendj nwever nl)
Throughout November, I plan to release details on vulnerabilities I
found in web-browsers which I've not released before. This is the
seventh entry in that series.

The below information is available in more detail on my blog at
http://blog.skylined.nl/20161109001.html. There you can find a repro
that triggered this issue in addition to the information below.

Follow me on http://twitter.com/berendjanwever for daily browser bugs.

MSIE 9-11 MSHTML PROPERTYDESC::HandleStyleComponentProperty OOB read
====================================================================
(MS16-104, CVE-2016-3324)

Synopsis
--------
A specially crafted web-page can cause Microsoft Internet Explorer to
assume a CSS value stored as a string can only be `"true"` or `"false"`.
To determine which of these two values it is, the code checks if the
fifth character is an `'e'` or a `"\0"`. An attacker that is able to set
it to a smaller string can cause the code to read data out-of-bounds and
is able to determine if a `WCHAR` value stored behind that string is
`"\0"` or not.

Known affected versions, attack vectors and mitigations
-------------------------------------------------------
* MSIE 9-11 (earlier versions were not tested)

An attacker would need to get a target user to open a specially
crafted webpage. Disabling JavaScript should prevent an attacker from
triggering the vulnerable code path.

Description
-----------
Certain code that handles CSS properties in MSIE assumes that the
property value is always a string set to either `"true"` or `"false"`.
To determine which of these two values it is, the code checks if the
fifth character is `'\0'`. However, it is possible to set such values to
arbitrary strings, including a smaller string. This causes the code to
read beyond the end of the string and allows an attacker to determine if
an WORD stored after the string is `'\0'`.

The vulnerable code is in
`MSHTML!PROPERTYDESC::HandleStyleComponentProperty`.
This code is heavily branched to handle various types of CSS properties.
Luckily, the type being exploited is one of the first to be handled. The
code appears to assume that the value is provided as a pointer to a
`BSTR` which will always have a `WCHAR` at offset +8 that may be `'\0'`
or not. If this `WCHAR` is not `'\0'`, a CSS property is set to a
certain value, otherwise it is set to an empty string. As long as this
`BSTR` is always either be `"true"` or `"false"`, this code works as
expected. However, it is possible to provide an arbitrary value for this
`BSTR`, which can be shorter than 4 `WCHARs`. This would causing the
code to read a `WCHAR` outside of the memory used to store that `BSTR`.

Known properties of the type that leads to the vulnerable code path
include `textDecorationBlink`, `textDecorationLineThrough`,
`textDecorationLineNone`, `textDecorationOverline`, and
`textDecorationUnderline`.

Exploit
-------
The value of a CSS property is updated based on the value of the fifth
`WCHAR`, and this CSS property can be read from Javascript to determine
if this `WCHAR` was `'\0'` or not. This allows a limited form of
information disclosure. During my testing, I used the
`textDecorationBlink` property, which can be used to set the CSS
`text-decoration` property to `"blink"` or an empty string.

Using Heap-Feng Shui, it may be possible to reuse memory allocated for
other strings that have since been freed and determine if they had a
`'\0'` `WCHAR` as their fifth character. This includes strings to should
normally not be accessible to the website, such as those from a
different origin. Also using Heap Feng-Shui, it may be possible to
allocate some interesting object immediately following the string, in
order to determine if a `WORD` at the start of that object is 0 or not.

Time-line
---------
* Februari 2016: This vulnerability was found through fuzzing.
* Februari 2016: This vulnerability was submitted to ZDI, iDefense
and EIP.
* March-July 2016: ZDI, iDefense and EIP all either reject the
submission or fail to respond.
* July 2016: This vulnerability was reported to Microsoft with a
60-day deadline to address the issue.
* August 2016: Microsoft is granted an 11 day extension to the
deadline to address it in September's Patch Tuesday.
* September 2016: The vulnerability was address by Microsoft in
MS16-104.

Cheers,

SkyLined
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mQINBFeg3+kBEACfJ83XEx+3CXfc2pyDlZ5+DFSvhdvbSvemqEckOtrQxTYOmH/8
6WrX2B7K6eyolLCIQMi0FjXK5hjJJFYTMrhoa7pP9V9PD2f4TI+tZv+g0D8wDVam
wYsZrFB6NwzyUaBykjj4chYxxzUxTwagwCxvrGNY871tiVWV5eR3TrKRcsFwzN53
G3lhAT974YRCIBMuA6y+3Jrd8hgfODWUtYsH4WPhaLJRr9qaatN+Fnpk+rb9X62C
EqcVXhgNeIz1j/K3I3XoHqMThNu5zbv7uQrp2j+/0fZjKXxZ7HZhTKzIFTrJkrTA
jQ34iq0qgXmLltpKtOLJKhPQPb8J/N0MxOOTa34BDeSiqwlcRzkl7lYTIl7hvvCn
lSRbu+PoA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CvkqXIfVu6DTu7SFtQgBkFkuWFekDsW1KqqAmTecyrF5y/DDMh1nPKzZJzRhTS
NYayevzsVgClyhDnqF6Mx4NXnsg1D6Xo6l6O8H1ndihErTSp0oKFLC4JE4mhrZn3
cxNFHOgZZuWFtPyOzRp1z9PdhAkgIdwgiQBlYtwAchJxK+e5NI0/3yxp3RRLNhvd
8Nx8tqISk76zsfH5T32L
=HXKf
-----END PGP SIGNATURE-----

[ reply ]


 

Privacy Statement
Copyright 2010, SecurityFocus