All vulnerabilities

npm

CVE-2026-12143

form-data: CRLF injection in form-data via unescaped multipart field names and filenames

Severity
High 7.5
Published
15 Jun 2026
Last changed
10 Sept 2026
Added to UpHeron
22 Oct 2026
Fixed in
2.5.6, 3.0.5, 4.0.6
Exploit chance
0.7% in the next 30 daysHigher than 52% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
CRLF injection (CWE-93)
Attack
Over the network · No login needed · No user action needed
Attacker can
Change data
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Also known as
GHSA-hmw2-7cc7-3qxx
Sources
OSV.dev and GitHub

Description

form-data builds multipart/form-data request bodies. Through v4.0.5, the field name passed to FormData#append and the filename option are concatenated directly into the Content-Disposition header with no escaping of CR (\r), LF (\n), or ". An application that uses untrusted input as a field name or filename therefore lets an attacker terminate the header line and either inject additional headers or smuggle whole additional multipart parts into the request the application forwards to a backend.

This is CWE-93 (CRLF injection). It is a divergence from how browsers and the WHATWG HTML spec serialize form-data (they escape these characters), so the fix is to match that behavior. Severity is conditional: it depends on the consuming application passing attacker-controlled data as a field name or filename. Applications that only use fixed/trusted field names are not affected.

In lib/form_data.js, _multiPartHeader builds the part header as:

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

Until upgrading, validate or reject field names/filenames that contain control characters before calling append:

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
form-datanpm · osv:npm:form-data
  • Every version before 2.5.6
  • From 3.0.0 before 3.0.5
  • From 4.0.0 before 4.0.6

About form-data

Weekly downloads (npm)
226,491,607npm, 17 Nov 2026

This is the only vulnerability in form-data in our list.

References