Skip to content
Heist/ feed
Back to feed
Medium

fastify vulnerable to schema validation bypass via root primitive coercion mismatch

Type: advisorySources: OSV

fastify is a fast and low overhead web framework for Node.js. Versions of fastify before 5.12.1 are affected by a schema validation bypass when a request body schema targets a root primitive value. When the schema validates a top-level primitive such as an integer, Ajv can coerce a JSON string into the expected type during validation, but Fastify does not replace the root request body with the coerced value, so the route handler receives the original unvalidated string. As a result, a request that should have failed validation can reach application logic with a value that does not satisfy the schema, which can undermine integrity and access-control checks that rely on the validated type. Users should upgrade to fastify 5.12.1, which fixes the mismatch. No known workarounds are available.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-18504
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 03:47 UTC · Revision 1

Source evidence

fastify vulnerable to schema validation bypass via root primitive coercion mismatch

core-osv · Original source

Published 18 Aug 2026, 20:19 UTC

fastify is a fast and low overhead web framework for Node.js. Versions of fastify before 5.12.1 are affected by a schema validation bypass when a request body schema targets a root primitive value. When the schema validates a top-level primitive such as an integer, Ajv can coerce a JSON string into the expected type during validation, but Fastify does not replace the root request body with the coerced value, so the route handler receives the original unvalidated string. As a result, a request that should have failed validation can reach application logic with a value that does not satisfy the schema, which can undermine integrity and access-control checks that rely on the validated type. Users should upgrade to fastify 5.12.1, which fixes the mismatch. No known workarounds are available.

