/

CVE-2026-120639

Severity:

HIGH RISK

(7.2)

HTTP Header Injection (CWE-113) in Perl CGI Module

CVE-2026-120639

Deferred

Vulnerability type

Category:

HTTP Header Injection

CWE:

CWE-113

Impact:

HTTP Response Splitting and Header Injection

Severity:

HIGH RISK

(7.2)

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 has HTTP header injection flaws when certain header values are checked before entity decoding or are not checked for newline characters. If an application passes attacker-controlled request data into these values, an attacker may add response headers or split the HTTP response.

Affected context

The issue affects CGI versions before 5.00 when applications use the affected header-writing paths. In header, the risk applies when autoEscape is off and extra header values are entity-decoded after the newline check. multipart_start does not check header values for newlines, and do_push does not check the type it prints in each part. The vulnerability becomes relevant when request-controlled data reaches these values.

Exploit preconditions

  • Attack surface: HTTP responses generated through the affected CGI header or multipart-writing functions
  • Required access: The ability to send requests whose data is used by the application in relevant header or part values; authentication depends on the application
  • Trigger point: Response generation through header, multipart_start, or do_push
  • Why exploitation is possible: Newline validation may be absent or may occur before entity decoding, allowing CR or LF characters to reach response output

Why this happens

The underlying issue is improper neutralization of CR and LF characters in HTTP headers, mapped to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting'). The insecure pattern is validating a value before transformations that can introduce control characters, or emitting values without newline checks. Unchecked output types can also undermine assumptions about what is written into multipart responses.

Potential impact

  • An attacker may add unauthorized headers to an HTTP response.
  • A crafted response could be split, potentially affecting how clients or intermediaries interpret it.
  • Depending on the application and deployment, response handling or downstream security controls could be affected.

General mitigation guidance

Defensive approaches focus on treating values used in response headers and multipart output as untrusted.

  • Prefer APIs that safely construct headers and reject CR and LF characters.
  • Normalize or decode values before validation, then enforce strict character and type checks at the output boundary.
  • Avoid passing request data directly into header values; use allowlisted, application-defined values where practical.
  • Apply least privilege and limit the impact of application compromise through appropriate runtime and deployment boundaries.

How teams detect issues like this

  • Use static analysis to find request-derived values flowing into header or multipart output functions.
  • Review whether validation occurs after all decoding and normalization, and whether every output path rejects newline characters and unexpected types.
  • Enforce code-review or CI policies that prohibit untrusted data in response metadata without an approved validation or safe-construction step.
  • Use security testing to verify that response generation handles newline-bearing and unexpected-type inputs safely.

Sources

SourceLink
github.comgithub.com/leejo/CGI.pm/commit/69955309d371c8093d11cf12e3ddef491537ffad.patch
github.comgithub.com/leejo/CGI.pm/commit/7733c2753f4f240012097507cda2b6e87ae46db4.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

Exploitation depends on an application using an affected CGI output path with values that an attacker can influence. The header path described is specifically risky when autoEscape is off; other affected paths have missing checks.

Not necessarily. The required access depends on whether the application exposes the relevant functionality publicly or restricts it behind authentication.

Use safe header-construction APIs and validate values after decoding or normalization, rejecting CR and LF characters before output.

Keep request data out of response metadata where possible, validate at output boundaries, check types as well as content, and include taint-flow and newline-handling checks in code review and CI.

Find out what's already
exploitable in your codebase.