All Topics  
HTTP cookie

 

   Email Print
   Bookmark   Link






 

HTTP cookie



 
 
HTTP cookies, more commonly referred to as Web
World Wide Web

The World Wide Web is a very large set of interlinked hypertext documents accessed via the Internet. With a Web browser, one can view Web pages that may contain writing, s, videos, and other multimedia and navigate between them using hyperlinks....
 cookies, tracking cookies or just cookies, are parcels of text sent by a server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
 to a Web client
Client (computing)

A client is an Application software or system that accesses a remote service on another computer system, known as a Server , by way of a Computer network....
 (usually a browser
Web browser

A Web browser is a application software which enables a user to display and interact with text, images, videos, music, games and other information typically located on a Web page at a website on the World Wide Web or a local area network....
) and then sent back unchanged by the client each time it accesses that server. HTTP
Hypertext Transfer Protocol

Hypertext Transfer Protocol is an application-level protocol for distributed, collaborative, hypermedia information systems. Its use for retrieving inter-linked resources led to the establishment of the World Wide Web....
 cookies are used for authenticating
Authentication

Authentication is the act of establishing or confirming something as authentic, that is, that claims made by or about the subject are true....
, session tracking (state maintenance), and maintaining specific information about users, such as site preferences or the contents of their electronic shopping carts.






Discussion
Ask a question about 'HTTP cookie'
Start a new discussion about 'HTTP cookie'
Answer questions from other users
Full Discussion Forum



Encyclopedia


HTTP cookies, more commonly referred to as Web
World Wide Web

The World Wide Web is a very large set of interlinked hypertext documents accessed via the Internet. With a Web browser, one can view Web pages that may contain writing, s, videos, and other multimedia and navigate between them using hyperlinks....
 cookies, tracking cookies or just cookies, are parcels of text sent by a server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
 to a Web client
Client (computing)

A client is an Application software or system that accesses a remote service on another computer system, known as a Server , by way of a Computer network....
 (usually a browser
Web browser

A Web browser is a application software which enables a user to display and interact with text, images, videos, music, games and other information typically located on a Web page at a website on the World Wide Web or a local area network....
) and then sent back unchanged by the client each time it accesses that server. HTTP
Hypertext Transfer Protocol

Hypertext Transfer Protocol is an application-level protocol for distributed, collaborative, hypermedia information systems. Its use for retrieving inter-linked resources led to the establishment of the World Wide Web....
 cookies are used for authenticating
Authentication

Authentication is the act of establishing or confirming something as authentic, that is, that claims made by or about the subject are true....
, session tracking (state maintenance), and maintaining specific information about users, such as site preferences or the contents of their electronic shopping carts. The term "cookie" is derived from "magic cookie
Magic cookie

A magic cookie or just cookie for short, is a token or short packet of data passed between communicating programs, where the data is typically not meaningful to the recipient program....
," a well-known concept in UNIX
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 computing which inspired both the idea and the name of HTTP cookies. Some alternatives to cookies exist, but each has its own uses, advantages, and drawbacks.

Cookies are also subject to a number of misconceptions, mostly based on the erroneous notion that they are computer program
Computer program

Computer programs are Instruction for a computer. A computer requires programs to function. Moreover, a computer program does not run unless its instructions are executed by a Central processing unit; however, a program may communicate an Algorithm#Formalization of algorithms to people without running....
s that run on the browsing computer. In fact, cookies are simple pieces of data that affect the operation of a web server, not the client, and do so in very specific ways. In particular, they are neither spyware
Spyware

Spyware is computer software that is installed wikt:surreptitiously on a personal computer to intercept or take partial control over the user's interaction with the computer, without the user's informed consent....
 nor viruses
Computer virus

A computer virus is a computer program that can copy itself and infect a computer without the permission or knowledge of the user. The term "virus" is also commonly but erroneously used to refer to other types of malware, adware and spyware programs that do not have the reproductive ability....
, although cookies from certain sites are described as spyware by many anti-spyware products because they allow users to be tracked when they visit various sites.

Most modern browsers allow users to decide whether to accept cookies, but rejection makes some website
Website

A Web site is a collection of related Web pages, images, videos or other digital assets that are hosted on one Web server, usually accessible via the Internet....
s unusable. For example, shopping carts implemented using cookies do not work if cookies are rejected.

Use

Normal cookies are used to remember the user who is visiting the website in order to show the appropriate content. Without them, some websites would cease to function. Cookies are also used to remember the passwords and "signed on" status of users.

HTTP cookies are used by Web servers to differentiate users and to maintain data related to the user during navigation, possibly across multiple visits. HTTP cookies were introduced to provide a way to implement a "shopping cart
Shopping cart software

Shopping cart software is software used in electronic commerce to assist people making purchases online, analogous to the American English term 'shopping cart'....
" (or "shopping basket"), a virtual device into which the user can "place" items to purchase, so that users can navigate a site where items are shown, adding or removing items from the shopping basket at any time.

