XSS technique without parentheses

Source: Internet
Author: User

This is a very old technique I discovered years ago which I used to bypass a filter and it's pretty awesome. it might come in handy to bypass a WAF or filter since it's not public until now. first you need to understand (which you probably do) that the window object is the default object in JavaScript and every time you execute code it's like you 've ve run a with statement on the window if your not mo Re specific. So stuff like onload is really window. onload and so on lets see if you can guess what comes next ....
 
So in JavaScript we have a onerror handler which is also on the window object, this means if we assign a function to onerror we can call it by generating a JavaScript error! How do we generate a JavaScript error? Throw is a nice way, this means throw can pass an argument to a function you can create some pretty awesome crazy looking JavaScript.
 
 
Onerror = alert; throw 1;
 
 
Www.2cto.com This works on every browser apart from Firefox *, Safari and IE will just call the function with the argument but Chrome and Opera add uncaught to the argument. this is no big deal though since we can just modify it slightly and use a different object as an argument such as a string.
 
 
Onerror = eval; throw' = alert \ x281 \ x29 ';
 
 
Thought I 'd post this before this technique gets lost forever and I forget about it pretty awesome XSS eh?
 
* Does actually work in Firefox. My site was disabling the error handling.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.