Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tenable] Cookie Without SameSite Flag Detected (revisit when we upgrade to Django 2.1) #3070

Closed
Tracked by #137
lbeaufort opened this issue Jul 21, 2019 · 11 comments
Closed
Tracked by #137

Comments

@lbeaufort
Copy link
Member

lbeaufort commented Jul 21, 2019

1. Cookie Without SameSite Flag Detected

When the SameSite flag is set on a cookie, the browser will prevent it from being sent along with cross-site requests. This can help prevent Cross-Site Request Forgery (CSRF) attacks. |
Remediation path: If the cookie contains sensitive information, then the server should ensure that the cookie has the SameSite flag set. This flag can have two values: strict or lax. With the strict value the cookie will only be sent if the request originates from the same website. With the lax value the cookie will only be sent for GET requests.
References: https://www.owasp.org/index.php/SameSite

2. Cookie Without Secure Flag Detected

When the secure flag is set on a cookie, the browser will prevent it from being sent over a clear text channel (HTTP) and only allow it to be sent when an encrypted channel is used (HTTPS). The scanner discovered that a cookie was set by the server without the secure flag being set. Although the initial setting of this cookie was via an HTTPS connection, any HTTP link to the same server will result in the cookie being sent in clear text. Note that if the cookie does not contain sensitive information, the risk of this vulnerability is mitigated.
Remediation path: If the cookie contains sensitive information, then the server should ensure that the cookie has the secure flag set.
References:
https://www.owasp.org/index.php/SecureFlag

Moved #2 to #3102

@lbeaufort lbeaufort added the Security: low Remediate within 90 days label Jul 21, 2019
@lbeaufort lbeaufort added this to the Sprint 9.6 milestone Jul 21, 2019
@rfultz
Copy link
Contributor

rfultz commented Aug 1, 2019

@lbeaufort is there more information about this? Are the cookies in question being set on a specific page or section of the site? What's the name of those cookies? As far as I can see, the cookies that we set are secure, though we're using Google Analytics that may be setting simpler cookies even though we're requesting that it use the secure options.

@lbeaufort
Copy link
Member Author

lbeaufort commented Aug 1, 2019

Sorry the message is so vague, it's what I was sent. Here's the only other helpful data I could dig out from the report, let me know if this helps at all:

  • (URL of prod cloud.gov app, not proxy url - let me know if you need this) returned a cookie named 'csrftoken' that does not set the SameSite cookie flag correctly
  • (URL of prod cloud.gov app, not proxy url - let me know if you need this) returned cookie '_gat_GSA_ENOR0' without the Secure flag set.

@rfultz
Copy link
Contributor

rfultz commented Aug 5, 2019

Was working on this last week. Doesn't seem crucial for our cookie use (e.g., PII) but @patphongs advised to check with Michael. Will reach out to him.

@rfultz
Copy link
Contributor

rfultz commented Aug 7, 2019

It looks like we may not be able to address #1 until we upgrade to at least Django 2.1 when the SameSite capability was added: https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-SESSION_COOKIE_SAMESITE

@rfultz
Copy link
Contributor

rfultz commented Aug 7, 2019

I have an email out to GSA about #2

@rfultz
Copy link
Contributor

rfultz commented Aug 8, 2019

It looks like we may need to mark these two different issues as known / won't fix.

#1 - We can fix it after we upgrade to Django 2.1 but it's not a big issue for us since we aren't offering users anything near logins and we aren't collecting PII

#2- I got a reply from Freddie at DAP that the cookie doesn't contain PII (and, not being our cookie, we can't really change anything about it):

"The cookie you mention does not contain sensitive information. The information stored in that cookie is only used for Google Analytics and according to GA360 terms of service does not contain any personally identifiable information."

@rfultz
Copy link
Contributor

rfultz commented Aug 8, 2019

Moving #2 to #3102

@rfultz rfultz changed the title [Tenable] Insecure cookie settings (due 8/31/19) [Tenable] Cookie Without SameSite Flag Detected (due 8/31/19) Aug 8, 2019
@PaulClark2 PaulClark2 changed the title [Tenable] Cookie Without SameSite Flag Detected (due 8/31/19) [Tenable] Cookie Without SameSite Flag Detected (revisit when we upgrade to Django 2.1) Aug 8, 2019
@PaulClark2
Copy link
Contributor

Blocked until we upgrade to Django 2.1. Leaving in the blocked pipeline for now.

@PaulClark2 PaulClark2 removed this from the Sprint 10.1 milestone Sep 5, 2019
@PaulClark2 PaulClark2 added this to the Sprint 11.6 milestone Feb 29, 2020
@pkfec pkfec self-assigned this Mar 3, 2020
@pkfec
Copy link
Contributor

pkfec commented Mar 4, 2020

Django was recently upgraded to LTS v2.2.10 and deployed to dev space on 02/28/2020. With the latest upgrade, the CSRF token will be set to Lax by default (for GET requests) which means the browser will not send the cookie cross-domain with unsafe requests (like POST).
I verified that the CSRF token is now being set to Lax in both dev and stage spaces. We should see this token set in Production after 11.5 release(03/10/2020).

The CSRF token is NOW set after the Django upgrade. We can close this issue.

Django v2.2 documentation:
:https://docs.djangoproject.com/en/2.2/ref/settings/#session-cookie-samesite

cc @rfultz @patphongs @lbeaufort

@pkfec pkfec closed this as completed Mar 5, 2020
@lbeaufort lbeaufort reopened this Sep 24, 2020
@jason-upchurch
Copy link
Contributor

@lbeaufort @pkfec @patphongs this was reopened so I'm moving it from Sprint 11.6 to "no milestone" and adding "Needs prioritization".

@jason-upchurch jason-upchurch removed this from the Sprint 11.6 milestone Oct 11, 2020
@patphongs
Copy link
Member

Samesite flag is set on the CSRF token, this is remediated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants