Products::Security::Contact

GreyMagic Security Advisory GM#002-OP

By GreyMagic Software, Israel.
04 Feb 2003.

Topic: Opera's Security Model is Highly Vulnerable.

Discovery date: 14 Nov 2002.

Affected applications:

Opera 7 (final).

Introduction:

Opera recently released a new version of its browser.

Version 7 brings many long-awaited features such as proper DOM support and an improved rendering engine. However, Opera seems to have neglected one of the most important aspects in any browser today, its default cross-domain security model.

Discussion:

All browsers with Javascript deploy a cross-domain security model, which, in essence, attempts to prevent documents from one domain to access other documents in different domains.

Opera 7 deployed a fundamentally different approach to cross-domain security, a caller-based model, rather than the origin-based model deployed in other browsers. The vulnerability is comprised of three different flaws in that model:

The first flaw means that a window in one domain is able to execute functions in a window that's in a different domain. This flaw in itself is not a big threat because of the second flaw, which means that even if a function in the victim window is executed, it is executed with the attacker's credentials, and therefore unable to access the victim's document.

The second flaw means that if the attacker can get the victim to execute a function, it will run under the victim's credentials. And because of the first flaw, the victim will have no problems accessing a malicious function created by the attacker.

The third, and most devastating flaw means that the attacker is able to trojanize native methods in the victim window with his own code and simply wait for the victim to execute it.

With these three flaws combined, it becomes extremely easy to exploit any document that uses some scripting, including local resources in the file:// protocol. Being able to access local resources in Opera means that the attacker would be able to:

Exploit:

A perfect candidate for exploitation is Opera's own Javascript console, which arrives in the form of three separate files in Opera's installation directory.

The file "console.html" makes a very early call to the native method "setInterval", which can be overridden by an attacking window. This scenario does not require any user interaction.

<script language="jscript">
var oWin=open("file://localhost/console.html","","");
oWin.setInterval=function () {
    alert("Access to local resource achieved: "+oWin.document.location.href);
}
</script>

The "file://localhost/" URL appearing in this sample is a convenient method provided by Opera in order to access the selected directory (Opera's home by default).

Demonstration:

We put together two proof-of-concept demonstrations:

Solution:

Opera was notified of a variation of this issue on 14-Nov-2002, but appareantly failed to understand the core issues and only patched one symptom of the problem (it was possible for foreign windows to simply set event handlers in Beta 1).

In the meantime, until a patch becomes available, disable Javascript by going to: File -> Preferences -> Multimedia, and uncheck the "Enable JavaScript" item.

Credits:

Many thanks to Tom Gilder for his excellent help in researching this vulnerability.

Tested on:

Opera 7 NT4.
Opera 7 Win98.
Opera 7 Win2000.
Opera 7 WinXP.

Disclaimer:

The information in this security advisory and any of its demonstrations is provided "as is" without warranty of any kind.

Vulnerability details are provided strictly for educational and defensive purposes.

GreyMagic Software is not liable for any direct or indirect damages caused as a result of using the information or demonstrations provided in any part of this advisory.

Stay informed:

Subscribe to GreyMagic's early notification email service and be informed of new vulnerabilities and updates as soon as they appear on the site.

Press here to subscribe.

Your privacy is important to us, read our Privacy Statement.

Copyright © 2008 GreyMagic Software
Hosted by VPW Systems UK - Specialist Internet Services Provider