# CVE-2024-29895: Cacti command injection in cmd_realtime.php

> Unauthenticated attackers can execute arbitrary commands on Cacti servers if PHP register_argc_argv is enabled, allowing full system compromise.

- **Severity:** Critical 10.0 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 13 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-cr28-x256-xf5m, UBUNTU-CVE-2024-29895

## What is CVE-2024-29895?

CVE-2024-29895 is a critical command injection vulnerability in cacti, published on 13 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Cacti provides an operational monitoring and fault management framework. A command injection vulnerability on the 1.3.x DEV branch allows any unauthenticated user to execute arbitrary command on the server when `register_argc_argv` option of PHP is `On`. In `cmd_realtime.php` line 119, the `$poller_id` used as part of the command execution is sourced from `$_SERVER['argv']`, which can be controlled by URL when `register_argc_argv` option of PHP is `On`. And this option is `On` by default in many environments such as the main PHP Docker image for PHP. Commit 53e8014d1f082034e0646edc6286cde3800c683d contains a patch for the issue, but this commit was reverted in commit 99633903cad0de5ace636249de16f77e57a3c8fc.

Weakness: CWE-77 (Improper Neutralization of Special Elements used in a Command)

## Which versions are affected by CVE-2024-29895?


## How do I fix CVE-2024-29895?

No fix has been published for CVE-2024-29895 yet. Limit exposure of the affected software until one is available.

## Is CVE-2024-29895 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-29895 exists.

Public exploit code:

- CVE-2024-29895 PoC - Exploiting remote command execution in Cacti servers using the 1.3.X DEV branch builds (github_poc): https://github.com/Stuub/CVE-2024-29895-CactiRCE-PoC
- Cacti CVE-2024-29895 POC (github_poc): https://github.com/secunnix/CVE-2024-29895
- https://github.com/ticofookfook/CVE-2024-29895.py (github_poc): https://github.com/ticofookfook/CVE-2024-29895.py
- Cacti cmd_realtime.php - Command Injection (nuclei): http/cves/2024/CVE-2024-29895.yaml

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-29895 and fix it if it is affected.

What it is: CVE-2024-29895 is a critical command injection vulnerability in cacti, published on 13 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-29895 exists.

Affected product: cacti. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-29895/ (Markdown: https://insights.sbomify.com/CVE-2024-29895/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-29895
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-29895
- OSV: https://osv.dev/vulnerability/CVE-2024-29895

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-29895/
Summaries are generated and may contain mistakes; the official description above is the record.
