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

    To infinity and beyond!

    By Gareth Heyes (@hackvertor)

    Published 17 years 8 months ago • Last updated March 22, 2025 • ⏱️ < 1 min read

    ← Back to articles

    [Blocked Image]

    I'm still heavily researching Javascript in search of XSS vectors and interesting syntax. I've found loads of cool stuff recently and while looking through the ECMA spec. I came across the Infinity object which is a global and a number, of course I was already aware of it but I thought what kind of interesting code can be constructed with it.

    It turns out quite a lot, here's a window.name vector. I've added the variable name to simulate and execute the code.

    <pre lang="javascript"> name = 'alert(1)' -Infinity++in eval(1&&name) </pre>

    This doesn't look like it could work but does

    <pre lang="javascript"> +Infinity++in+alert(1) </pre>

    And my final example combines a few different operators:-

    <pre lang="javascript"> 1,0000instanceof delete~void--Infinity/~alert(1) </pre>

    There are endless possiblities and I'll leave you to play

    ← Back to articles