GHSA-gxm5-99cw-xjw9: CRLF Injection
Impact
@fastify/busboy 3.2.1 and earlier retains a bare carriage return or line feed inside the parsed Content-Disposition parameters returned to the application. The multipart header parser ends a header line only on the two-byte \r\n sequence, so a lone CR or LF embedded in a part header is carried verbatim into the filename and field name delivered by the file and field events. An application that forwards the supplied filename or name into a CR/LF-sensitive sink cannot anticipate the embedded control character.
An attacker who uploads a file whose filename or field name contains a bare CR or LF can pollute filenames on disk when the upload is saved under its original name, inject forged lines into logs, or inject headers on a downstream hop that does not re-validate CR/LF, such as object-storage metadata or a proxied backend. Applications using @fastify/busboy directly, or through @fastify/multipart and its consumers, are affected.
Patches
Upgrade to @fastify/busboy 3.2.2 or later.
Workarounds
Validate or strip carriage return and line feed characters from the filename and field name before using them in any filesystem, logging, or outbound-header context.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/@fastify/busboyto a version that resolves this vulnerability.Fixed in 3.2.2 - Upgrade
Upgrade
@fastify/busboyto a version that resolves this vulnerability.Fixed in 3.2.2 - Compensating control
Validate or strip carriage return (CR) and line feed (LF) characters from multipart filename and field name values before using them in filesystem, logging, or outbound-header contexts.
Event History
Frequently Asked Questions
Which applications are exposed?
Applications using @fastify/busboy version 3.2.1 or earlier are affected, including applications that receive it through @fastify/multipart and its consumers. Risk depends on whether the application uses uploaded filenames or field names in filesystem paths, logs, or outbound metadata and headers.
What must an attacker do to exploit this?
An attacker must submit a multipart upload with a bare carriage return or line feed in a Content-Disposition filename or field name. Exploitation requires the application or a downstream service to use that value in a CR/LF-sensitive sink without re-validating it.
What can happen if vulnerable values reach an unsafe sink?
A supplied filename can pollute filenames when an upload is saved under its original name. Bare CR or LF characters can also create forged log lines or inject headers into downstream services such as object-storage metadata or a proxied backend.
What should be done if an immediate upgrade is not possible?
Validate or strip carriage return and line feed characters from every multipart filename and field name before using those values in filesystem operations, logging, or outbound requests. Upgrade to @fastify/busboy 3.2.2 or later when possible.
How can I assess whether my application is affected?
Check whether the resolved @fastify/busboy version is 3.2.1 or earlier, including transitive use through @fastify/multipart. Review handlers for file and field events that pass filename or name values to disk, logs, object-storage metadata, or proxied backends without CR/LF validation.