/

CVE-2026-36576

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in docker-wkhtmltopdf-aas app.py HTTP Handler

CVE-2026-36576

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

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

An OS command injection vulnerability in the app.py component of openlabs docker-wkhtmltopdf-aas allows crafted POST requests to influence shell command execution within the container.

When user-controlled HTTP parameters are passed into command-line invocations without proper sanitization or escaping, an attacker may execute arbitrary system commands with the service's privileges.

Affected context

This vulnerability affects deployments of the docker-wkhtmltopdf-aas service up to commit 9f50579 where HTTP request data is used to construct command-line calls to wkhtmltopdf or related utilities.

It is most relevant in environments where:

  • The app.py HTTP API is exposed over a network
  • Clients can submit arbitrary or semi-structured POST bodies
  • The service runs with permissions that grant meaningful access to the filesystem or other internal services

The issue is triggered during request handling when user input is interpolated into shell commands rather than passed as strictly validated arguments.

Exploit preconditions

  • Attack surface: Network-exposed HTTP endpoint accepting POST requests (e.g., a PDF-as-a-service API).
  • Required access: Ability to send POST requests to the vulnerable service; no local access is required if the service is reachable over the network.
  • Trigger point: Parameters in the POST body that are used to construct or influence shell commands, such as URLs, options, or filenames.
  • Why exploitation is possible: User-controlled data is concatenated into command strings or passed through shells without robust validation, quoting, or strict argument whitelisting, allowing injection of additional shell metacharacters and commands.

Why this happens

The underlying issue is improper handling of untrusted input in OS command construction, corresponding to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

In app.py, input from HTTP POST requests is likely integrated into command-line strings used to invoke wkhtmltopdf or related tools, either via shell=True, direct concatenation, or template-style command assembly.

Because the code treats user input as text to be appended to a shell command rather than as data passed through a safe, argument-based API, attackers can introduce shell metacharacters, inject additional arguments, or chain arbitrary commands that the shell will interpret and execute.

Potential impact

  • Remote execution of arbitrary commands inside the container or host environment (depending on isolation).
  • Reading, modifying, or deleting files accessible to the service account.
  • Pivoting to other internal services reachable from the container network.
  • Downloading and running malware or backdoors from external locations.
  • Using the service as a foothold for broader infrastructure compromise or data exfiltration.

General mitigation guidance

Effective mitigation focuses on removing the ability for user input to alter shell interpretation and on tightening the execution environment:

  • Prefer APIs that construct commands as argument lists (e.g., exec-style calls) instead of shell-based command strings.
  • Enforce strict, allowlist-based validation for all user-supplied parameters that influence command execution (e.g., limited flags, known-safe URLs or formats).
  • Reject or normalize inputs containing shell metacharacters, control operators, or unexpected whitespace expansions.
  • Separate user-controlled data from executable logic by mapping high-level request options to fixed, pre-defined command templates and argument sets.
  • Run the service with least-privilege accounts and minimal filesystem and network access to limit the impact of any compromise.
  • Consider isolating the wkhtmltopdf execution in a further restricted sandbox or worker process with constrained capabilities.

How teams detect issues like this

Detection typically combines code-centric and runtime approaches:

  • Static analysis: Configure rules or linters to flag uses of shell=True, system(), popen(), or similar APIs where arguments include web request parameters or other untrusted sources.
  • Code review: Look for string concatenation or formatting that mixes request fields with command strings, and for missing validation or allowlists around command-related parameters.
  • Security testing: Use dynamic application security testing (DAST) or manual testing with benign command injection patterns in POST bodies to observe unexpected behavior.
  • Runtime monitoring: Inspect logs and command audit trails for anomalous arguments or shell metacharacters, and monitor containers for unusual process trees or outbound network connections.
  • Policy enforcement: Incorporate secure coding policies into CI pipelines to prevent merging patterns that construct shell commands from untrusted input.

Sources

SourceLink
github.comgithub.com/openlabs/docker-wkhtmltopdf-aas
github.comgithub.com/openlabs/docker-wkhtmltopdf-aas/blob/9f505797671c3339520dec5fc01dff3a6f324f2e/app.py#L40
github.comgithub.com/openlabs/docker-wkhtmltopdf-aas/issues/36
hub.docker.comhub.docker.com/r/openlabs/docker-wkhtmltopdf-aas

Frequently asked

questions

Yes. If the docker-wkhtmltopdf-aas service is exposed over a network, an attacker who can send crafted POST requests can potentially trigger command execution without local access.

Exploitation depends on how the API is deployed. If the vulnerable endpoint is publicly accessible and does not enforce strong authentication, an unauthenticated attacker may exploit it. If the service is restricted behind authentication or internal networks, access to that environment is required first.

The most robust approach is to stop passing user input into shell commands altogether: invoke wkhtmltopdf (or similar tools) using argument-list APIs without shell=True, strictly map request options to predefined, allowlisted arguments, and enforce strong validation on all user-supplied fields.

Establish defensive coding standards that prohibit constructing shell commands from untrusted data, adopt secure wrappers or libraries for command execution, enforce input validation and allowlisting, and integrate static analysis and security review checks into the development and CI/CD lifecycle.

Find out what's already
exploitable in your codebase.