The summer is officially over and I hope yours has been as fun as mine. I didn’t go to Blackhat or DefCon this year, so I hope the rest of you had a good time for me. As for this site, it’s time to start writing some articles again :)

Ronald van den Heetkamp has posted an article about about what he calls Firefox Remote Variable Leakage. It’s not a very long article but it does highlight a very simple concept, namely that of data leakage through URL protocols (see Bugzilla #292789).

A web page is comprised of a lot more than simply text. Images, style sheets, Javascript and Flash movies are just some of the many embeddable data types. As a browser vendor you have to consider a lot of specific factors for each of these data types and their embedding container element to prevent undesired side effects, such as what mime types the element can reference and use, what data is exposed to script and what data channels, such as specific URL protocols, it is allowed to retrieve data from.

The majority of request verification in browser such as Internet Explorer or Firefox is handled by the same basic code which tends to look at two things, the location of the requesting container and the location of the requested data. From there it trails off in different directions that are mainly influenced by the browsers own application design.

Internet Explorer uses the concept of security zones to differentiate between content privileges, with e.g. the Internet Zone being restricted and the My Computer zone being (historically) unrestricted. Firefox determines the content privileges based on its executing URL protocol origin, with e.g. http:// content being restricted and chrome:// content being unrestricted.

Both of these approaches are implemented with a patchwork of special cases developed over the years in the form of whitelists, blacklists and exceptions. As an example, Internet Explorer still allows you to link to res:// data (resources in system DLL files) from any page in any security zone because it is a fundamental building block of its error page implementation, but it doesn’t allow you to read the data. Likewise, Firefox allows you to reference chrome:// data (resources in the browsers XUL and extensions) from certain elements because it is a fundamental building block of its user interface.

And that’s where the current problem lies in Firefox. It prevents you from linking to chrome content from http content, such as by navigating an IFRAME to a chrome URL, but it will happily let you read chrome content from http content by parsing script files and displaying image data – which is the exact opposite behavior from that displayed by Internet Explorer.

But is it dangerous? The short answer is, it depends.

Since Firefox has based their security model on the executing URL protocol origin it shouldn’t matter if you can include script data from the chrome URL protocol on your web page. It is simply read as a piece of text and then executed with the privileges of your http content, which is very low, so even if your chrome script references the nsIProcess interface the script is now being executed with your lower privileges and will simply fail.

It does matter, however, when you can include chrome data that contains sensitive user data. Firefox extensions are all comprised of XUL that is exposed to the browser through the chrome protocol, and as such any data files in the extension can be read from http content. The severity of this data leakage depends on the how the extension has been implemented.

Ronald posted some comments on RSnake’s blog where he hints at having found some problems in the FoxyProxy extension in that it stores usernames and passwords in chrome accessible locations.

It might also matter if your chrome data triggers any actions based on the request itself, such as querying a database or reading files, but I can’t think of any situation where that currently happens.

And speaking about data leakage through script, here is a little bonus from me to you – a data leakage vulnerability that was quietly fixed in Safari 3.01 without being mentioned in the release notes :)

Safari 3.0 will let you iterate the window object of an IFRAME and reveal the names of any global variables or functions, even if the document inside the IFRAME is on a foreign host and cross domain scripting checks should have prevented it.

<textarea id=”output”></textarea>
function snurf(){
var s=”", i;
for(i in frames[0]) try{ s+= i + “,” } catch(e){};
document.getElementById(“output”).value = s;
<iframe src=”” onload=”snurf()”></iframe>

The above will simply iterate the window object and display any variables that it has found. Internet Explorer, Firefox, Opera and Safari 3.01 will not display any sensitive data. Safari 3.0 will happily display the presense of the qs, sf and google functions and object :)