Flux rss
Bookmark Bookmark & Share
Sicurezza - I cookies Segurança - Os cookies Sicherheit - die Cookies Sécurité - Les cookies Seguridad - Cookies

Introduction to cookies

cookie

So what are these strange sweet things that you have surely been offered before by a website.

Most of the time, when a web server offers you a cookie, users ignore this by clicking on "OK" without wondering where it has come from. A cookie is in fact a file, that is stored on the user's hard drive which allows the user to distinguish that web page from others. Cookies are mostly used by e-commerce websites where they store the user's preferences (such as options that have been previously selected) so that the user does not have to select them the next time he visits.

Cookies and security

The major problem of cookies is the information they contain. When a user connects to a website that can be personalised, he will be prompted with several questions in order to build a profile, this information is then stored in a cookie. Depending on the website, the manner in which this data is stored could end up being damaging to the user.

In fact, an online sales site could collect information on users' preferences by means of a questionnaire, so that they can suggest items that would be of interest to users.

For example: knowing that a user is male or female, a site can direct the user the appropriate department to save time (and most importantly sell more). If in addition, the user indicates in his profile that he plays tennis, the site will suggest to him a personalised selection of the latest items regarding that subject.

A cookie is therefore a way to create a link between the user's session (browsing certain pages of a website for a certain amount of time) and the data relating to the user.

Ideally, a cookie should contain a random chain (session identification), which is unique and difficult to decipher, and valid only for a given period of time. Only the server should be able to associate the user's preferences with the session identifier. Thus, when the session cookie expires, it becomes useless and should not contain any information relating to the user.

The cookie should never contain direct user information, and its lifespan should be as close as possible to the duration of the user's session.

On the other hand, the data stored in the cookie is sent to the server, to the database where the user entered his data (except the IP address and the browser ID which is automatically transmitted to the server). Thus, the cookie should never contain user information that the user hasn't given himself, nor information on contents of the computer, in other words, the cookie should not collect information from the user's computer.

So, always refuse to give personal information to a website that does not seem legitimate, as it has no right to collect your personal information.

A cookie is not a dangerous file in itself if it is well designed and if the user does not provide personal data.

How cookies work

Cookies are part of the HTTP protocol, which is the protocol used when browsing pages on the web. The HTTP protocol is used to exchange messages between the server and the client using HTTP requests and responses.

HTTP requests and responses contain headers which send specific data in both directions. One of these headers is reserved for writing files to the hard drive: cookies.

The HTTP header reserved for the use of cookies is called Set-Cookie, it is made up of a simple line of text in the following format:

Set-Cookie: NAME=VALUE; domain=DOMAIN_NAME; expires=DATE 
It is a string of characters beginning with "Set-Cookie:" and followed by value pairs in the format Name=Value, separated by semi-colons.

Here is a table of the main value pairs that can be used in a cookie:

Attribute Value Syntax Description
NAME_OF_COOKIE VALUE The name and value may not contain the following characters: semi-colon (;), comma (,) or space ( ). Such values can only be added using URL enconding This is the only obligatory attribute
expires DATE Day, DD-MM-YYYY HH:MM:SS GMT The expires attribute is used to define the date that the cookie should no longer be stored on the hard drive and should no longer be acknowledged by the server.
domain domain_name xxx.xxx.xxx The domain name is generally left empty as the name of the server is assigned by default (which is what is usually wanted here). Where indicated, the domain name must contain at least two dots (i.e.: www.commentcamarche.net). A computer from a specific domain can only specify a sub-domain name or its own domain name.
path /directory /path/ The path value is used to define a folder or file on the server where the cookie is valid, so as to reduce the field of action.
secure none   The secure value is optional. This is used to specify that the cookie will only be sent if the connection is secure (using SSL or HTTPS).

  • A cookie cannot be larger than 4 Kb in size.
  • A client cannot store more than 300 cookies on its hard drive.
  • A server cannot create more than 20 cookies on the client.

Sending cookies to the server

When a client connects to a site (i.e. a server), domain and path cookies are automatically sent in the headers of the HTTP request The header is in the following format:

Cookie: NAME1=VALUE1; NAME2=VALUE2; ...  

A CGI script (or others such as ASP or PHP) then verifies the presence of the cookie:

  • by analysing the headers, in the case of a CGI script
  • using the Request object, in the case of an ASP script
  • using the $NAME1, $NAME2,... variables which are created automatically by the PHP script engine

Cookie limitations

Cookies are subject to certain restrictions:

  • The total number is restricted to 300
  • The maximum size is 4kb;
  • A maximum of 20 cookies per domain.

Some further details on cookies

  • The cookie is not visible until the page has been loaded
  • Some browsers do not respond well to cookies
    • Microsoft Internet Explorer 4 with Service Pack 1 does not handle cookies correctly, if they have the path value defined.
    • Inversely, Netscape Communicator 4.05 and Microsoft Internet Explorer 3.x do not handle cookies correctly if they do not have the path and expiry values defined.