Allowing users to log in to a website is another use of cookies. Users typically log in by inserting their credentials into a login page; cookies allow the server to know that the user is already authenticated, and therefore is allowed to access services or perform operations that are restricted to logged-in users.

Many websites also use cookies for personalization
Personalization

Personalization or personalisation is tailoring a consumer product, electronic or written medium to a user based on personal details or characteristics they provide....
 based on users' preferences. Sites that require authentication often use this feature, although it is also present on sites not requiring authentication. Personalization includes presentation and functionality. For example, the Wikipedia
Wikipedia

Wikipedia is a Free content, multilingualism encyclopedia project supported by the non-profit organization Wikimedia Foundation. Its name is a portmanteau of the words wiki and encyclopedia....
 website allows authenticated users to choose the webpage skin
Skin (computing)

In computing, skins may be associated with theme as custom graphical appearances that can be applied to certain computer software and websites in order to suit the different tastes of different users....
 they like best; the Google
Google

Google Inc. is an United States public company, earning revenue from AdWords related to its Google search, Gmail, Google Maps, Google Apps, Orkut, and YouTube services as well as selling advertising-free versions of the Google Search Appliance....
 search engine allows users (even non-registered ones) to decide how many search results per page they want to see.

Tracking cookies, however, are used to track internet users' web browsing habits. Websites leave these tracking cookies on users' computers, and tracking software can determine where a user has been by viewing the cookies left on the computer. Different websites can share tracking cookies, and each website with the same tracking cookie can read the information and write new information into it. Websites that use tracking cookies continue to recreate cookies in the browser each time a site is visited.

Cookies are also used to track users across a website. Third-party cookies and Web bug
Web bug

A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows checking that a user has viewed the page or e-mail....
s, explained below, also allow for tracking across multiple sites. Tracking within a site is typically done with the aim of producing usage statistics, while tracking across sites is typically used by advertising companies to produce anonymous user profiles, which are then used to target advertising (deciding which advertising image to show) based on the user profile.

In general, a tracking cookie is not dangerous. They may potentially infringe upon the host's privacy, but they are easily removed. A tracking cookie cannot cause any system instability. Current versions of popular web browsers include options to delete 'persistent' cookies when the application is closed.

Implementation

Technically, cookies are arbitrary pieces of data chosen by the Web server
Web server

The term web server can mean one of two things:# A computer program that is responsible for accepting Hypertext Transfer Protocol requests from clients , and Server them HTTP responses along with optional data contents, which usually are web pages such as Hypertext Markup Language documents and linked objects ....
 and sent to the browser. The browser returns them unchanged to the server, introducing a state
State (computer science)

In computer science and automata theory, a state is a unique configuration of information in a program or machine. It is a concept that occasionally extends into some forms of systems programming such as Lexical analysiss and parsers....
 (memory of previous events) into otherwise stateless HTTP transactions. Without cookies, each retrieval of a Web page
Web page

A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser.This information is usually in HyperText Markup Language or eXtensible HyperText Markup Language format, and may provide Navigation bar to other web pages via hypertext Hyperlink....
 or component of a Web page is an isolated event, mostly unrelated to all other views of the pages of the same site. By returning a cookie to a web server, the browser provides the server a means of connecting the current page view with prior page views. Other than being set by a web server, cookies can also be set by a script in a language such as JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
, if supported and enabled by the Web browser.

Cookie specifications suggest that browsers should be able to save and send back a minimal number of cookies. In particular, an internet browser is expected to be able to store at least 300 cookies of four kilobyte
Kilobyte

Kilobyte is a unit of Computer data storage equal to either 1,024 bytes or 1,000 bytes , depending on context.It is abbreviated in a number of ways: KB, kB, K and Kbyte....
s each, and at least 20 cookies per server or domain.

Relevant count of maximum stored cookies per domain for the major browsers are:

  • Firefox 1.5: 50
  • Firefox 2.0: 50
  • Opera 9: 30
  • Internet Explorer 6: 20 (raised to 50 in update on August 14, 2007)
  • Internet Explorer 7: 20 (raised to 50 in update on August 14, 2007)


In practice cookies must be smaller than 4 kilobytes. Internet Explorer imposes a 4KB total for all cookies stored in a given domain.

According to section 3.1 of RFC 2965, cookie names are case insensitive
Case sensitivity

self-ref|For a discussion of case-sensitivity in Wikipedia page titles, see...
.

The cookie setter can specify a deletion date, in which case the cookie will be removed on that date. If the cookie setter does not specify a date, the cookie is removed once the user quits his or her browser. As a result, specifying a date is a way for making a cookie survive across sessions. For this reason, cookies with an expiration date are called persistent. As an example application, a shopping site can use persistent cookies to store the items users have placed in their basket. (In reality, the cookie may refer to an entry in a database stored at the shopping site, not on your computer.) This way, if users quit their browser without making a purchase and return later, they still find the same items in the basket so they do not have to look for these items again. If these cookies were not given an expiration date, they would expire when the browser is closed, and the information about the basket content would be lost.

Cookies can also be limited in scope to a specific domain, subdomain or path on the web server which created them.

Misconceptions

Since their introduction on the Internet, misconceptions about cookies have circulated on the Internet and in the media. In 1998, CIAC
Computer Incident Advisory Capability

Computer Incident Advisory Capability is a service run by the Office of Cyber Security at the United States Department of Energy. The primary function of CIAC is, as the name implies, to advise people of computer incidents....
, a computer incident response team of the United States Department of Energy
United States Department of Energy

The United States Department of Energy is a United States Cabinet-level department of the United States government of the United States responsible for Energy policy of the United States and nuclear safety....
, found the security vulnerability "essentially nonexistent" and explained that "information about where you come from and what web pages you visit already exists in a web server's log files". In 2005, Jupiter Research published the results of a survey, according to which a consistent percentage of respondents believed some of the following false claims:

  • Cookies are like worms
    Computer worm

    A computer worm is a self-replicating computer program. It uses a network to send copies of itself to other nodes and it may do so without any user intervention....
     and viruses
    Computer virus

    A computer virus is a computer program that can copy itself and infect a computer without the permission or knowledge of the user. The term "virus" is also commonly but erroneously used to refer to other types of malware, adware and spyware programs that do not have the reproductive ability....
     in that they can erase data from the user's hard disks
  • Cookies generate pop-up
    Pop-Up

    Pop-up is the first album from the electro-dance / pop artist Yelle, released on the 3rd September 2007.The album peaked at #61 on the French Top 100 Albums Chart, and went on to sell 20,000 copies....
    s
  • Cookies are used for spamming
    Spam (electronic)

    Spam is the abuse of electronic messaging systems to send unsolicited bulk messages indiscriminately. While the most widely recognized form of spam is e-mail spam, the term is applied to similar abuses in other media: Messaging spam, Newsgroup spam, spamdexing, spam in blogs, wiki spam, Classified advertising spam, mobile phone spam, Forum...
  • Cookies are only used for advertising
    Advertising

    Advertising is a form of communication that typically attempts to persuade potential customers to Purchasing or to consume more of a particular brand of Product or Service ....


Cookies are in fact only data, not program code: they cannot erase or read information from the user's computer. However, cookies allow for detecting the Web pages viewed by a user on a given site or set of sites. This information can be collected in a profile of the user. Such profiles are sometimes anonymous, that is, they sometimes do not contain personal information of the user (name, address, etc.) More precisely, they should not contain personal information unless the user has made it available to some sites. Even if anonymous, these profiles have been the subject of some privacy concerns.

According to the same survey, a large percentage of Internet users do not know how to delete cookies. One reason people do not trust the concept of cookies is because some sites have abused the personal identification aspect of cookies and have shared them. A large percentage of targeted advertising comes from information gleaned from tracking cookies.

Browser settings

Most modern browsers support cookies. However, a user can usually also choose whether cookies should be used or not. The following are common options:
  1. To enable or disable cookies completely, so that they are always accepted or always blocked.
  2. To allow the user to see the cookies that are active with respect to a given page by typing javascript:alert(document.cookie) in the browser URL
    Uniform Resource Locator

    In Information technology, a Uniform Resource Locator is a type of Uniform Resource Identifier that specifies where an identified resource is available and the mechanism for retrieving it....
     field. Some browsers incorporate a cookie manager for the user to see and selectively delete the cookies currently stored in the browser.


Most browsers also allow a full wipe of private data including cookies, and add-on tools for managing cookie permissions also exist.

Privacy and third-party cookies

Cookies have some important implications on the privacy
Privacy

Privacy is the ability of an individual or group to seclude themselves or information about themselves and thereby reveal themselves selectively....
 and anonymity
Anonymity

Anonymity is derived from the Greek word a??????a, meaning "without a name" or "namelessness". In colloquial use, the term typically refers to a person, and often means that the Identity , or personally identifiable information of that person is not known....
 of Web users. While cookies are only sent to the server setting them or one in the same Internet domain, a Web page may contain images or other components stored on servers in other domains. Cookies that are set during retrieval of these components are called third-party cookies.

Advertising companies use third-party cookies to track a user across multiple sites. In particular, an advertising company can track a user across all pages where it has placed advertising images or web bug
Web bug

A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows checking that a user has viewed the page or e-mail....
s. Knowledge of the pages visited by a user allows the advertisement company to target advertisement to the user's presumed preferences.

The possibility of building a profile of users has been considered by some a potential privacy threat, even when the tracking is done on a single domain but especially when tracking is done across multiple domains using third-party cookies. For this reason, some countries have legislation about cookies.

The United States
United States

The United States of America is a Federal government constitutional republic comprising U.S. state and a federal district. The country is situated mostly in central North America, where its Contiguous United States and Washington, D.C., the Capital districts and territories, lie between the Pacific Ocean and Atlantic Oceans, Borders of the U...
 government has set strict rules on setting cookies in 2000 after it was disclosed that the White House drug policy office
Office of National Drug Control Policy

The White House Office of National Drug Control Policy , a Cabinet level component of the Executive Office of the President of the United States, was established in 1988 by the Anti-Drug Abuse Act....
 used cookies to track computer users viewing its online anti-drug advertising. In 2002, privacy activist Daniel Brandt found that the CIA
Central Intelligence Agency

The Central Intelligence Agency is a civilian intelligence agency of the Federal government of the United States. It is the successor of the Office of Strategic Services formed during World War II to coordinate espionage activities between the branches of the US military services....
 had been leaving persistent cookies on computers for ten years. When notified it was violating policy, CIA stated that these cookies were not intentionally set and stopped setting them. On December 25, 2005, Brandt discovered that the National Security Agency
National Security Agency

The National Security Agency/Central Security Service is a Cryptology Intelligence agency of the Federal government of the United States, administered as part of the United States Department of Defense....
 had been leaving two persistent cookies on visitors' computers due to a software upgrade. After being informed, the National Security Agency immediately disabled the cookies.

The 2002 European Union telecommunication privacy Directive contains rules about the use of cookies. In particular, Article 5, Paragraph 3 of this directive mandates that storing data (like cookies) in a user's computer can only be done if: 1) the user is provided information about how this data is used; and 2) the user is given the possibility of denying this storing operation. However, this article also states that storing data that is necessary for technical reasons is exempted from this rule. This directive was expected to have been applied since October 2003, but a says (page 38) that this provision was not applied in practice, and that some member countries (Slovakia
Slovakia

Slovakia . It was amended in September 1998 to allow direct election of the president and again in February 2001 due to EU admission requirements....
, Latvia
Latvia

Latvia The Latvians are a Baltic peoples culturally related to the Estonians and Lithuanians, with the Latvian language having many similarities with Lithuanian language, but not with the Estonian language....
, Greece
Greece

Greece , officially the Hellenic Republic , is a country in southeastern Europe, situated on the southern end of the Balkans. It has borders with Albania, Bulgaria and the former Yugoslav Republic of Macedonia to the north, and Turkey to the east....
, Belgium
Belgium

* A small German-speaking Community of Belgium exists in eastern Wallonia. Belgium's linguistic diversity and related political and cultural conflicts are reflected in the history of Belgium and a complex Communities and regions of Belgium....
, and Luxembourg
Luxembourg

Luxembourg , officially the Grand Duchy of Luxembourg , is a small landlocked country in western Europe, bordered by Belgium, France, and Germany....
) did not even implement the provision in national law. The same report suggests a thorough analysis of the situation in the Member States.

The P3P
P3P

The Platform for Privacy Preferences Project, or P3P, is a protocol allowing websites to declare their intended use of information they collect about browsing users....
 specification includes the possibility for a server to state a privacy policy, which specifies which kind of information it collects and for which purpose. These policies include (but are not limited to) the use of information gathered using cookies. According to the P3P specification, a browser can accept or reject cookies by comparing the privacy policy with the stored user preferences or ask the user, presenting them the privacy policy as declared by the server.

Many web browsers including Apple's Safari and Microsoft Internet Explorer versions 6 and 7 support P3P which allows the web browser to determine whether to allow 3rd party cookies to be stored. The Opera web browser allows users to refuse third-party cookies and to create global and specific security profiles for Internet domains. Firefox 2.x dropped this option from its menu system but it restored it with the release of version 3.x.

Blocking third-party cookies

Third-party cookies can be blocked by most browsers to increase privacy and reduce tracking by advertising and tracking companies -- without causing any problems. A secondary benefit is that it stops tracking by third-party companies' web bug
Web bug

A Web bug is an object that is embedded in a web page or e-mail and is usually invisible to the user but allows checking that a user has viewed the page or e-mail....
s that are on many web pages.

Drawbacks of cookies

Besides privacy concerns, cookies also have some technical drawbacks. In particular, they do not always accurately identify users, they can be used for security attacks, and they are at odds with the Representational State Transfer (REST
Representational State Transfer

Representational state transfer is a style of software architecture for distributed hypermedia systems such as the World Wide Web. As such, it is not strictly a method for building "web services." The terms "representational state transfer" and "REST" were introduced in 2000 in the doctoral dissertation of Roy Fielding, one of the principa...
) software architectural style.

Inaccurate identification

If more than one browser is used on a computer, each usually has a separate storage area for cookies. Hence cookies do not identify a person, but a combination of a user account, a computer, and a Web browser. Thus, anyone who uses multiple accounts, computers, or browsers has multiple sets of cookies.

Likewise, cookies do not differentiate between multiple users who share a computer and browser, if they do not use different user accounts.

Cookie hijacking

During normal operation cookies are sent back and forth between a server (or a group of servers in the same domain) and the computer of the browsing user. Since cookies may contain sensitive information (user name, a token used for authentication
Authentication

Authentication is the act of establishing or confirming something as authentic, that is, that claims made by or about the subject are true....
, etc.), their values should not be accessible to other computers. Cookie theft is the act of intercepting cookies by an unauthorized party.