osv:CVE-2026-18504
Complete source record
{
  "id": "3cc112c4f46d261ad5df711a1de341f835344e83c53b5dbcd5136ba51d9f7102",
  "url": "https://osv.dev/vulnerability/CVE-2026-18504",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "fastify vulnerable to schema validation bypass via root primitive coercion mismatch",
    "summary": "fastify is a fast and low overhead web framework for Node.js. Versions of fastify before 5.12.1 are affected by a schema validation bypass when a request body schema targets a root primitive value. When the schema validates a top-level primitive such as an integer, Ajv can coerce a JSON string into the expected type during validation, but Fastify does not replace the root request body with the coerced value, so the route handler receives the original unvalidated string. As a result, a request that should have failed validation can reach application logic with a value that does not satisfy the schema, which can undermine integrity and access-control checks that rely on the validated type. Users should upgrade to fastify 5.12.1, which fixes the mismatch. No known workarounds are available.",
    "evidence": "osv:CVE-2026-18504",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-18504",
      "aliases": [
        "CVE-2026-18504",
        "GHSA-w2qp-rph6-63g4"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/fastify/fastify",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "7d196a998c422062a3aaa3f8041db91ad576cea0"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "5.12.1"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StandardRange"
                  },
                  {
                    "cpe": "cpe:2.3:a:fastify:fastify:*:*:*:*:*:node.js:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "5.12.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v5.12.0",
            "v5.11.3",
            "v5.11.2",
            "v5.11.1",
            "v5.11.0",
            "v5.10.0",
            "v5.9.0",
            "v5.8.5",
            "v5.8.4",
            "v5.8.3",
            "v5.8.2",
            "v5.8.1",
            "v5.8.0",
            "v5.7.4",
            "v5.7.3",
            "v5.7.2",
            "v5.7.1",
            "v5.7.0",
            "v5.6.2",
            "v5.6.1",
            "v5.6.0",
            "v5.5.0",
            "v5.4.0",
            "v5.3.3",
            "v5.3.2",
            "v5.3.1",
            "v5.3.0",
            "v5.2.2",
            "v5.2.1",
            "v5.2.0",
            "v5.1.0",
            "v5.0.0",
            "v5.0.0-alpha.4",
            "v5.0.0-alpha.2",
            "v5.0.0-alpha.1",
            "v4.5.2",
            "v4.5.1",
            "v4.5.0",
            "v4.4.0",
            "v4.3.0",
            "v4.2.1",
            "v4.2.0",
            "v4.1.0",
            "v4.0.3",
            "v4.0.2",
            "v4.0.1",
            "v4.0.0",
            "v4.0.0-rc.5",
            "v4.0.0-rc.4",
            "v4.0.0-rc.3",
            "v4.0.0-rc.2",
            "v4.0.0-rc.1",
            "v4.0.0-alpha.3",
            "v4.0.0-alpha.2",
            "v3.27.2",
            "v4.0.0-alpha.1",
            "v3.27.1",
            "v3.27.0",
            "v3.26.0",
            "v3.25.3",
            "v3.25.2",
            "v3.25.1",
            "v3.25.0",
            "v3.24.1",
            "v3.24.0",
            "v3.23.1",
            "v3.23.0",
            "v3.22.1",
            "v3.22.0",
            "v3.21.6",
            "v3.21.5",
            "v3.21.4",
            "v3.21.3",
            "v3.21.2",
            "v3.21.1",
            "v3.21.0",
            "v3.20.2",
            "v3.20.1",
            "v3.20.0",
            "v3.19.2",
            "v3.19.1",
            "v3.19.0",
            "v3.18.1",
            "v3.18.0",
            "v3.17.0",
            "v3.16.2",
            "v3.16.1",
            "v3.16.0",
            "v3.15.1",
            "v3.15.0",
            "v3.14.2",
            "v3.14.1",
            "v3.14.0",
            "v3.13.0",
            "v3.12.0",
            "v3.11.0",
            "v3.10.1",
            "v3.10.0",
            "v3.9.2",
            "v3.9.1",
            "v3.9.0",
            "v3.8.0",
            "v3.7.0",
            "v3.6.0",
            "v3.5.1",
            "v3.5.0",
            "v3.4.1",
            "v3.4.0",
            "v3.3.0",
            "v3.2.1",
            "v3.2.0",
            "v3.1.1",
            "v3.1.0",
            "v3.0.3",
            "v3.0.2",
            "v3.0.1",
            "v3.0.0",
            "v3.0.0-rc.5",
            "v2.15.1",
            "v3.0.0-rc.4",
            "v3.0.0-rc.3",
            "v3.0.0-rc.2",
            "v2.14.0",
            "v3.0.0-rc.1",
            "v3.0.0-alpha.1",
            "v2.3.0",
            "v2.2.0",
            "v2.1.0",
            "v2.0.1",
            "v2.0.0",
            "v2.0.0-rc.6",
            "v2.0.0-rc.5",
            "v2.0.0-rc.4",
            "v2.0.0-rc.3",
            "v2.0.0-rc.2",
            "v2.0.0-rc.1",
            "v2.0.0-rc.0",
            "v1.13.0",
            "v1.12.1",
            "v1.12.0",
            "v1.11.2",
            "v1.11.1",
            "v1.11.0",
            "v1.10.0",
            "v1.9.0",
            "v1.8.0",
            "v1.7.0",
            "v1.6.0",
            "v1.5.0",
            "v1.4.0",
            "v1.3.1",
            "v1.3.0",
            "v1.2.1",
            "v1.2.0",
            "v1.1.1",
            "v1.1.0",
            "v1.0.0",
            "v1.0.0-rc.3",
            "v1.0.0-rc.2",
            "v1.0.0-rc.1",
            "v0.43.0",
            "v0.42.0",
            "v0.41.0",
            "v0.40.0",
            "v0.39.1",
            "v0.39.0",
            "v0.38.0",
            "v0.37.0",
            "v0.36.0",
            "v0.35.7",
            "v0.35.6",
            "v0.35.5",
            "v0.35.4",
            "v0.35.3",
            "v0.35.2",
            "v0.35.1",
            "v0.35.0",
            "v0.34.0",
            "v0.33.0",
            "v0.32.0",
            "v0.31.0",
            "v0.30.3",
            "v0.30.1",
            "v0.30.2",
            "v0.30.0",
            "v0.29.2",
            "v0.29.1",
            "v0.29.0",
            "v0.28.2",
            "v0.28.1",
            "v0.28.0",
            "v0.27.0",
            "v0.26.2",
            "v0.26.1",
            "v0.26.0",
            "v0.25.3",
            "v0.25.2",
            "v0.25.1",
            "v0.25.0",
            "v0.24.0",
            "v0.22.0",
            "v0.23.0",
            "v0.21.0",
            "v0.20.1",
            "v0.20.0",
            "v0.19.1",
            "v0.19.0",
            "v0.18.0",
            "v0.17.0",
            "v0.16.0",
            "v0.15.3",
            "v0.15.2",
            "v0.15.1",
            "v0.15.0",
            "v0.14.1",
            "v0.14.0",
            "v0.13.1",
            "v0.13.0",
            "v0.12.0",
            "v0.11.1",
            "v0.11.0",
            "v0.10.0",
            "v0.9.0",
            "v0.8.0",
            "v0.7.1",
            "v0.7.0",
            "v0.6.0",
            "v0.5.0",
            "v0.4.0",
            "v0.3.0",
            "v0.2.0",
            "v0.1.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-18504.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:42.086904509Z",
      "provider": "osv",
      "references": [
        "https://cna.openjsf.org/security-advisories.html",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/18xxx/CVE-2026-18504.json",
        "https://github.com/fastify/fastify/security/advisories/GHSA-w2qp-rph6-63g4",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-18504"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-20"
        ],
        "cna_assigner": "openjs",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/18xxx/CVE-2026-18504.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-18504",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 509949,
  "published_at": "2026-08-18T20:19:12.611+00:00"
}