Last update on Thursday October 16, 2008 02:43:18 PM.This document entitled « Security - Cookies » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Security Policies in Windows NT Understanding the notion of policy Security policy is the set of all security rules that are to be implemented in an organisation, and the ways in which they are implemented. The user manager located in the Start Menu (Programs/Administration... en.kioskea.net/contents/winnt/ntstrat.php3
Information security officer (ISO) Information security officer (ISO) An ISO (information security officer) is in charge of setting and a company's security policy. He/she also plays a critical role in informing, advising, and alerting the general management on matters relating to... en.kioskea.net/contents/metiers-informatique/rssi-responsable-securite.php3
Protection - Introduction to Network Security What is Network Security? Network security is a level of guarantee that all the machines in a network are working optimally and the users of these machines only possess the rights that were granted to them. This can include: preventing... en.kioskea.net/contents/protect/protintro.php3
How to disable the security Center under windows XP?How to disable the security Center under windows XP? Intruduction Disable Alerts Turn off Windows Security Center Intruduction Windows security Center is a component that works under Windows XP service pack 2 for providing... en.kioskea.net/faq/sujet-617-how-to-disable-the-security-center-under-windows-xp
What are Cookies?Cookies (Also known as: web cookie,browser cookie, computer cookie, tracking cookie, internet cookie, and HTTP cookie) Cookies are small files saved on your computer when you visit some web sites. They may contain things like passwords so... en.kioskea.net/faq/sujet-3-what-are-cookies
Disabling security alerts under VistaDisabling security alerts under Vista If you are annoyed by the multiple Security Alert message, you can specify in which cases these messages will appear. The trick requires a modification of the registry, then it would be wise to save... en.kioskea.net/faq/sujet-1446-disabling-security-alerts-under-vista
Remove system security (Solved)Hello, I also have a problem with my desktop being infected by "security system". I also need directions on how to destroy it. any help? Margie22 en.kioskea.net/forum/affich-59028-remove-system-security
You have a security problem (Solved)Hello, I have an issue with my PC (Windows XP), I have a popup that states "You have a security problem" and attempts to sell me new virus protection. I have McAfee already installed and I have run a scan for a virus but it did not pick up anything.... en.kioskea.net/forum/affich-30169-you-have-a-security-problem
System Security keep on poping up on my screeHello, Can you please help me, I had previously downloaded System Security, now everytime I log on I get system security screen scanning my PC, but they do not remove the viruses from my PC. It says activate system security. Can I download another... en.kioskea.net/forum/affich-48480-system-security-keep-on-poping-up-on-my-scree
Download Eset Smart SecurityAntivirus, antispyware, antispam, firewall: all-in-one! We cannot find a simple protection! Based on NOD32 antivirus, extremely little greedy in resources! Eset Smart Security is a protection solution to be tried! en.kioskea.net/telecharger/telecharger-2190-eset-smart-security
Download ZoneAlarm Security SuiteZoneAlarm Security Suite is a complete protection for your PC with a single complete program. It drives away viruses, blocks spam and removes definitively spyware from your PC. ZoneAlarm Internet Security Suite is not contented with eradicating... en.kioskea.net/telecharger/telecharger-3407-zonealarm-security-suite
Download IE Security ProInternet Explorer Security enables you to customize many aspects of Internet Explorer. For example you can disable individual menu items and prevent anyone from editing your Favorites, change the background of the toolbar, animated icons, change the... en.kioskea.net/telecharger/telecharger-2655-ie-security-pro
Trend Micro Internet Security 2009 - Complete package + 1 Year Maintenance - 3 users - DVD - Win - EWith Trend Micro Internet Security, you no longer need to choose between computer performance and maximum protection. Get smart, proven security that never sleeps, guarding your PC from the latest threats while giving you the freedom to browse and... en.kioskea.net/guide/655237480-trend-micro-internet-security-2009-complete-package-1-year-maintenance-3-users-dvd-win-english
Trene Micro, Inc. Trend Internet Security Pro 2009 2 Year License (PC CD)Inc ., Whether you are at home or on the go Trend Micro PC-cillinInternet Security Pro 2009 safeguards your online transactionsidentity and irreplaceable files with the most comprehensiveprotection available. Get all the benefits of our proven... en.kioskea.net/guide/591565108-trene-micro-inc-trend-internet-security-pro-2009-2-year-license-pc-cd
Conficker worm active, security experts sayA man surfs the Internet in Beijing. The Conficker worm, believed to have burrowed into millions of computers around the world, has sent an encrypted data message to infected machines, according to a computer security firm. The Conficker worm,... en.kioskea.net/actualites/conficker-worm-active-security-experts-say-12512-actualite.php3
Definition of Needs in Terms of IT SecurityDefinition Phase The definition phase for security needs is the first step towards implementing a security policy. The goal consists in determining the organisation's needs by taking an inventory of the information system and then studying the... en.kioskea.net/contents/secu/securite-besoins.php3
Security AuditsThe Concept of Audits A security audit consists of relying on a trustworthy third party (generally a company that specialises in computing security) to validate, based on the security policy, the protective measures that are in place. The goal of... en.kioskea.net/contents/secu/audit-securite.php3
File sharing in Windows XPAdvantages File sharing involves making the content of one or more directories available through the network. All Windows systems have standard devices making it easy to share the content of a directory. However, file sharing may lead to security... en.kioskea.net/contents/configuration-reseau/partage-fichiers.php3