Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-2092

Creating cookies without the "secure" flag is security-sensitive

    Details

    • Message:
      Make sure creating this cookie without the "secure" flag is safe.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      C++, Objective-C, VB.Net
    • Covered Languages:
      C#, Java, PHP, Python
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min
    • Analysis Level:
      Semantic Analysis
    • Analysis Scope:
      Main Sources
    • Common Rule:
      Yes
    • CWE:
      CWE-614, CWE-311, CWE-315
    • OWASP:
      A3
    • SANS Top 25:
      Porous Defenses
    • FindSecBugs:
      INSECURE_COOKIE

      Description

      When a cookie is protected with the secure attribute set to true it will not be send by the browser over an unencrypted HTTP request and thus cannot be observed by an unauthorized person during a man-in-the-middle attack.

      Ask Yourself Whether

      • the cookie is for instance a session-cookie not designed to be sent over non-HTTPS communication.
      • it's not sure that the website contains mixed content or not (ie HTTPS everywhere or not)

      There is a risk if you answered yes to any of those questions.

      Recommended Secure Coding Practices

      • It is recommended to use HTTPs everywhere so setting the secure flag to true should be the default behaviour when creating cookies.
      • Set the secure flag to true for session-cookies.

      See

        Attachments

          Issue Links

          1.
          PHP RSPEC-3761 Language-Specification Active Unassigned
          2.
          C# RSPEC-4556 Language-Specification Active Unassigned
          3.
          Java RSPEC-4557 Language-Specification Active Unassigned
          4.
          Python RSPEC-5551 Language-Specification Active Unassigned
          5.
          Kotlin RSPEC-5576 Language-Specification Active Unassigned
          6.
          JavaScript RSPEC-5678 Language-Specification Active Unassigned

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ann.campbell.2 Ann Campbell
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: