Using cookies sniffed in Wireshark

General technological topics without their own forum go here

Using cookies sniffed in Wireshark

Post by davywavy on Sat Apr 07, 2012 1:30 pm
([msg=65527]see Using cookies sniffed in Wireshark[/msg])

Hello

I would like to know how to save cookies obtained using Wireshark.

I use Firefox and have added Cookies Manager+ but cannot work out how to use it.

Using Wireshark on my laptop, I obtained cookies set on a second PC on my WLAN and would like to be abe to use them on my laptop.

A step by step guide would be much appreciated.

Thanks
davywavy
New User
New User
 
Posts: 2
Joined: Wed Feb 15, 2012 8:47 am
Blog: View Blog (0)


Re: Using cookies sniffed in Wireshark

Post by scrptnnj on Sat Apr 07, 2012 9:14 pm
([msg=65538]see Re: Using cookies sniffed in Wireshark[/msg])

If I'm not mistaken most sites use PHP sessions(which can not be edited by the user) instead of cookies for important stuff like login info. Cookies are usually just used for things that don't need to be secure. So the cookies may or may not be that useful. That being said:

As far as saving cookies from wireshark I'd just copy and paste them into a text editor and save them. You can also click file then save in wireshark to save all of the capture results as a pcap file.

step 1:
You can either add the cookies using cookie manager or you can go to the site and if the site has a login then log into or create another account to get your own cookies, after that you just need to change the values of your cookies to that of the stolen cookies.

Add Cookies:
just click add and put in info. Repeat for each cookie.

or

Change your cookies:
In cookie manager check the box next to the cookie you want to change and click edit. Then change content to whatever the value of the stolen cookie was. Repeat for each cookie.
Note: Leave the name of the cookie alone, the name is basically the name of a variable, and content is it's value.

Step 2: Go to or refresh the page.

Results: depend on what the cookies are used for.

If you happen to have a server to run it on, you can use this to test if you are editing the cookies correctly:
Code: Select all
<?php
setcookie('logged_in', 'no');

echo $_COOKIE['logged_in'];
?>

It prints the value of the cookie, which is 'no' by default. This will also set the cookie back to 'no', so if you refresh it will return to 'no'.
User avatar
scrptnnj
New User
New User
 
Posts: 14
Joined: Mon Mar 26, 2012 4:15 pm
Blog: View Blog (0)


Re: Using cookies sniffed in Wireshark

Post by fashizzlepop on Sat Apr 07, 2012 10:35 pm
([msg=65539]see Re: Using cookies sniffed in Wireshark[/msg])

scrptnnj wrote:If you happen to have a server to run it on, you can use this to test if you are editing the cookies correctly:
Code: Select all
<?php
setcookie('logged_in', 'no');

echo $_COOKIE['logged_in'];
?>

It prints the value of the cookie, which is 'no' by default. This will also set the cookie back to 'no', so if you refresh it will return to 'no'.


This will ALWAYS display 'no' as you set it to no before echoing it. switch the two statements around and you will be shown what it was set to before it gets reset to no.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Moderator
Moderator
 
Posts: 2147
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: Using cookies sniffed in Wireshark

Post by scrptnnj on Sun Apr 08, 2012 4:07 pm
([msg=65550]see Re: Using cookies sniffed in Wireshark[/msg])

This will ALWAYS display 'no' as you set it to no before echoing it. switch the two statements around and you will be shown what it was set to before it gets reset to no.


Actually the order does not matter, I tested it before I posted. The setcookie function sends the logged_in cookie with the value of 'no' to the users computer, but you send your cookie to the server first and it echos the value of that cookie, which is whatever you changed it to. So basically when a page sets a cookie it does not get sent back to the server until the next time the user sends a request.
User avatar
scrptnnj
New User
New User
 
Posts: 14
Joined: Mon Mar 26, 2012 4:15 pm
Blog: View Blog (0)



Return to General

Who is online

Users browsing this forum: No registered users and 0 guests