HighGHSA-mg2h-6x62-wpwcCVE-2025-32442CVE-2026-33806GHSA-247c-9743-5963

Fastify vulnerable to invalid content-type parsing, which could lead to validation bypass

Published 18 Apr 2025 · Updated 8 Jul 2026

Affected packages

Affected
>=5.0.0 <5.3.2
Fixed in
5.3.2
Update to the fixed version for your release line, for example:npm install fastify@5.3.2
Affected
>=4.29.0 <4.29.1
Fixed in
4.29.1
Update to the fixed version for your release line, for example:npm install fastify@4.29.1

Details

Impact

In 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 ;.

Users using the the following pattern are affected:

fastify.post('/', {
  handler(request, reply) {
    reply.code(200).send(request.body)
  },
  schema: {
    body: {
      content: {
        'application/json': {
          schema: {
            type: 'object',
            properties: {
              'foo': {
                type: 'string',
              }
            },
            required: ['foo']
          }
        },
      }
    }
  }
})

User using the following pattern are not affected:

fastify.post('/', {
  handler(request, reply) {
    reply.code(200).send(request.body)
  },
  schema: {
    body: {
      type: 'object',
      properties: {
        'foo': {
          type: 'string',
        }
      },
      required: ['foo']
    }
  }
})

Patches

This was patched in v5.3.1, but unfortunately it did not cover all problems. This has been fully patched in v5.3.2. Version v4.9.0 was also affected by this issue. This has been fully patched in v4.9.1.

Workarounds

Do not specify multiple content types in the schema.

References

_Are there any links users can visit to find out more?_

https://hackerone.com/reports/3087928

Is GHSA-mg2h-6x62-wpwc in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected fastify, and gives you the command that fixes it.

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.