Home › Cybersecurity wiki › What are cookies?

Wiki

What are cookies?

Cookies are small text files that a website stores in the browser.
On the next visit the browser sends them back so the website can recognise it.

What is the Purpose of Cookies?

Cookies remember logins, shopping baskets, language settings and consent choices.
They are also used for analytics and advertising.

Session Cookies

Session cookies last only as long as the browser is open.
They keep, for example, a login or the basket during one visit and disappear afterwards.

Persistent Cookies

Persistent cookies have an expiry date and stay stored across visits.
They remember “stay signed in” or settings, but are also used to recognise users over weeks and months.

How Do Cookies Work?

The server sets a cookie with the Set-Cookie header.
The browser stores the name, value, domain and lifetime and sends the cookie back with every matching request.

First-Party Cookies

First-party cookies come from the domain the user is visiting.
They are usually needed for the site to work, for example for login and the basket.

Third-Party Cookies

Third-party cookies are set by other domains whose content is embedded, such as ad networks.
They enable tracking across many websites and are now blocked by many browsers.

The Role of Cookies in Cybersecurity

Because cookies carry logins, they are a valuable target for attackers and a privacy issue.

Cookie Hijacking

If an attacker steals a session cookie, for example through cross-site scripting, malware or an unencrypted Wi-Fi network, they can take over the session.
HTTPS, the Secure, HttpOnly and SameSite attributes and short lifetimes protect against this.

Tracking and Privacy Concerns

Tracking cookies build profiles of browsing behaviour.
Under the GDPR and the ePrivacy rules, non-essential cookies may only be set with consent.
CDPCaptcha works entirely without cookies and therefore needs no consent.

Managing Cookies

Users can decide in every browser which cookies are allowed and remove stored cookies.

How to Block Cookies

The browser’s privacy settings can block third-party cookies or all cookies.
Exceptions for trusted sites are possible;
some logins do not work without cookies.

How to Delete Cookies

Under history or privacy, cookies can be deleted for single sites or completely.
Many browsers can also remove cookies automatically when closing.

Conclusion

Cookies are useful for many functions but carry risks for security and privacy.
Secure settings on server and browser and sparing use protect both sides.