CVE-2026-124289

@fastify/multipart vulnerable to arbitrary file write via type confusion in saveRequestFiles()

Published Nov 16, 2026 CVSS 3.1 · 7.5 High EPSS n/a KEV · Not listed
Description
@fastify/multipart is the official Fastify plugin for handling multipart/form-data uploads. In versions 7.4.0 through 10.1.8, when the plugin is registered with the attachFieldsToBody option, the saveRequestFiles helper treats any object in the parsed request body that carries truthy file and buffer properties as an uploaded file. An unauthenticated client can forge such an object through a plain JSON request or a JSON-typed multipart field, so attacker-chosen bytes are written to the temporary directory while upload hooks and the file count and size limits are skipped, and the saved entry keeps the attacker's filename verbatim instead of being reduced to its basename. Because that filename can contain parent directory segments, applications that use it as a write destination, as the project README example does, are exposed to an arbitrary relative-path file write from a single request. The issue is fixed in @fastify/multipart 10.1.9, and users should upgrade to 10.1.9 or later. As a workaround, call saveRequestFiles only after confirming the request is multipart, and reduce each returned filename to its basename or validate it against an allowlist before using it as a destination.

Analysis

AI-generated

Technical impact

The vulnerability is a type‑confusion bug in the saveRequestFiles helper of the @fastify/multipart plugin. It allows an unauthenticated actor to forge a JSON object that the helper interprets as a file. The exploit causes arbitrary bytes to be written to a temporary folder without subjecting the input to upload limits or sanitization of the filename. Because the attacker can set any filename, including relative paths, the write can target any file under the working directory of the application.

Affected Systems

Affected: @fastify/multipart versions 7.4.0 through 10.1.8 , across all Node.js environments where the plugin is used with the attachFieldsToBody option.

Risk and Exploitability

The CVSS score of 7.5 marks this as a moderate‑high severity vulnerability. The EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog, so the exploitation probability is uncertain. The likely attack vector is an unauthenticated client sending a specially crafted JSON request that the plugin accepts as a multipart field, triggering the improper file creation and path traversal. Because the filename is preserved verbatim, any path segments supplied by the attacker are written directly, enabling arbitrary relative‑path file writes that affect the host file system.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade @fastify/multipart to version 10.1.9 or later
  • If an upgrade cannot be performed, verify that the incoming request is of multipart media type before calling saveRequestFiles, and reject or discard requests that are not multipart
  • After obtaining filenames from saveRequestFiles, strip any directory components by extracting the basename or validate against a strict allowlist before using the path for storage

Generated by OpenCVE AI on November 16, 2026 at 14:22 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Description @fastify/multipart is the official Fastify plugin for handling multipart/form-data uploads. In versions 7.4.0 through 10.1.8, when the plugin is registered with the attachFieldsToBody option, the saveRequestFiles helper treats any object in the parsed request body that carries truthy file and buffer properties as an uploaded file. An unauthenticated client can forge such an object through a plain JSON request or a JSON-typed multipart field, so attacker-chosen bytes are written to the temporary directory while upload hooks and the file count and size limits are skipped, and the saved entry keeps the attacker's filename verbatim instead of being reduced to its basename. Because that filename can contain parent directory segments, applications that use it as a write destination, as the project README example does, are exposed to an arbitrary relative-path file write from a single request. The issue is fixed in @fastify/multipart 10.1.9, and users should upgrade to 10.1.9 or later. As a workaround, call saveRequestFiles only after confirming the request is multipart, and reduce each returned filename to its basename or validate it against an allowlist before using it as a destination.
Title @fastify/multipart vulnerable to arbitrary file write via type confusion in saveRequestFiles()
Weaknesses CWE-22
CWE-843
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N'}

Subscriptions

No data.

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

  • CWE-843

    Access of Resource Using Incompatible Type ('Type Confusion')

Sources

Status
PUBLISHED
Assigner
openjs
Published
Updated
Nov 16, 2026, 1:09 PM
Reserved
Nov 7, 2026, 10:46 AM
Status
Received
Published
Nov 16, 2026, 2:17 PM
Modified
Nov 16, 2026, 2:17 PM