Cookies can be stolen via packet sniffing in an attack called session hijacking
Session hijacking

The term session hijacking refers to the exploitation of a valid Session - sometimes also called a session key - to gain unauthorized access to information or services in a computer system....
. Traffic on a network can be intercepted and read by computers on the network other than its sender and its receiver (particularly on unencrypted
Plaintext

In cryptography, plaintext is the information which the sender wishes to transmit to the receiver. Before the computer era, plaintext simply meant text in the language of the communicating parties....
 public Wi-Fi
Wi-Fi

Wi-Fi is a trademark of the Wi-Fi Alliance, founded in 1999 as Wireless Internet Compatibility Alliance , comprising more than 300 companies, whose products are certified by the Wi-Fi Alliance, based on the IEEE 802.11 standards ....
 networks). This traffic includes cookies sent on ordinary unencrypted http sessions. Where network traffic is not encrypted, malicious users can therefore read the communications of other users on the network, including their cookies, using programs called packet sniffer
Packet sniffer

A packet analyzer is computer software or computer hardware that can intercept and log traffic passing over a digital telecommunications network or part of a network....
s.

This issue can be overcome by securing the communication between the user's computer and the server by employing Transport Layer Security
Transport Layer Security

Transport Layer Security and its predecessor, Secure Sockets Layer , are cryptographic protocols that provide security and data integrity for communications over Internet Protocol Suite networks such as the Internet....
 (https
Https

Hypertext Transfer Protocol Secure is a combination of the Hypertext Transfer Protocol and a secure communication protocol.HTTP operates at the highest layer of the TCP/IP model, the Application layer; but the security protocol operates at lower sublayer, encrypting an HTTP message prior to transmission and decrypting a message upon arriva...
 protocol) to encrypt the connection. A server can specify the secure flag while setting a cookie; the browser will then send it only over a secure channel, such as an SSL connection.

However a large number of websites, although using secure https
Https

Hypertext Transfer Protocol Secure is a combination of the Hypertext Transfer Protocol and a secure communication protocol.HTTP operates at the highest layer of the TCP/IP model, the Application layer; but the security protocol operates at lower sublayer, encrypting an HTTP message prior to transmission and decrypting a message upon arriva...
 communication for user authentication
Authentication

Authentication is the act of establishing or confirming something as authentic, that is, that claims made by or about the subject are true....
 (i.e. the login
Logging (computer security)

In computer security, login is the process by which individual access to a computer system is controlled by identification of the User using credentials provided by the user....
 page), subsequently send session cookies and other data over ordinary unencrypted http connections for performance reasons. Attackers can therefore easily intercept the cookies of other users and impersonate them on the relevant websites or use them in a cookiemonster attack
Cookiemonster attack

The CookieMonster attack is a man-in-the-middle exploit where a third party can gain [] [] data when the "Encrypted Sessions Only" property is not properly set....
.

Cookie Theft
A different way to steal cookies is cross-site scripting
Cross-site scripting

Cross-site scripting is a type of computer insecurity vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users....
 and making the browser itself send cookies to servers that should not receive them. Modern browsers allow execution of pieces of code retrieved from the server. If cookies are accessible during execution, their value may be communicated in some form to servers that should not access them. Encrypting cookies before sending them on the network does not help against this attack.

This type of cross-site scripting is typically exploited by attackers on sites that allow users to post HTML
HTML

HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
 content. By embedding a suitable piece of code in an HTML post, an attacker may receive cookies of other users. Knowledge of these cookies can then be exploited by connecting to the same site using the stolen cookies, thus being recognised as the user whose cookies have been stolen. Hope and Walther provide a coded example.

A way for preventing such attacks is by the HttpOnly flag; this is an option, first introduced by Microsoft and implemented in PHP since version 5.2.0 that is intended to make a cookie inaccessible to client side script. However, web developer
Web developer

A web developer is a software developer or software engineer who is specifically engaged in the development of World Wide Web applications, or distributed network applications that are run over the [] protocol from a web server to a web browser....
s should consider developing their websites so that they are immune to cross-site scripting.

Cookie Poison

Cookie poisoning

While cookies are supposed to be stored and sent back to the server unchanged, an attacker may modify the value of cookies before sending them back to the server. If, for example, a cookie contains the total value a user has to pay for the items in their shopping basket, changing this value exposes the server to the risk of making the attacker pay less than the supposed price. The process of tampering with the value of cookies is called cookie poisoning, and is sometimes used after cookie theft to make an attack persistent.
Cookie Cooking
Most websites, however, only store a session identifier — a randomly generated unique number used to identify the user's session — in the cookie itself, while all the other information is stored on the server. In this case, the problem of cookie poisoning is largely eliminated.

Cross-site cooking

Each site is supposed to have its own cookies, so a site like example.com
Example.com

example.com, example.net, and example.org are Second-level domain domain names reserved by the Internet Engineering Task Force through RFC 2606, Section 3, for use in documentation and examples....
 should not be able to alter or set cookies for another site, like example.org. Cross-site cooking
Cross-site cooking

Cross-site cooking is a type of browser exploit which allows a site attacker to set a cookie for a browser into the cookie domain of another site server....
 vulnerabilities in web browsers allow malicious sites to break this rule. This is similar to cookie poisoning, but the attacker exploits non-malicious users with vulnerable browsers, instead of attacking the actual site directly. The goal of such attacks may be to perform session fixation
Session fixation

In computer network security, session fixation attacks attempt to exploit the vulnerability of a system which allows one person to fixate another person's session identifier ....
.

Users are advised to use the more recent versions of web browsers in which such issue is mitigated.

Inconsistent state on client and server

The use of cookies may generate an inconsistency between the state of the client and the state as stored in the cookie. If the user acquires a cookie and then clicks the "Back" button of the browser, the state on the browser is generally not the same as before that acquisition. As an example, if the shopping cart of an online shop is realized using cookies, the content of the cart may not change when the user goes back in the browser's history: if the user presses a button to add an item in the shopping cart and then clicks on the "Back" button, the item remains in the shopping cart. This might not be the intention of the user, who possibly wanted to undo the addition of the item. This can lead to unreliability, confusion, and bugs. Web developers should therefore be aware of this issue and implement measures to handle such situations as this.

Cookie expiry

Persistent cookies have been criticized by privacy experts for not being set to expire soon enough, and thereby allowing some websites to track users and build up a profile of them over time. This aspect of cookies also compounds the issue of session hijacking
Session hijacking

The term session hijacking refers to the exploitation of a valid Session - sometimes also called a session key - to gain unauthorized access to information or services in a computer system....
, because a stolen persistent cookie can potentially be used to impersonate a user for a considerable period of time.

Alternatives to cookies

Some of the operations that can be realised using cookies can also be realised using other mechanisms. However, these alternatives to cookies have their own drawbacks, which make cookies usually preferred to them in practice. Most of the following alternatives allow for user tracking, even if not as reliably as cookies. As a result, privacy is an issue even if cookies are rejected by the browser or not set by the server.

IP address

An unreliable technique for tracking users is based on storing the IP address
IP address

An Internet Protocol address is a numerical identification that is assigned to devices participating in a computer network utilizing the Internet Protocol for communication between its nodes....
es of the computers requesting the pages. This technique has been available since the introduction of the World Wide Web, as downloading pages requires the server holding them to know the IP address of the computer running the browser or the proxy
Proxy server

In computer networks, a proxy server is a server that acts as a go-between for requests from client seeking resources from other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource, available from a different server....
, if any is used. This information is available for the server to be stored regardless of whether cookies are used or not.

However, these addresses are typically less reliable in identifying a user than cookies because computers and proxies may be shared by several users, and the same computer may be assigned different Internet addresses in different work sessions (this is often the case for dial-up connections). The reliability of this technique can be improved by using another feature of the HTTP protocol: when a browser requests a page because the user has followed a link, the request that is sent to the server contains the URL of the page where the link is located. If the server stores these URLs, the path of page viewed by the user can be tracked more precisely. However, these traces are less reliable than the ones provided by cookies, as several users may access the same page from the same computer, NAT router
Network address translation

In computer networking, network address translation is the process of modifying network address information in datagram packet headers while in transit across a traffic router for the purpose of remapping a given address space into another....
, or proxy and then follow two different links. Moreover, this technique only allows tracking and cannot replace cookies in their other uses.

Tracking by IP address can be impossible with some systems that are used to retain Internet anonymity, such as Tor
Tor (anonymity network)

Tor is a free software implementation of second-generation onion routing ? a system enabling its users to communicate Anonymity on the Internet....
. With such systems, not only could one browser carry multiple addresses throughout a session, but multiple users could appear to be coming from the same IP address, thus making IP address use for tracking wholly unreliable.

Some major ISPs, including AOL, route all web traffic through a small number of proxies which makes this scheme particularly unworkable.

However some things make IP addresses more usable. With the much more widespread use of routers
Residential gateway

A residential gateway is a home networking device. The term is generally used to cover any networking appliance used in homes. The term however is misleading....
 many broadband users retain the same IP for as long as the power stays on. Also combined with the user's browser's User agent
User agent

A user agent is the client application used with a particular network protocol; the phrase is most commonly used in reference to those which access the World Wide Web, but other systems such as Session Initiation Protocol use the term user agent to refer to the user's phone....
 a tracker can differentiate different users behind a NAT
Network address translation

In computer networking, network address translation is the process of modifying network address information in datagram packet headers while in transit across a traffic router for the purpose of remapping a given address space into another....
. When combined with session cookies and links to their tracker on huge number of pages (as happens with Google
Google

Google Inc. is an United States public company, earning revenue from AdWords related to its Google search, Gmail, Google Maps, Google Apps, Orkut, and YouTube services as well as selling advertising-free versions of the Google Search Appliance....
 for example with Adsense, and Doubleclick
DoubleClick

DoubleClick is a company that develops and provides Internet ad serving services. Its clients include agencies, marketers and publishers who service customers like Microsoft, General Motors, Coca-Cola, Motorola, L'Or?al, Palm, Inc., Visa Inc....
 combined constant IP announcing pings to their GMail
Gmail

Gmail is a free Post Office Protocol and Internet Message Access Protocol webmail service provided by Google. In the United Kingdom and Germany it is officially called Google Mail....
 service; among other providers and advertisers.) a tracker can track extensively even in the absence of persistent cookies.

URL (query string)

A more precise technique is based on embedding information into URLs. The query string
Query string

In World Wide Web, a query string is the part of a Uniform Resource Locator that contains data to be passed to web applications such as Common Gateway Interface programs....
 part of the URL
Uniform Resource Locator

In Information technology, a Uniform Resource Locator is a type of Uniform Resource Identifier that specifies where an identified resource is available and the mechanism for retrieving it....
 is the one that is typically used for this purpose, but other parts can be used as well. The Java Servlet
Java Servlet

Servlets are Java programming language objects that dynamically process requests and construct responses. The Java Servlet API allows a software developer to add dynamic content to a Web server using the Java platform....
 and PHP
PHP

PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in Standalone software Graphical user interface....
 session mechanisms both use this method if cookies are not enabled.

This method consists of the Web server appending query strings to the links of a Web page it holds when sending it to a browser. When the user follows a link, the browser returns the attached query string to the server.

Query strings used in this way and cookies are very similar, both being arbitrary pieces of information chosen by the server and sent back by the browser. However, there are some differences: since a query string is part of a URL, if that URL is later reused, the same attached piece of information is sent to the server. For example, if the preferences of a user are encoded in the query string of a URL and the user sends this URL to another user by e-mail
E-mail

Electronic mail, often abbreviated as e-mail, email, E-Mail, or eMail, is any method of creating, transmitting, or storing primarily text-based human communications with digital communications systems....
, those preferences will be used for that other user as well.

Moreover, even if the same user accesses the same page two times, there is no guarantee that the same query string is used in both views. For example, if the same user arrives to the same page but coming from a page internal to the site the first time and from an external search engine
Search engine

A search engine is an information retrieval designed to help find information stored on a computer system. The search results are usually presented in a list and are commonly called hits....
 the second time, the relative query strings are typically different while the cookies would be the same. For more details, see query string
Query string

In World Wide Web, a query string is the part of a Uniform Resource Locator that contains data to be passed to web applications such as Common Gateway Interface programs....
.

Other drawbacks of query strings are related to security: storing data that identifies a session in a query string enables or simplifies session fixation
Session fixation

In computer network security, session fixation attacks attempt to exploit the vulnerability of a system which allows one person to fixate another person's session identifier ....
 attacks, referer logging attacks and other security exploits
Exploit (computer security)

An exploit is a piece of software, a chunk of data, or sequence of commands that take advantage of a software bug, glitch or vulnerability in order to cause unintended or unanticipated behavior to occur on computer software, hardware, or something electronic ....
. Transferring session identifiers as HTTP cookies is more secure.

Hidden form fields

A form of session tracking, used by ASP.NET
ASP.NET

ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services....
, is to use web forms
Form (web)

A webform on a web page allows a user to enter data that is sent to a Server for processing. Webforms resemble form because internet users fill out the forms using checkboxes, radio buttons, or menus....
 with hidden fields. This technique is very similar to using URL query strings to hold the information and has many of the same advantages and drawbacks; and if the form is handled with the HTTP GET method, the fields actually become part of the URL the browser will send upon form submission. But most forms are handled with HTTP POST, which causes the form information, including the hidden fields, to be appended as extra input that is neither part of the URL, nor of a cookie.

This approach presents two advantages from the point of view of the tracker: first, having the tracking information placed in the HTML source and POST input rather than in the URL means it will not be noticed by the average user; second, the session information is not copied when the user copies the URL (to save the page on disk or send it via email, for example). A drawback of this technique is that session information is in the HTML code; therefore, each web page must be generated dynamically each time someone requests it, placing an additional workload on the web server.

window.name

All current web browsers can store a fairly large amount of data (2-32 MB) via JavaScript using the DOM
Dom

Dom may refer to:*Dom , the third highest mountain in the Alps*Dom , a title of respect, derived from Latin Dominus*Dom people, an ethnic group in the Middle East...
 property window.name. This data can be used instead of session cookies and is also cross domain. The technique can be coupled with JSON
JSON

JSON , short for JavaScript Object Notation, is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays ....
/JavaScript objects to on the client side.

The downside is that every separate window or tab
Tabbed document interface

In the area of graphical user interfaces, a tabbed document interface is one that allows multiple documents to be contained within a single window , using tab s to navigate between them....
 will initially have an empty window.name; in times of tabbed browsing
Tabbed document interface

In the area of graphical user interfaces, a tabbed document interface is one that allows multiple documents to be contained within a single window , using tab s to navigate between them....
 this means that individually opened tabs (initiation by user) will not have a window name. Furthermore window.name can be used for tracking visitors across different web sites, making it of concern for Internet privacy
