The Spanner logo
    • Home
    • Blog
      • Blog home
      • RSS
    • Login
    • Home
    • Blog
      • Blog home
      • RSS
    • Login
    The Spanner logo

    The Spanner
    Web security blog

    Made by Gareth Heyes
    Follow me on Twitter: @garethheyes

    Javascript for hackers!

    Hackvertor logo
    Shazzer logo
    My Github account
    Recent posts
    Introducing Feedworm: A Privacy-First RSS Reader That Lives in DevToolsSpeedy RSVP extensionAutoVaderHackvertor history and tag finderShadow Repeater v1.2.3 releaseBurp Hackvertor v2.1.24 releaseHacking roomsXSSing TypeErrors in SafarivalueOf: Another way to get thisMaking the Unexploitable Exploitable with X-Mixed-Replace on FirefoxThe curious case of the evt parameterCSS-Only Tic Tac Toe ChallengeRewriting relative urls with the base tag in SafariBypassing DOMPurify with mXSSNew IE mutation vectorHow I smashed MentalJSMentalJS DOM bypassAnother XSS auditor bypassXSS Auditor bypassBypassing the IE XSS filterUnbreakable filterMentalJS bypassesmXSSJava SerializationBypassing the XSS filter using function reassignmentRPOSandboxed jQueryX-Domain scroll detection on IE using focusEpic fail IEnew operatorDecoding complex non-alphanumeric JavaScriptHacking FirefoxDOM ClobberingBypassing XSS AuditorThe evolution of codeNon-Alpha PHP in 6-7 charsetTweetable PHP-Non AlphaMentalJS for PHPOpera x domain with video tutorialSandboxing and parsing jQuery in 100ms

    Safari same origin hole

    By Gareth Heyes (@hackvertor)

    Published 18 years 11 months ago • Last updated March 22, 2025 • ⏱️ 2 min read

    ← Back to articles

    Background

    Whilst investigating same origin javascript policy with Ronald from 0x000000.com/, I found another vulerability in Safari 3.02 beta on windows, it could also work on OS X but I haven't tested it. Normally I would have reported this to Apple before releasing the details however the last time I found a problem with Safari Apple only seemed to respond and fix the problem when it went public. They even told me they don't normally accept vulnerability reports unless you are registered as an Apple developer!

    Overview

    Same origin policy works by checking the domain names of communicating windows or iframes and document.domain a javascript property of the document object allows or denies this. The problem is that IE6, IE7 and Safari allow you to overwrite the document object with your own, at the moment it appears only Safari beta is vulnerable to this attack but I am pretty sure in the future another attack will be available for IE6 and IE7.

    Proof of concept

    The POC connects to Amazon through an iframe then overwrites the document object and stores a reference to the getElementById dom function. The document object is then manipulated with the Amazon domain but would work with any domain. Then the script displays your name from the Amazon page (if available) and then shows your cookies gathered from that domain.

    Currently only tested on Safari beta 3.02 on windows through file:// not http://

    Safari POC

    Recommendation

    I strongly recommend that you use Firefox instead of IE6, IE7 or Safari as that is the only browser which denies access to overwriting the document object.

    Firefox

    ← Back to articles