Internet Explorer iframe sandbox local file name disclosure vulnerability

Abstract

It was found that Internet Explorer allows the disclosure of local file names. This issue exists due to the fact that Internet Explorer behaves different for file:// URLs pointing to existing and non-existent files. When used in combination with HTML5 sandbox iframes it is possible to use this behavior to find out if a local file exists. This technique only works on Internet Explorer 10 & 11 since these support the HTML5 sandbox. Also it is not possible to do this from a regular website as file:// URLs are blocked all together. The attack must be performed locally (works with Internet zone Mark of the Web) or from a share.

See also

Tested versions

This issue was successfully verified on Internet Explorer 10 and Internet Explorer 11. The HTML5 sandbox iframes is not available in older versions of Internet Explorer.

Fix

Microsoft released MS16-095 that fixes this vulnerability.

Introduction

The Internet Explorer Local Machine Zone Lockdown restricts the use of file:// URLs. When file:// URLs are used in combination with HTML5 sandbox iframes it is possible to use this behavior to find out if a local file exists.

Details

Internet Explorer behaves different for file:// URLs pointing to existing and non-existent files. For example when trying to open the URL file:///windows/system32/calc.exe Internet Explorer, Internet Explorer will show the following error dialog:

Figure 1: error dialog shown for existing file

However in case a URL is opened pointing to a non-existent file, Internet Explorer will not show this dialog. Instead it will try to open the page res://ieframe.dll/dnserrordiagoff.htm - which may be blocked by IE's Pop-up Blocker.

This behavior exists in (at least) Internet Explorer 6 SP3 up to and including Internet Explorer 11 and can be used to test if a local file exist or not. In order to find whether a local file exists, it is possible to use the HTML5 sandbox iframe. The sandbox will suppress the error dialog & the onload event handler can be used to find out if a file exists. If the file exists, the onload event will not fire. If the file doesn't exist, the onload event does fire. This allows us to find out whether a local file exists on the system:

  • create an iframe with the sandbox attribute set.
  • load a file:// URL in the iframe.
  • use the onload event to find out if a file exists or not.

This technique only works on Internet Explorer 10 & 11 since these support the HTML5 sandbox. Also it is not possible to do this from a regular website as file:// URLs are blocked all together. So it must be performed locally (works with Internet zone Mark of the Web) or from a share.

Proof of concept

ie_sandbox_findfiles.rb

Questions or feedback?