/

CVE-2025-65791

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in ZoneMinder image.php View

CVE-2025-65791

Modified

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

ZoneMinder v1.36.34 contains an OS command injection vulnerability in web/views/image.php, where user input is passed directly to PHP's exec() without proper sanitization.

An attacker who can reach this endpoint may execute arbitrary system commands with the privileges of the web server process, potentially leading to full server compromise.

Affected context

The vulnerability occurs in ZoneMinder's web interface, specifically in the image.php view responsible for handling image-related requests.

It manifests when user-supplied parameters are incorporated into shell commands executed via exec() without robust validation, escaping, or use of safer APIs.

This is most relevant in deployments where the ZoneMinder web UI is exposed to untrusted networks or shared multi-tenant environments.

Exploit preconditions

  • Attack surface: HTTP(S) requests to the ZoneMinder web interface, targeting web/views/image.php.
  • Required access: Network access to the ZoneMinder web server endpoint; authentication requirements depend on how the instance is configured, but exploitation can be possible wherever the affected view is reachable with attacker-controlled parameters.
  • Trigger point: Submission of crafted request parameters that are concatenated into a shell command executed by exec().
  • Why exploitation is possible: The application interpolates unvalidated user input directly into OS-level commands, allowing attackers to break out of expected arguments and inject arbitrary shell syntax.

Why this happens

This issue is rooted in CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

The vulnerable code path constructs shell commands by concatenating user input and passes the resulting string to PHP's exec() function.

Without strict input validation, allowlisting, or proper argument separation, shell metacharacters in the input are interpreted by the command processor, enabling arbitrary command execution instead of just executing the intended operation.

Potential impact

  • Remote execution of arbitrary commands on the ZoneMinder host
  • Reading, modifying, or deleting files accessible to the web server user
  • Installing backdoors, web shells, or additional malicious software
  • Pivoting to other systems on the same network
  • Exfiltration or destruction of captured surveillance video and configuration data

General mitigation guidance

Effective mitigation focuses on eliminating direct command construction from user input and reducing the privilege of any necessary command execution.

Recommended patterns include:

  • Replacing shell-based operations with native language APIs or libraries that do not invoke a shell.
  • If external binaries must be called, using process execution APIs that pass arguments as arrays (bypassing the shell) and strictly validating or allowlisting all parameters.
  • Applying strong, context-aware input validation and canonicalization, rejecting any unexpected characters or values at the boundary.
  • Running the web server and ZoneMinder components with least-privilege accounts and minimizing OS-level capabilities.
  • Isolating the application using containers, jails, or similar sandboxing technologies to limit the blast radius of a compromise.

How teams detect issues like this

Detection generally relies on a combination of code-focused and runtime-focused approaches:

  • Static analysis: Searching for uses of exec(), system(), shell_exec(), ` (backticks), or similar APIs where arguments are derived from $_GET, $_POST, or other request variables without validation.
  • Code review: Flagging any path where user input is incorporated into command strings, especially in controller or view files like image.php, and verifying the presence of allowlists and safe execution patterns.
  • Security testing: Performing focused dynamic testing on endpoints that trigger OS-level operations, looking for input that alters command structure.
  • Runtime monitoring: Using web application firewalls (WAFs) or intrusion detection systems to monitor for suspicious payloads containing shell metacharacters in parameters associated with image or media endpoints.

Sources

SourceLink
github.comgithub.com/rishavand1/CVE-2025-65791

Frequently asked

questions

Yes. If the vulnerable image.php endpoint is reachable over the network and accepts attacker-controlled input, an attacker can exploit it remotely.

That depends on how ZoneMinder is configured. If the image view is exposed without authentication or with weak access controls, unauthenticated exploitation may be possible. Where strong authentication and access restrictions protect the endpoint, an attacker would first need valid access.

The safest pattern is to remove shell command construction from user input entirely, replacing it with native PHP or library functionality. If external processes are truly necessary, use safe process execution APIs with strict allowlisted parameters and avoid invoking a shell.

Adopt development practices that forbid direct use of shell execution APIs with user input, enforce input validation guidelines, integrate static analysis and security checks into CI pipelines, and require security review for any code that interacts with the operating system.

Find out what's already
exploitable in your codebase.