Summary
LibreNMS 1.65 contains a command injection vulnerability in the /graph.php API endpoint. An authenticated attacker with normal privileges may be able to execute arbitrary shell commands when crafted input reaches the affected command-processing logic.
Affected context
The vulnerability occurs in LibreNMS deployments using the affected /graph.php API endpoint. Risk is present when an authenticated user with normal privileges can submit input that is incorporated into an operating-system command without adequate separation, validation, or neutralization.
Exploit preconditions
- Attack surface: The
/graph.phpAPI endpoint - Required access: Authentication with normal user privileges
- Trigger point: Processing of attacker-influenced endpoint parameters
- Why exploitation is possible: Input may reach shell command construction or execution without sufficient command-boundary controls
Why this happens
The underlying issue is improper neutralization of special elements used in an operating-system command, mapping to CWE-77: Improper Neutralization of Special Elements used in a Command.
The insecure pattern occurs when application-controlled and user-controlled data are combined in a shell command or passed to a command interpreter without using safe argument handling and strict input constraints. This can cause data intended as a parameter to be interpreted as additional command syntax.
Potential impact
- An attacker may execute arbitrary shell commands under the privileges of the LibreNMS process.
- The application environment could be modified or disrupted.
- Sensitive monitoring data or configuration information could be accessed.
- The host or connected systems could face follow-on compromise, depending on process permissions and network reachability.
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from application workflows and reducing trust in endpoint input.
Common defensive patterns include:
- Prefer direct process APIs that pass arguments separately rather than invoking a shell.
- Apply strict allowlist validation for parameters that select graphs, files, formats, or other command-related values.
- Avoid constructing commands through string concatenation or interpolation.
- Enforce least-privilege permissions for the LibreNMS service account.
- Isolate monitoring components and restrict their access to sensitive host and network resources.
- Add centralized authorization and input-validation controls at API boundaries.
How teams detect issues like this
Organizations can look for command-injection risks through:
- Static analysis rules identifying shell execution APIs, command-string concatenation, and interpolation of request data.
- Code review checks for API parameters flowing into process execution, shell wrappers, or system utilities.
- Runtime monitoring of unexpected child processes, unusual command arguments, and shell activity from the LibreNMS service account.
- Web-application policy enforcement that restricts endpoint parameters to documented values and records anomalous requests.
- Automated security review tools that trace untrusted input into operating-system command sinks.

