/

CVE-2026-55420

Severity:

HIGH RISK

(7.5)

OS Command Injection (CWE-78) in Discourse PDF Uploads

CVE-2026-55420

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution on application server

Severity:

HIGH RISK

(7.5)

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

A command injection vulnerability in Discourse's PDF upload processing can allow crafted PDF files to trigger remote code execution on the server in certain non-default configurations.

When PDF handling is wired to unsafe system-level utilities, an attacker who can upload malicious PDFs may execute arbitrary commands with the application's server privileges.

Affected context

The vulnerability arises in Discourse deployments that enable PDF upload processing using external utilities or shell commands under non-default configurations.

It typically manifests where server-side PDF handling is implemented through command-line tools invoked with arguments derived from user-controlled upload data.

Installations using default configurations without custom PDF pipelines are less likely to be affected, but any environment that extends or modifies file-processing behavior should be considered in scope.

Exploit preconditions

  • Attack surface: Web-accessible file upload endpoints that accept PDF documents.
  • Required access: Ability to authenticate or otherwise gain the capability to upload PDFs to the affected Discourse instance.
  • Trigger point: Server-side processing of the uploaded PDF, especially when the file or its metadata is passed to shell commands or external utilities.
  • Why exploitation is possible: User-supplied input from the PDF upload (such as file path, name, or derived metadata) is concatenated or interpolated into shell commands without robust validation or safe execution APIs, enabling injection of additional command fragments.

Why this happens

This issue stems from the use of unsafe command execution patterns when handling uploaded PDFs.

Instead of invoking external tools via parameterized APIs or safely escaping arguments, the implementation likely constructs shell commands by combining static strings with values influenced by user uploads.

This pattern maps to CWE-78: OS Command Injection, where untrusted input is incorporated into command-line calls such that the shell interprets it as executable syntax rather than inert data.

Potential impact

  • Execution of arbitrary operating system commands under the application's service account.
  • Unauthorized access to or modification of application data and configuration files.
  • Lateral movement within the hosting environment, including pivoting to other services or databases.
  • Service disruption or denial of service through destructive commands or resource exhaustion.
  • Potential deployment of backdoors, malware, or persistence mechanisms on the host.

General mitigation guidance

Effective mitigation focuses on removing direct string-based command construction from file-processing paths and reducing trust in upload-derived data.

Safer patterns include:

  • Using high-level language libraries for PDF processing instead of delegating to shell utilities when possible.
  • When external tools are necessary, invoking them via APIs that accept argument arrays and avoid shell parsing, rather than constructing command strings.
  • Applying strict validation and normalization to filenames, paths, and metadata, ensuring only expected characters and structures are permitted.
  • Running file-processing components under dedicated, least-privileged identities with minimal filesystem and network access.
  • Isolating upload processing into constrained sandboxes or separate worker processes with tightly controlled interfaces.

How teams detect issues like this

Detection can rely on both code-centric and operational approaches:

  • Static analysis rules targeting dynamic shell command construction, especially where upload paths, filenames, or metadata are interpolated.
  • Code review checklists that flag uses of generic command execution primitives (e.g., system, exec, backticks, or shell-based wrappers) in file-processing logic.
  • Configuration audits to identify non-default PDF processing setups that wire uploads into external utilities.
  • Runtime monitoring for unusual process spawning behavior tied to PDF upload endpoints, including anomalous command lines or child processes.
  • Use of automated security testing tools to fuzz file upload endpoints and observe whether PDF uploads trigger unexpected commands or errors.

Sources

SourceLink
github.comgithub.com/discourse/discourse/commit/ca5a7e06167561928556afa2f237d67e459c6914
github.comgithub.com/discourse/discourse/releases/tag/v2026.1.5
github.comgithub.com/discourse/discourse/releases/tag/v2026.4.2
github.comgithub.com/discourse/discourse/releases/tag/v2026.5.1
github.comgithub.com/discourse/discourse/releases/tag/v2026.6.0
github.comgithub.com/discourse/discourse/security/advisories/GHSA-7wq5-jgww-5rw3

Frequently asked

questions

Yes, in configurations where PDF uploads are exposed over the network, a remote user who can upload files may exploit this issue by submitting specially crafted PDFs that reach the vulnerable processing pipeline.

The attacker typically needs the same level of access required to upload PDFs, which may be a regular authenticated user or, in some deployments, an unauthenticated user if public uploads are allowed.

The most robust fix pattern is to eliminate shell-based PDF handling from the upload path and instead use library-level APIs, or, if external tools are unavoidable, to invoke them via safe, parameterized interfaces that treat all user-influenced data strictly as arguments, not as shell-interpreted strings.

To prevent similar issues, adopt a standard practice of never concatenating untrusted data into command strings, enforce strong input validation for all upload-related fields, centralize command execution patterns behind vetted utility functions, and include file-processing paths in regular security reviews and automated static analysis.

Find out what's already
exploitable in your codebase.