Severity:

CRITICAL RISK

(9.1)

OS Command Injection in Perl HTTP::Daemon

CVE-2026-8450

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-73, CWE-78

Impact:

Remote Code Execution and Arbitrary File Write

Severity:

CRITICAL RISK

(9.1)

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

Perl's HTTP::Daemon module prior to version 6.17 contains an OS command injection flaw in the send_file() helper, which passes its string argument directly to Perl's 2-argument open().

If untrusted data is used as the send_file() path, an attacker can trigger shell-style "magic" prefixes, execute arbitrary commands with the daemon's privileges, exfiltrate command output in HTTP responses, or create/overwrite files on the server.

Affected context

This vulnerability occurs in applications built on top of Perl's HTTP::Daemon that use the send_file() method with user-influenced values.

It is most relevant when:

  • The HTTP server dynamically determines the argument to send_file() from request parameters, headers, or other untrusted sources.
  • The daemon process runs with permissions that give access to sensitive files or system utilities.
  • There is no sanitization or strict validation of the file paths or tokens passed into send_file().

In such contexts, the 2-argument open() call inside send_file() becomes an unintended command execution and file system primitive.

Exploit preconditions

  • Attack surface: Remote HTTP endpoints that cause the server to call HTTP::Daemon::send_file().
  • Required access: Ability to send crafted HTTP requests influencing the string passed to send_file() (e.g., path segments, query parameters, or other request-controlled values).
  • Trigger point: Invocation of send_file($user_controlled_string), where the string is interpreted by Perl's 2-arg open() as:
  • A command pipeline, e.g., "| cmd" or "cmd |"
  • A write or append target, e.g., "> path" or ">> path"
  • Why exploitation is possible: Perl's 2-arg open() treats certain leading characters as directives to spawn subprocesses or open file handles with specific modes.

send_file() forwards its argument directly into this API without enforcing a neutral file-open mode or stripping special prefixes, enabling untrusted input to control process creation and file operations.

Why this happens

The underlying issue is the use of Perl's 2-argument open() with user-influenced data, an insecure pattern that blends data with control instructions.

In this pattern, a seemingly benign "file name" string is overloaded to encode shell-like behavior:

  • Strings starting with "|" or ending with "|" create pipes to subprocesses.
  • Strings starting with ">" or ">>" open files for write or append.

HTTP::Daemon::send_file() relies on this 2-arg open() signature without constraining its semantics, which maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command and, due to unintended control of filesystem targets, also relates to CWE-73: External Control of File Name or Path.

Conceptually, the bug is that the API treats untrusted "file" input as executable instructions, violating the principle of strict separation between data and command channels.

Potential impact

  • Remote execution of arbitrary OS commands under the daemon process UID.
  • Inclusion of subprocess stdout directly into HTTP responses ("cmd |" behavior), enabling data exfiltration or arbitrary content injection.
  • Creation, truncation, or modification of files at attacker-controlled paths using write or append prefixes ("> path", ">> path").
  • Potential overwrite of configuration, log, or application files, degrading integrity and availability.
  • Use of file writes and command execution as building blocks for further privilege escalation or lateral movement within the environment.

General mitigation guidance

Effective mitigation focuses on removing command semantics from file-handling paths and strictly controlling filenames derived from external input.

General defensive patterns include:

  • Avoiding APIs that overload their arguments with command or mode directives (e.g., Perl's 2-arg open()) when the argument can be influenced by user input; prefer safer alternatives (e.g., 3-arg open() or dedicated file APIs) that require explicit mode and treat the path as pure data.
  • Implementing strict allowlists for file paths used in send_file()-like helpers, such as mapping request tokens to a predefined set of files or directories instead of passing raw user input.
  • Normalizing and validating paths before use: reject any value that begins with or contains characters or patterns associated with pipes, redirections, or other special open() semantics.
  • Running the HTTP daemon with the least privileges necessary, isolating it in a constrained account, chroot, or container to limit file-system and process-level blast radius.
  • Separating static file serving from dynamic logic, using hardened, purpose-built components (e.g., a dedicated static file server) for untrusted file delivery paths.

How teams detect issues like this

Detection typically combines code-centric analysis with runtime and process-level observations:

  • Static analysis: Search for usages of HTTP::Daemon::send_file() and Perl's 2-argument open() where the argument is derived from request parameters, environment variables, or other untrusted sources.

Flag patterns where the argument is not passed through an allowlist or rigorous validation.

  • Code review signals: During manual review, pay attention to:
  • Any send_file() calls that accept user input directly or via thin wrappers.
  • open() calls with a single string argument that may contain "|", ">", or similar characters.
  • File-serving logic that interpolates user-controlled tokens into path strings without canonicalization.
  • Policy enforcement: Introduce project-wide guidelines or linters that:
  • Disallow 2-arg open() in HTTP handling code or require explicit justification and review.
  • Enforce patterns where file paths originate from safe enumerations, not raw input.
  • Runtime monitoring: Observe process creation patterns from the daemon process, unexpected child processes, or sudden changes in server-owned files which may indicate exploitation attempts.

Sources

SourceLink
github.comgithub.com/libwww-perl/HTTP-Daemon/commit/945d35141d94490f749640bd4390acd6a2193995.patch
github.comgithub.com/libwww-perl/HTTP-Daemon/pull/89
metacpan.orgmetacpan.org/release/OALDERS/HTTP-Daemon-6.17/changes
openwall.comopenwall.com/lists/oss-security/2026/05/27/5
lists.debian.orglists.debian.org/debian-lts-announce/2026/06/msg00028.html
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36187
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36188
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36189
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-8450
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2481773
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-8450.json

Frequently asked

questions

Yes, when an application built on HTTP::Daemon uses send_file() with values derived from HTTP requests, an attacker can supply crafted input that triggers the 2-arg open() behavior and executes commands or manipulates files.

The attacker generally needs only network access to reach the affected HTTP endpoint and the ability to control the data that flows into send_file().

No local shell access is required; exploitation occurs through crafted HTTP requests.

Refactor file-serving logic to:

  • Use APIs that treat the path as data only (e.g., 3-arg open() or other safer file-access routines), and
  • Restrict send_file()-style helpers to operate only on predefined, validated, and normalized file paths rather than raw user input.

This eliminates the implicit command channel from the path argument.

Adopt development practices that:

  • Prohibit or tightly control APIs that mix data with command semantics (such as 2-arg open(), shell() wrappers, or interpolated command strings).
  • Require allowlist-based validation for any user-derived value that influences file paths or process execution.
  • Integrate static analysis and code review checklists specifically targeting command injection and external file control patterns.
Find out what's already
exploitable in your codebase.