What is Cookie Testing and how we can secure it 2



 Cookies Testing


How cookies work?

The HTTP protocol used to exchange information files on the web is used to maintain the cookies. There are two types of HTTP protocol. Stateless HTTP and Stateful HTTP protocol. Stateless HTTP protocol does not keep any record of previously accessed web page history. While Stateful HTTP protocol do keep some history of previous web browser and web server interactions and this protocol is used by cookies to maintain the user interactions.

Whenever user visits the site or page that is using cookie, small code inside that HTML page (Generally a call to some language script to write the cookie like cookies in JAVA Script, PHP, Perl) writes a text file on users machine called cookie.
Here is one example of the code that is used to write cookie and can be placed inside any HTML page:

Set-Cookie: NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_ NAME;
When user visits the same page or domain later time this cookie is read from disk and used to identify the second visit of the same user on that domain. Expiration time is set while writing the cookie. This time is decided by the application that is going to use the cookie.

Generally two types of cookies are written on user machine.
1)      Session cookies: This cookie is active till the browser that invoked the cookie is open. When we close the browser this session cookie gets deleted. Some time session of say 20 minutes can be set to expire the cookie.
2)      Persistent cookies: The cookies that are written permanently on user machine and lasts for months or years.

Where cookies are stored?
When any web page application writes cookie it get saved in a text file on user hard disk drive. The path where the cookies get stored depends on the browser. Different browsers store cookie in different paths. E.g. Internet explorer store cookies on path "C:\Documents and Settings\Default User\Cookies"
Here the "Default User" can be replaced by the current user you logged in as. Like "Administrator" , or user name like "Vijay" etc.
The cookie path can be easily found by navigating through the browser options. In Mozilla Fire fox browser you can even see the cookies in browser options itself. Open the Mozilla browser, click on Tools->Options->Privacy and then "Show cookies" button.


How cookies are stored?
Lets take example of cookie written by rediff.com on Mozilla Fire fox browser:
On Mozilla Fire fox browser when you open the page rediff.com or login to your rediffmail account, a cookie will get written on your Hard disk. To view this cookie simply click on "Show cookies" button mentioned on above path. Click on Rediff.com site under this cookie list. You can see different cookies written by rediff domain with different names.


Site: google.com Cookie name: RMID
Name: RMID (Name of the cookie)
Content: 1ddjs&11c8ec44bf49e0… (Encrypted content)
Domain: .google.com
Path: / (Any path after the domain name)
Send For: Any type of connection
Expires: Thursday, September 31, 2020 11:59:59 PM


    << Back                                                                        wana know more << click here >>