Vulnerabilities in pkg:npm/csrf-csrf

PACKAGE
Advisory Summary

GHSA-jjmg-x456-w976 is a LOW incorrect default cookie name and vulnerability (General Security Weakness) affecting Csrf csrf libraries in the npm ecosystem. The issue involves incorrect default cookie name and recommendation. Remediation is available by upgrading affected packages to version 2.2.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/csrf-csrf

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/csrf-csrf. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-jjmg-x456-w976 - LOW Incorrect default cookie name and recommendation

GHSA-jjmg-x456-w976 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-jjmg-x456-w976
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Csrf csrf
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-jjmg-x456-w976

To remediate this vulnerability, upgrade all affected Csrf csrf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

csrf-csrf fixed: 2.2.1
npm install csrf-csrf@2.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls csrf-csrf

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-jjmg-x456-w976, inspect your project dependencies using npm:

npm ls csrf-csrf

Analyze the terminal output to locate any version of Csrf csrf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.1), your application is affected.

Note: The npm ls csrf-csrf command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Csrf csrf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact _What kind of vulnerability is it? Who is impacted?_ The default cookie name (and documentation recommendation) was prefixed with `Host__` instead of `__Host-`. The point of this prefix is for additional security, to ensure that, when no domain option is provided in the cookie options, we can guarantee the cookie came from the correct domain. ### Patches _Has the problem been patched? What versions should users upgrade to?_ Yes, the problem is patched from version 2.2.1, this will not be back ported, but you can use the workaround described below. ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ You can work around this by providing a custom `cookieName` as part of the options, which is correctly prefixed with `__Host-`. ### References _Are there any links users can visit to find out more?_ https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#cookie-with-__host-prefix ### For more information If you have any questions or comments about this advisory: * Reach out on the [Psifi Solutions Discord](https://psifisolutions.com/discord) in the `#psifi-support` channel

GHSA-jjmg-x456-w976 Affected Csrf csrf Versions

1 component(s)
Fixed Versions:
2.2.1
Product / Package Ecosystem Affected Versions Fixed Version
csrf-csrf
npm
< 2.2.1
2.2.1

References

Frequently Asked Questions

What is GHSA-jjmg-x456-w976?
GHSA-jjmg-x456-w976 is a security vulnerability in Csrf csrf involving Incorrect default cookie name and recommendation under General Security Weakness.
Which Csrf csrf versions are affected?
Affected versions include releases prior to 2.2.1 across affected packages: csrf-csrf.
What version fixes GHSA-jjmg-x456-w976?
Upgrading to 2.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is csrf-csrf affected?
Yes, csrf-csrf is affected in releases prior to 2.2.1. Upgrade your dependency to 2.2.1 or later.
What CWE is associated with GHSA-jjmg-x456-w976?
GHSA-jjmg-x456-w976 is classified under General Security Weakness.
How can I check npm dependencies for GHSA-jjmg-x456-w976?
Run the dependency tree command: 'npm ls csrf-csrf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jjmg-x456-w976",
  "modified" : "2022-10-10T20:59:02Z",
  "published" : "2022-10-10T20:59:02Z",
  "aliases" : [ ],
  "summary" : "Incorrect default cookie name and recommendation",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nThe default cookie name (and documentation recommendation) was prefixed with `Host__` instead of `__Host-`. The point of this prefix is for additional security, to ensure that, when no domain option is provided in the cookie options, we can guarantee the cookie came from the correct domain.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nYes, the problem is patched from version 2.2.1, this will not be back ported, but you can use the workaround described below.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nYou can work around this by providing a custom `cookieName` as part of the options, which is correctly prefixed with `__Host-`.\n\n### References\n_Are there any links users can visit to find out more?_\n\nhttps://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#cookie-with-__host-prefix\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Reach out on the [Psifi Solutions Discord](https://psifisolutions.com/discord) in the `#psifi-support` channel\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "csrf-csrf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Psifi-Solutions/csrf-csrf/security/advisories/GHSA-jjmg-x456-w976"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Psifi-Solutions/csrf-csrf/commit/8f1ce8db97d945a4bb7f39f0b43c6041fa83d675"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Psifi-Solutions/csrf-csrf"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-10T20:59:02Z",
    "nvd_published_at" : null
  }
}