E4X for hackers

If you’ve not been following my sla.ckers thread on unusual javascript then your missing out. My idea was to gather interesting, weird and wonderful javascript tricks which are useful for filter evasion and coding. I investigated E4X quite a lot for this purpose and found a few cool things that I’ll share with you.

Using {} for keyword evasion

Lets say a filter disallows certain words, because the {} allows you to execute a javascript block; if you execute a block that returns a blank string then you can use it for keyword evasion. The new array constructor creates a blank array but when used in concatenation it results in a blank string.

location=javascr{new Array}ipt:aler{new Array}t(1)

Another example:-


A few more:-

<>{new String};
<>{new RegExp()[-1]};

Weird syntax fun

E4X also has some javascript syntax quirks that normally would cause a parsing error but it’s perfectly valid.

default xml namespace = alert(1) 

Some more weird looking stuff:-


Numbers as E4X

For some reason numbers can be used as XML


Encoding with entities

Giorgio brought this to my attention when he was hacking my unsuccessful Firefox sandbox experiment. You can use html entities and they will be decoded when using the XML data as strings.


A more interesting example with decimal entities:-


Hackvertor supports morphs which allow you to generate this sort of data automatically, useful for fuzzing XSS filters:-
E4X morph

Form creation

Making forms with E4X is lovely, check it out:-


5 Responses to “E4X for hackers”

  1. mark writes:

    i saw ur site and am wondering if u $ crcd details i got paypal let me know

  2. Gareth Heyes writes:


    wot r u talkin bout? nvr mind i’m not intrsd

  3. Nonove writes:

    Hi,Gareth Heyes
    I just wanna know how to test or use these weird vectors.

  4. Gareth Heyes writes:


    I’ll be releasing a javascript hacking video shortly

  5. Nonove writes:

    Thanks Heyes!