CVE-2025-32442: Fastify Fastify Vulnerable To Invalid Content-type Vulnerability
HIGHCVE-2025-32442 is a HIGH (CVSS 7.5) fastify vulnerable to invalid content-type vulnerability (CWE-1287: Improper Validation of Specified Type of Input) affecting Fastify libraries in the npm ecosystem. The issue involves fastify vulnerable to invalid content-type parsing, which could lead to validation bypass. Remediation is available by upgrading affected packages to version 5.3.2, 4.29.1.
CVE-2025-32442 at a Glance
Security Impact
CVSS: 7.5
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:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2025-32442
To remediate this vulnerability, upgrade all affected Fastify 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@5.3.2
npm install fastify@4.29.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls fastify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-32442, inspect your project dependencies using npm:
npm ls fastify
Analyze the terminal output to locate any version of Fastify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.3.2), your application is affected.
Note: The npm ls fastify 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-1287: Improper Validation of Specified Type of Input, where the product receives input that is expected to be of a certain type, but it does not validate or incorrectly validates that the input is actually of the expected type. In Fastify, 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-2025-32442 Affected Fastify Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
fastify
|
npm |
≥ 5.0.0
< 5.3.2
|
5.3.2
|
|
fastify
|
npm |
≥ 4.29.0
< 4.29.1
All 1 versions
4.29.0
|
4.29.1
|
References
Frequently Asked Questions
What is CVE-2025-32442?
Which Fastify versions are affected?
What version fixes CVE-2025-32442?
Is fastify affected?
What is the CVSS score of CVE-2025-32442?
What CWE is associated with CVE-2025-32442?
How can I check npm dependencies for CVE-2025-32442?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mg2h-6x62-wpwc",
"modified" : "2025-05-29T21:04:54Z",
"published" : "2025-04-18T15:02:41Z",
"aliases" : [ "CVE-2025-32442" ],
"summary" : "Fastify vulnerable to invalid content-type parsing, which could lead to validation bypass",
"details" : "### Impact\n\nIn applications that specify different validation strategies for different content types, it's possible to bypass the validation by providing a _slightly altered_ content type such as with different casing or altered whitespacing before `;`.\n\nUsers using the the following pattern are affected:\n\n```js\nfastify.post('/', {\n handler(request, reply) {\n reply.code(200).send(request.body)\n },\n schema: {\n body: {\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n properties: {\n 'foo': {\n type: 'string',\n }\n },\n required: ['foo']\n }\n },\n }\n }\n }\n})\n```\n\nUser using the following pattern are **not** affected:\n\n```js\nfastify.post('/', {\n handler(request, reply) {\n reply.code(200).send(request.body)\n },\n schema: {\n body: {\n type: 'object',\n properties: {\n 'foo': {\n type: 'string',\n }\n },\n required: ['foo']\n }\n }\n})\n```\n\n### Patches\n\nThis was patched in v5.3.1, but unfortunately it did not cover all problems. This has been fully patched in v5.3.2.\nVersion v4.9.0 was also affected by this issue. This has been fully patched in v4.9.1.\n\n### Workarounds\n\nDo not specify multiple content types in the schema.\n\n### References\n_Are there any links users can visit to find out more?_\n\nhttps://hackerone.com/reports/3087928",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "fastify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0"
}, {
"fixed" : "5.3.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.3.1"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "fastify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.29.0"
}, {
"fixed" : "4.29.1"
} ]
} ],
"versions" : [ "4.29.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify/security/advisories/GHSA-mg2h-6x62-wpwc"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-32442"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify/commit/436da4c06dfbbb8c24adee3a64de0c51e4f47418"
}, {
"type" : "WEB",
"url" : "https://github.com/fastify/fastify/commit/f3d2bcb3963cd570a582e5d39aab01a9ae692fe4"
}, {
"type" : "WEB",
"url" : "https://hackerone.com/reports/3087928"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/fastify/fastify"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1287" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-04-18T15:02:41Z",
"nvd_published_at" : "2025-04-18T16:15:23Z"
}
}