XML Injection and Information Disclosure Vulnerability in Microsoft Windows 8.1 XMLDOM ActiveX control

CVE-2013-7331 (internet_explorer, windows_8, windows_8.1)

Vulnerability Summary for CVE-2013-7331
Original release date:02/26/2014
Last revised:02/27/2014

The Microsoft.XMLDOM ActiveX control in Microsoft Windows 8.1 and earlier allows remote attackers to determine the existence of local pathnames, UNC share pathnames, intranet hostnames, and intranet IP addresses by examining error codes, as demonstrated by a res:// URL, and exploited in the wild in February 2014.

CVSS Severity (version 2.0):
CVSS v2 Base Score:5.8 (MEDIUM)
Impact Subscore:
Exploitability Subscore:

CVSS Version 2 Metrics:
Access Vector: Network exploitable; Victim must voluntarily interact with attack mechanism
Access Complexity: Medium
Authentication: Not required to exploit
Impact Type:Allows unauthorized disclosure of information; Allows disruption of service

References to Advisories, Solutions, and Tools
US-CERT Vulnerability Note: VU#539289
Name: VU#539289
Hyperlink: http://www.kb.cert.org/vuls/id/539289

External Source: MISC
Name: https://soroush.secproject.com/blog/2013/04/microsoft-xmldom-in-ie-…
Hyperlink: https://soroush.secproject.com/blog/2013/04/microsoft-xmldom-in-ie-…

External Source: MISC
Name: http://www.fireeye.com/blog/uncategorized/2014/02/operation-snowman…
Hyperlink: http://www.fireeye.com/blog/uncategorized/2014/02/operation-snowman…

Microsoft Windows 8.1 XMLDOM XML Injection Vulnerability

While I was testing a XML Injection vulnerability, I became interested in the W3Schools DTD Validator example that can only work in IE: http://www.w3schools.com/dtd/dtd_validation.asp. As a result, after I finished my testing, I started playing with this Microsoft XMLDOM object to see if it is vulnerable.

I created the following test case to manipulate the “$target$” value and validate it to see the results:
validateXML('<?xml version="1.0" ?><!DOCTYPE anything SYSTEM "$target$">')

function validateXML(txt) {
// code for IE
if (window.ActiveXObject) {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = true;
try {
if (xmlDoc.parseError.errorCode != 0) {
var err;
err = "Error Code: " + xmlDoc.parseError.errorCode + "\n";
err += "Error Reason: " + xmlDoc.parseError.reason;
err += "Error Line: " + xmlDoc.parseError.line;
var errReason = xmlDoc.parseError.reason.toLowerCase();
} else {
alert('No Error? Unknown!')
} catch (e) {

} else {
alert('you need to use IE')

You can see this JS in action via this link in IE: http://jsfiddle.net/ubqug/
Detecting files in the C drive:

I tried different local file paths to see if I can include a file from the local file system. The results of the following test cases are the same &#8211; &#8220;Access is denied.&#8221;:



See this link: http://jsfiddle.net/ubqug/1/

I thought I might be able to use &#8220;\\localhost&#8221; or &#8220;\\; instead of using &#8220;file&#8221; protocol:

$target$ = \\\c$\windows\system32\calc.exe

$target$ = \\\c$\windows\system32\invalid.exe

The result was the same again; however, I did not receive an &#8220;access denied&#8221; error this time! See this link: http://jsfiddle.net/ubqug/2/

At this point, I used Sysinternals Suite Process Monitor to monitor the file system and I realised that in the previous example, it was looking for &#8220;c$&#8221; folder in the C drive!

Therefore, I removed &#8220;c$&#8221; from my targets and ran the test again:

$target$ = \\\windows\system32\calc.exe

$target$ = \\\windows\system32\invalid.exe

The result was promising as I received &#8220;Unspecified error&#8221; for the file that was available on my file system. See this: http://jsfiddle.net/ubqug/3/

So, I found my first bypass to detect available files on the C drive.

I also found more vectors to find files on the C drive and it turned out that I can get the same result by using &#8220;file:\&#8221; and &#8220;file:\\localhost\&#8221; instead of &#8220;file:\\&#8221;! See this link: http://jsfiddle.net/ubqug/4/
Detecting valid folders in C drive:

It was possible to find the valid folders on C drive by using the same technique as the error messages were a little bit different in case of having a valid or an invalid folder:

$target$ = \\localhost\windows\

$target$ = \\localhost\invalidfolder\

Try it in: http://jsfiddle.net/ubqug/6/ &#8211; in case of an invalid folder the message will be: &#8220;the system cannot locate the object &#8230;&#8221;. When a folder is valid we will have: &#8220;the system cannot find the path &#8230;&#8221;

I also found out if I use NTFS ADS (Alternate Data Streams) that are related to files and not the directories such as &#8220;::$DATA&#8221; I would receive different error messages to detect the valid folders (&#8220;access denied&#8221; versus the &#8220;the system cannot locate the object &#8230;&#8221;):

$target$ = \\localhost\windows::$DATA

$target$ = \\localhost\invalidfolder::$DATA

See the result in this link: http://jsfiddle.net/ubqug/7/
Detecting files and directories in all drives:

At this point during my testing, I had a limitation and I could not detect my files in any drive other than the C drive by using the previous vectors. Vectors like &#8220;file:/e:/&#8221; or &#8220;\\localhost\e$&#8221; did not work.

I solved this problem by using &#8220;res://&#8221; protocol (http://msdn.microsoft.com/en-us/library/aa767740(v=vs.85).aspx) and I received different error messages by pointing to the files or folders.

$target$ = res://d:\validfile.txt

$target$ = res://d:\invalidfile.txt

See the results here (you need to create the &#8220;validfile.txt&#8221; file in your D drive or change the path): http://jsfiddle.net/ubqug/5/
Detecting available drives:

In order to make the results more accurate, I had to find the available drive letters on the box. Unfortunately &#8220;res://&#8221; protocol was not helpful in this case and I had to use another solution. The solution that I found was in fact very easy. I could use the drive letters directly; if the drive letter is available, the error message would be &#8220;access denied&#8221; and when it is not available, the error message changes to &#8220;the system cannot find the path specified&#8221;:

$target$ = c:\

$target$ = invalid:\

See the results in http://jsfiddle.net/ubqug/8/
Detecting available Windows internal network addresses or internal websites:

During my tests, I realised that I can send http request to local sites or IP addresses, and I can point to network shares as well. In this case, it would give me an error immediately if the target was valid. However, it could take between 10 to 60 seconds to come back with an error when it could not receive a response from the target! I used this technique to detect valid local IP/Name addresses. However, as it does take a long time to identify an invalid target, it is not appropriate for scanning.
Denial of Service:

Like many other DTD parsers, XMLDOM object was also vulnerable to denial of service. I did not even try hard to find the issue and I used an example in the following link from MSDN Magazine:


I have created a PoC page to test the above techniques in one page which can be found via: http://0me.me/demo/IE/dtdTest.html

I also searched in Google and I found out that the general topic of these issues have been mentioned in the following link from Microsoft:


See the &#8220;Threats and Mitigation&#8221; section in the link above.

At the moment this issue is a client side issue and only works in IE. I published it as the impacts are low (limited information disclosure vulnerability) and you cannot read the file contents with the vectors that I have found (only worthless local DTD files are partially readable). However, this research can be very valuable to people who are looking for the new vectors in finding/exploiting XML vulnerabilities (for example in Java &#8211; I do not have time to test this at the moment) &#8211; obviously in legal and legitimate research/pentest projects 😉