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

    Can all mozilla people look away now please

    By Gareth Heyes (@hackvertor)

    Published 16 years ago • Last updated March 24, 2025 • ⏱️ < 1 min read

    ← Back to articles

    Custom setters syntax are being removed from Firefox in the next version.. boo I here you say well at least some of you. If you don't know Firefox decided it would create it's own setter syntax (I love it when you do that you know) ages ago and it looked something like this:-

    a setter=alert,a=1//calls alert(1)

    Whacky indeed. They decided to remove it. So I was messing with JavaScript like I do near enough every day and I stumbled upon this:-

    Object.prototype.__noSuchMethod__=function(s){ alert(s); }; 1..*(1)

    What was surprising was that "alert" returned "*" not 1 as you would expect. The crazyness then continued:-

    Object.prototype.__noSuchMethod__=function(s){ eval(s); };1.['alert(1)']()

    Not looking at MDC and still not understanding why this was happening Mario pointed out "oh it's sending the name of the function via the noSuchMethod" then big doh moment oh yeah. But then that means.....we have a new setter syntax!!!!

    //existing code function x(s) { eval(s); } //our evil injection Object.prototype.__noSuchMethod__=x;new/a/['alert(1)']

    If you work at Mozilla please look away now because I like this crazy syntax so don't fix it.

    ← Back to articles