Unsecure cookies, cookie flag secure not set
The IRCCloud session cookie was not marked Secure, so the browser could send it over unencrypted HTTP, where an interceptor could capture the session token.
- Paid in 5 days
- Disclosed after 35 days
Since you are running on a secure connection, https, you should be ensuring that everything runs securely on your client's / visitors case. I have check the cookie session of IRCCloud and found out that it is not flag as secure.
Whenever a cookie contains sensitive information or is a session token, then it should always be passed using an encrypted tunnel. For example, after logging into an application and a session token is set using a cookie, then verify it is tagged using the ";secure" flag. If it is not, then the browser believes it safe to pass via an unencrypted channel such as using HTTP.
Clifford Trigo
What the report shows
The target is IRCCloud, a web application served over HTTPS. The researcher, cliantech, checked IRCCloud's cookie session and found that it was not flagged as secure. The report is short and contains no HTTP transcript, no cookie name, no version information and no reproduction steps beyond the observation itself.
The reasoning in the report is straightforward: because the site runs on a secure connection, everything it sends to the client should also be protected. A cookie that carries a session token should only ever travel over an encrypted tunnel. The researcher points out that when a session token is set in a cookie, the cookie should be tagged with the ;secure flag, and that without it the browser considers it safe to send the cookie over an unencrypted channel such as HTTP.
The report does not describe how the cookie was inspected (browser developer tools, a proxy, or a command line client), does not show the Set-Cookie header, and does not state whether the cookie was also missing HttpOnly or any other attribute. It also does not describe a proof of concept in which the cookie was actually observed travelling over plain HTTP.
The outcome recorded for the report is a bounty of 100.00 USD, disclosed on 2014-05-15. The weakness is classified as a violation of secure design principles. No severity score or CVSS vector is given, and the report does not describe a fix.
Root cause
The mistake the report points to is a missing Secure attribute on a cookie that carries session state. The report does not identify the code responsible.
Impact
As the report frames it, the risk is that the browser will attach the session cookie to requests made over plain HTTP as well as HTTPS. Without the flag, the browser considers it safe to send the session cookie over an unencrypted channel such as HTTP. The report does not demonstrate an attack, so the practical exploitability on this target is not shown.
How this kind of bug works
Cookies are scoped by domain and path, and by default a cookie set by an HTTPS page is still sent with requests to the same host over HTTP. The Secure attribute changes that: the browser only includes the cookie in requests whose scheme is HTTPS. Without it, any plaintext request to the host carries the cookie, and anyone on the path, such as a shared network operator or an attacker who can inject an HTTP subresource into an HTTPS page, can read it.
The attribute is a browser-side control, so it only helps if the browser honours it and if the site never needs the cookie over HTTP. It does not protect against an attacker who can already read the cookie through another channel, such as cross-site scripting, which is why HttpOnly is a separate and complementary control. Setting Secure also has a practical consequence: if any part of the site still serves pages over HTTP and relies on the cookie, those sessions will break, which is often why the attribute is left off during a migration.
How to test for it
- Authenticate to the target over HTTPS and capture the login response, either in the browser's developer tools or through an intercepting proxy.
- Read every
Set-Cookieheader in the response and note which attributes are present. Session cookies are the ones to care about; look for names that suggest a session, authentication or remember-me purpose. - For each session cookie, check whether
Secureis present. A positive result is a session cookie set over HTTPS without it. - Confirm the behaviour rather than assuming it: send a request to the same host over HTTP, for example by changing the scheme in the URL, and observe whether the browser or client attaches the cookie. If it does, the finding is confirmed.
- Check the whole session lifecycle, not just login: cookies set on logout, on password change, by remember-me features and by API endpoints can differ from the main login cookie.
Common false positives: a cookie that carries no sensitive state, such as a preference or a CSRF token that is validated server-side, is not a session token and its missing attribute is usually not a finding. A cookie that is set over HTTP but immediately replaced by an HTTPS-only cookie is also weaker than it looks. Finally, a site that redirects all HTTP traffic to HTTPS and uses HSTS still benefits from Secure, but the practical exposure is lower, and some programs will treat the report as informational unless you can show the cookie actually leaving over plaintext.
How it is fixed
Set the Secure attribute on every cookie that carries session or authentication state, and on any cookie whose contents are sensitive. Do the same for HttpOnly where the cookie does not need to be read by JavaScript, and consider SameSite for cross-site request protection. Serve the whole site over HTTPS with a redirect from HTTP, and add HSTS so browsers refuse plaintext connections after the first visit. Audit cookie-setting code paths, including framework configuration, so that new cookies inherit the attributes by default.
Hunting notes
This class of bug hides in places where cookies are set outside the main login flow: API authentication endpoints, single sign-on callbacks, remember-me tokens, session refresh endpoints, and subdomains that share a parent domain. Recon signals include a site that is HTTPS-only in its main pages but still answers on port 80, mixed content warnings in the browser console, and cookies whose names suggest session state appearing in responses from secondary hosts.
To make the report land, show the exact Set-Cookie header with the sensitive value redacted, show that the cookie is attached to a plaintext request, and explain what an attacker on the network or via an HTTP subresource could do with it. Reports that only state the attribute is missing, without demonstrating the cookie travelling over HTTP, are often closed as informational or low severity.
What happened, in plain words
IRCCloud is a web application: a service you use through a browser, in this case one that keeps you connected to IRC chat networks. The researcher, cliantech, checked the cookie session of IRCCloud and found it was not flagged as secure. That cookie was missing a safety setting called Secure.
To follow this, you need three ideas.
A request is what your browser sends to a website when you open a page or click something: a message asking the server for content or asking it to do something. A response is what the server sends back, which can include the page itself and instructions for the browser.
A cookie is a small piece of text that a website asks the browser to store and to send back with every later request to that site. It works like a cloakroom ticket: the site hands you a ticket once, and from then on you show it to prove who you are, without repeating your password each time. A cookie that proves you are logged in is called a session token or session cookie.
HTTPS is the encrypted version of the web's normal protocol, HTTP. With HTTPS, the browser and the server agree on encryption, so anyone watching the network sees scrambled data rather than readable text. With plain HTTP, everything travels in the clear.
The report's point is simple. IRCCloud runs over HTTPS, so the connection is encrypted. But the session cookie was not marked Secure. The Secure attribute is an instruction to the browser: only send this cookie over HTTPS, never over plain HTTP. Without that instruction, the browser treats the cookie as safe to send over an unencrypted connection too.
The report puts it this way:
Whenever a cookie contains sensitive information or is a session token, then it should always be passed using an encrypted tunnel. For example, after logging into an application and a session token is set using a cookie, then verify it is tagged using the ";secure" flag. If it is not, then the browser believes it safe to pass via an unencrypted channel such as using HTTP.
That is the whole finding. The report does not show the cookie's name, the exact response header that set it, or how the researcher inspected it. It does not show the cookie actually being sent over plain HTTP. It also does not say whether other protective attributes were missing. The report was disclosed on 2014-05-15, was classified as a violation of secure design principles, and earned a bounty of 100.00 USD. No severity score is given, and no fix is described.
Why does this matter? Imagine the cloakroom ticket is written on a postcard. As long as you hand it over inside a sealed envelope (HTTPS), nobody else can read it. But if the browser is willing to hand the same ticket over in the open (HTTP), anyone standing between you and the site can read it. Without the flag, the browser considers it safe to send the session cookie over an unencrypted channel such as HTTP. The report does not demonstrate an attack against IRCCloud.
In general, how this kind of bug works
Cookies are tied to a domain and a path, and by default a cookie set by an HTTPS page is still sent with requests to the same host over HTTP. The Secure attribute changes that: the browser only includes the cookie in requests made over HTTPS.
Without it, any plaintext request to the host carries the cookie. That includes a request an attacker tricks your browser into making, for example through a link, an image loaded from the site, or another way of pulling in an HTTP resource on an HTTPS page. It also includes anyone who can watch the network, such as the operator of a shared Wi-Fi network.
A few practical points:
Secureis enforced by the browser, so it only helps if the browser honours it and if the site never needs the cookie over HTTP.- It does not stop an attacker who can already read the cookie another way, such as through cross-site scripting (injecting code into a page so it runs in your browser). That is why
HttpOnly, which stops JavaScript from reading the cookie, is a separate and complementary control. - Turning on
Securecan break things: if part of a site still serves pages over HTTP and relies on the cookie, those sessions stop working. That is often why the attribute is left off during a migration.
How to test for it
- Log in to the target over HTTPS and capture the login response, either in the browser's developer tools or through an intercepting proxy (a tool that sits between browser and server and lets you read the traffic).
- Read every
Set-Cookieheader in the response.Set-Cookieis the instruction the server sends to store a cookie, and it lists the cookie's attributes. Session cookies are the ones to care about: look for names suggesting a session, authentication or remember-me purpose. - For each session cookie, check whether
Secureis present. A session cookie set over HTTPS without it is a positive result. - Confirm the behaviour rather than assuming it: send a request to the same host over HTTP, for example by changing the scheme in the URL, and see whether the browser or client attaches the cookie. If it does, the finding is confirmed.
- Check the whole session lifecycle, not just login. Cookies set on logout, on password change, by remember-me features and by API endpoints can differ from the main login cookie.
Common false positives: a cookie that carries no sensitive state, such as a preference or a CSRF token that the server validates, is not a session token and its missing attribute is usually not a finding. A cookie set over HTTP but immediately replaced by an HTTPS-only cookie is also weaker than it looks. And a site that redirects all HTTP traffic to HTTPS and uses HSTS (a header that tells browsers to refuse plaintext connections after the first visit) still benefits from Secure, but the practical exposure is lower. Some programs treat the report as informational unless you can show the cookie actually leaving over plaintext.
How it is fixed
Set Secure on every cookie that carries session or authentication state, and on any cookie whose contents are sensitive. Do the same for HttpOnly where the cookie does not need to be read by JavaScript, and consider SameSite for cross-site request protection. Serve the whole site over HTTPS with a redirect from HTTP, and add HSTS. Audit the code paths that set cookies, including framework configuration, so that new cookies inherit the attributes by default.
Where to look
This class of bug hides where cookies are set outside the main login flow: API authentication endpoints, single sign-on callbacks, remember-me tokens, session refresh endpoints, and subdomains that share a parent domain. Useful signals include a site that is HTTPS-only on its main pages but still answers on port 80, mixed content warnings in the browser console, and cookies whose names suggest session state appearing in responses from secondary hosts.
To make the report land, show the exact Set-Cookie header with the sensitive value redacted, show that the cookie is attached to a plaintext request, and explain what an attacker on the network or via an HTTP subresource could do with it. Reports that only state the attribute is missing, without demonstrating the cookie travelling over HTTP, are often closed as informational or low severity.
Glossary
- HTTP: the protocol browsers and servers use to exchange requests and responses on the web, unencrypted.
- HTTPS: HTTP wrapped in encryption, so data in transit cannot be read by someone watching the network.
- Request: the message a browser sends to a server asking for a page or an action.
- Response: the message a server sends back, which can include content and instructions such as cookies.
- Cookie: a small piece of text a site asks the browser to store and send back with later requests to that site.
- Session token: a cookie value that proves you are logged in, so you do not resend your password each time.
Secureattribute: a cookie setting telling the browser to send the cookie only over HTTPS.HttpOnlyattribute: a cookie setting that stops JavaScript from reading the cookie.SameSiteattribute: a cookie setting that limits when the cookie is sent with requests originating from other sites.Set-Cookieheader: the server's instruction to the browser to store a cookie, listing its value and attributes.- HSTS: a header telling browsers to refuse plaintext connections to a site after the first visit.
- Cross-site scripting (XSS): injecting code into a page so it runs in a victim's browser.
- CSRF token: a value used to confirm a request came from the site's own pages, not from another site.
- Intercepting proxy: a tool placed between browser and server that lets you read and modify traffic.
- Mixed content: an HTTPS page that loads resources over plain HTTP.
- Port 80: the default network port for plain HTTP traffic.
- Bounty: a payment a company makes to someone who reports a valid security issue.