From security@greymagic.com Wed Feb 5 17:03:29 2003 From: GreyMagic Software To: "vulnwatch@vulnwatch.org" Date: Tue, 04 Feb 2003 11:10:50 "GMT" Subject: [VulnWatch] Opera Images (GM#004-OP) GreyMagic Security Advisory GM#004-OP ===================================== By GreyMagic Software, Israel. 04 Feb 2003. Available in HTML format at http://security.greymagic.com/adv/gm004-op/. Topic: Opera Images. Discovery date: 29 Jan 2003. Affected applications: ====================== Opera 7 (final). Introduction: ============= Opera recently released a new version of its browser. Opera 7, just like any other browser, supports a considerable amount of image formats. Images are normally embedded in HTML documents but they can also be accessed directly via the browser. Discussion: =========== By examining the HTML Opera produces when it displays a single image, it becomes obvious that Opera doesn't bother to do any formatting on the provided URL. Luckily though, Opera automatically encodes most characters in the URL, so access to other domains via this flaw becomes impossible. However, URLs to local files (file:// protocol) do not get encoded and therefore cannot evade the very basic form of XSS: file://path/to/image.jpg?">Arbitrary HTML here. And to make this even more comfortable for attackers, Opera provided an easy way to refer to its own installation directory - file://localhost/. So instead of searching for default images in the OS, an attacker can simply refer to file://localhost/images/file.gif, one of the few images Opera ships by default, and enjoy the following abilities: * Read any file on the user's file system. * Read the contents of directories on the user's file system. * Read emails written or received by M2, Opera's mail program. * And more... Note: the same applies to embeddable media, such as SWF. Exploit: ======== open("file://localhost/images/file.gif?\">