Internet privacy

Internet privacy consists of privacy over the media of the Internet: the ability to control what information one reveals about oneself over the Internet, and to control who can access that information....
.

HTTP authentication

As for authentication, the HTTP protocol includes the basic access authentication and the digest access authentication
Digest access authentication

HTTP Digest access authentication is one of the agreed methods a web server can use to negotiate credentials with a web user . Digest authentication is intended to supersede unencrypted use of the Basic access authentication, allowing user identity to be established securely without having to send a password in plaintext over the network....
 protocols, which allow access to a Web page only when the user has provided the correct username and password. If the server requires such credential for granting access to a Web page, the browser requests them to the user; once obtained, the browser stores and uses them also for accessing subsequent pages, without requiring the user to provide them again. From the point of view of the user, the effect is the same as if cookies were used: username and password are only requested once, and from that point on the user is given access to the site. In the basic access authentication protocol, a combination of username and password is sent to the server in every browser request. This means that someone listening in on this traffic can simply read this information and store for later use. This problem is overcome in the digest access authentication protocol, in which the username and password are encrypted using a random nonce
Cryptographic nonce

In security engineering, a nonce stands for number used once . It is often a randomness or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks....
 created by the server.

Adobe Flash Local Stored Objects

If a browser includes the Adobe Flash Player
Adobe Flash

Adobe Flash is a multimedia Platform created by Macromedia and currently developed and distributed by Adobe Systems. Since its introduction in 1996, Flash has become a popular method for adding animation and interactivity to web pages; Flash is commonly used to create animation, advertisements, and various web page components, to integrate...
 plugin
Plugin

In computing, a plug-in consists of a computer program that interacts with a host application software to provide a certain, usually very specific, function "on demand"....
 (formerly developed by Macromedia
Macromedia

Macromedia was a United States graphics and Web development software house headquartered in San Francisco, California producing such products as Adobe Flash....
), the Local Shared Object
Local Shared Object

A Local Shared Object is a collection of []-like data stored as a file on a user's PC. LSOs are used by all versions of Adobe Flash Player and Version 6 and above of Macromedia's now-obsolete Flash MX Player....
s functionality can be used in a way very similar to cookies. Local Stored Objects may be an attractive choice to web developers because a majority of Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
 users have Flash Player installed, the default size limit is 100 kB, and the security controls are distinct from the user controls for cookies, so Local Shared Objects may be enabled when cookies are not.

The major drawback with this approach is the same as every platform/vendor-specific approach: it breaks the web's global accessibility
Web accessibility

Web accessibility refers to the practice of making websites usable by people of all abilities and disabilities. When sites are correctly designed, developed and edited, all users can have equal access to information and functionality....
 and interoperability
Web Interoperability

Web interoperability means producing web pages viewable in standard compatible web browsers, various operating systems such as Microsoft Windows, Macintosh and Linux and devices such as Personal computer, Personal digital assistant and mobile phone based on the latest web standards....
, tying up web development to a specific client's platform, excluding users who use standards-compliant
Web standards

Web standards is a general term for the formal Internet standards and other technical specifications that define and describe aspects of the World Wide Web....
 web user agent
User agent

A user agent is the client application used with a particular network protocol; the phrase is most commonly used in reference to those which access the World Wide Web, but other systems such as Session Initiation Protocol use the term user agent to refer to the user's phone....
s and instead forcing them to use platform/vendor-specific web agents, which propitiates vendor lock-in
Vendor lock-in

In economics, vendor lock-in, also known as proprietary lock-in, or customer lock-in, makes a customer dependent on a vendor for Product s and Service , unable to use another vendor without substantial switching barriers....
.

Client-side persistence

Some web browsers support a script-based persistence mechanism that allows the page to store information locally for later retrieval. Internet Explorer, for example, supports persisting information in the browser's history, in favorites, in an XML store, or directly within a Web page saved to disk. With HTML 5
HTML 5

HTML 5 is the fifth major revision of the core language of the World Wide Web, HTML. HTML 5 specifies two variants of the same language, a "classic" HTML variant known as HTML 5 and an XHTML variant known as XHTML 5....
 there will be a method, currently only supported by some browsers. For Internet Explorer
Internet Explorer

Windows Internet Explorer , commonly abbreviated to IE, is a series of graphical user interface web browsers developed by Microsoft and included as part of the Microsoft Windows line of operating systems starting in 1995....
 5+ there is a method available through DHTML Behaviours.

A different mechanism relies on browsers normally caching (holding in memory instead of reloading) JavaScript programs used in web pages. As an example, a page may contain a link such as from Microsoft
Microsoft

Microsoft Corporation is a multinational corporation computer technology corporation that develops, manufactures, licenses, and supports a wide range of computer software products for computing devices....
  • at the Electronic Privacy Information Center (EPIC)
  • (PDF)
  • at JunkBusters
  • at HttpViewer
  • from Delivery And Transformation Group, Cabinet Office, UK
  • at ComScore
  • at PBS


  •