Vulnerabilities in pkg:npm/fastify-csrf
PACKAGECVE-2020-28482 is a HIGH (CVSS 8.8) cross-site request forgery vulnerability (CWE-352: Cross-Site Request Forgery (CSRF)) affecting Fastify csrf libraries in the npm ecosystem. The issue involves cross-site request forgery in fastify-csrf. Remediation is available by upgrading affected packages to version 3.0.0.
pkg:npm/fastify-csrf
Vulnerability advisories affecting package pkg:npm/fastify-csrf. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-49wp-qq6x-g2rf | CVE-2020-28482 | HIGH | Cross-site Request Forgery in fastify-csrf |
| GHSA-rc4q-9m69-gqp8 | CVE-2021-29624 | MODERATE | Lack of protection against cookie tossing attacks in fastify-csrf |
CVE-2020-28482 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2020-28482
To remediate this vulnerability, upgrade all affected Fastify 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.
npm install fastify-csrf@3.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls fastify-csrf
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2020-28482, inspect your project dependencies using npm:
npm ls fastify-csrf
Analyze the terminal output to locate any version of Fastify csrf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.0), your application is affected.
Note: The npm ls fastify-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 CWE-352: Cross-Site Request Forgery (CSRF), where the web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor. In Fastify 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
CVE-2020-28482 Affected Fastify csrf Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
fastify-csrf
|
npm |
< 3.0.0
|
3.0.0
|
References
Frequently Asked Questions
What is CVE-2020-28482?
Which Fastify csrf versions are affected?
What version fixes CVE-2020-28482?
Is fastify-csrf affected?
What is the CVSS score of CVE-2020-28482?
What CWE is associated with CVE-2020-28482?
How can I check npm dependencies for CVE-2020-28482?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-49wp-qq6x-g2rf",
"modified" : "2022-06-29T21:54:32Z",
"published" : "2021-01-20T21:30:34Z",
"aliases" : [ "CVE-2020-28482" ],
"summary" : "Cross-site Request Forgery in fastify-csrf",
"details" : "The package fastify-csrf before 3.0.0 has a set of issues that affect its ability to do CSRF protection.\n1. The generated cookie used insecure defaults, and did not have the httpOnly flag on: `cookieOpts: { path: '/', sameSite: true }`\n2. The CSRF token was available in the GET query parameter",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "fastify-csrf"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-28482"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify-csrf/pull/26"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify-csrf/commit/3c9de36e9e73ce0eda9207f84f2ac0243e1f5253"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/fastify/fastify-csrf"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-FASTIFYCSRF-1062044"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/fastify-csrf"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-352" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-01-20T19:49:01Z",
"nvd_published_at" : "2021-01-19T15:15:00Z"
}
}