/

CVE-2026-120647

Severity:

CRITICAL RISK

(9.8)

Content-Disposition Injection (CWE-116) in Perl CGI

CVE-2026-120647

Deferred

Vulnerability type

Category:

HTTP Header Parameter Injection

CWE:

CWE-116

Impact:

Response Filename Manipulation

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CGI for Perl can place an attachment filename into a quoted Content-Disposition parameter without escaping double quotes. If an application uses request-controlled data as that filename, the response header may contain an additional filename parameter, potentially changing the name under which a recipient saves the response.

Affected context

The issue affects applications using CGI for Perl versions before 5.00 when they generate attachment headers with header(-attachment => $name). It becomes risky when $name can be influenced by request data and is inserted into the quoted header parameter without appropriate encoding.

Exploit preconditions

  • Attack surface: An application endpoint that returns a response with a Content-Disposition attachment header
  • Required access: Ability to supply or influence the attachment name through a request; authentication requirements depend on the application
  • Trigger point: Generation of the response header using the supplied attachment name
  • Why exploitation is possible: Double quotes in the value are not escaped, allowing the parameter structure to be altered and a second filename parameter to be introduced

Why this happens

The underlying issue is improper output encoding for a structured HTTP header, classified as CWE-116. The attachment name is inserted into a quoted Content-Disposition parameter without escaping characters that have structural meaning in that context. As a result, input intended as data can be interpreted as part of the header's parameter syntax.

Potential impact

  • A response may advertise an attacker-influenced filename to the recipient
  • A client may save the response under a different name than the application intended
  • Misleading filenames could contribute to user confusion or unsafe file handling

General mitigation guidance

Defensive patterns focus on keeping untrusted data separate from header syntax.

  • Use header-generation APIs that correctly encode or validate parameter values.
  • Apply context-appropriate escaping for quoted header parameters, including special characters such as double quotes.
  • Prefer server-controlled attachment names or map user input to a constrained set of permitted names.
  • Validate filenames against a clear allowlist and reject values that do not meet the application's requirements.
  • Avoid granting unnecessary access to endpoints that generate downloadable responses.

How teams detect issues like this

Review attachment-header construction for direct interpolation of request-controlled values and check whether parameter values are encoded for the relevant header context. Static analysis can flag user input flowing into response headers without validation or encoding. Code review and policy checks can require use of approved header-building APIs and constrained filename handling; automated review tools may help identify these patterns.

Sources

SourceLink
github.comgithub.com/leejo/CGI.pm/commit/131280a5c5bc51b65797bd57ef0ee8da8468065b.patch
metacpan.orgmetacpan.org/release/LEEJO/CGI-4.72/source/lib/CGI.pm
metacpan.orgmetacpan.org/release/LEEJO/CGI-5.00/changes

Frequently asked

questions

If the application uses request-controlled data as the attachment name, altered header parameters may cause a client to use a different filename when saving the response.

The relevant prerequisite is the ability to influence the attachment name through an application request. Whether authentication is required depends on the endpoint's access controls.

Use a header-generation method that safely encodes parameter values, and constrain attachment names to application-approved values.

Treat header values as structured output: validate untrusted data, encode it for the specific header context, and review data flows into response headers.

Find out what's already
exploitable in your codebase.