cve.bz

CVE-2022-46169 Cacti Command Injection Vulnerability

9.8 criticalKEVExploitEPSS 99.8%Fix available

Critical (9.8) in Cacti Cacti. In CISA KEV since 2023-02-16. EPSS 99.8% estimated probability of exploitation activity in the next 30 days.

On this page
Cacti is an open source platform which provides a robust and extensible operational monitoring and fault management framework for users. In affected versions a command injection vulnerability allows an unauthenticated user to execute arbitrary code on a server running Cacti, if a specific data source was selected for any monitored device. The vulnerability resides in the `remote_agent.php` file. This file can be accessed without authentication. This function retrieves the IP address of the client via `get_client_addr` and resolves this IP address to the corresponding hostname via `gethostbyaddr`. After this, it is verified that an entry within the `poller` table exists, where the hostname corresponds to the resolved hostname. If such an entry was found, the function returns `true` and the client is authorized. This authorization can be bypassed due to the implementation of the `get_client_addr` function. The function is defined in the file `lib/functions.php` and checks serval `$_SERVER` variables to determine the IP address of the client. The variables beginning with `HTTP_` can be arbitrarily set by an attacker. Since there is a default entry in the `poller` table with the hostname of the server running Cacti, an attacker can bypass the authentication e.g. by providing the header `Forwarded-For: <TARGETIP>`. This way the function `get_client_addr` returns the IP address of the server running Cacti. The following call to `gethostbyaddr` will resolve this IP address to the hostname of the server, which will pass the `poller` hostname check because of the default entry. After the authorization of the `remote_agent.php` file is bypassed, an attacker can trigger different actions. One of these actions is called `polldata`. The called function `poll_for_data` retrieves a few request parameters and loads the corresponding `poller_item` entries from the database. If the `action` of a `poller_item` equals `POLLER_ACTION_SCRIPT_PHP`, the function `proc_open` is used to execute a PHP script. The attacker-controlled parameter `$poller_id` is retrieved via the function `get_nfilter_request_var`, which allows arbitrary strings. This variable is later inserted into the string passed to `proc_open`, which leads to a command injection vulnerability. By e.g. providing the `poller_id=;id` the `id` command is executed. In order to reach the vulnerable call, the attacker must provide a `host_id` and `local_data_id`, where the `action` of the corresponding `poller_item` is set to `POLLER_ACTION_SCRIPT_PHP`. Both of these ids (`host_id` and `local_data_id`) can easily be bruteforced. The only requirement is that a `poller_item` with an `POLLER_ACTION_SCRIPT_PHP` action exists. This is very likely on a productive instance because this action is added by some predefined templates like `Device - Uptime` or `Device - Polling Time`. This command injection vulnerability allows an unauthenticated user to execute arbitrary commands if a `poller_item` with the `action` type `POLLER_ACTION_SCRIPT_PHP` (`2`) is configured. The authorization bypass should be prevented by not allowing an attacker to make `get_client_addr` (file `lib/functions.php`) return an arbitrary IP address. This could be done by not honoring the `HTTP_...` `$_SERVER` variables. If these should be kept for compatibility reasons it should at least be prevented to fake the IP address of the server running Cacti. This vulnerability has been addressed in both the 1.2.x and 1.3.x release branches with `1.2.23` being the first release containing the patch.

Severity

CVSS 3.1

9.8 critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS
99.8% (unchanged from 99.8% a week ago; 99.8% 30 days ago) estimated probability of exploitation activity in the next 30 days; 100th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA KEV
listed 2023-02-16, due 2023-03-09
CISA's assessment (SSVC)
Exploitation: active · Automatable: no · Technical impact: total, assessed 2024-05-13. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWEs
CWE-78 Improper Neutralization of Special Elements used in an OS Command (OS Command Injection)
CWE-863 Incorrect Authorization
CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component (Injection)
OWASP Top 10
A01:2025 Broken Access Control, A05:2025 Injection
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2022-46169 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2022-46169?via=ask-ai-copy and https://cve.bz/cve/CVE-2022-46169?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2022-46169 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
cacti:cactibefore 1.2.23

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian10cacti1.2.2+ds1-2+deb10u5DLA-3252-1
Debian11cacti1.2.16+ds1-2+deb11u1DSA-5298-1
Debian12, 13, 14cacti1.2.22+ds1-3DEBIAN-CVE-2022-46169
UbuntuPro:18.04:LTScacti1.1.38+ds1-1ubuntu0.1~esm4UBUNTU-CVE-2022-46169 USN-7226-1
UbuntuPro:20.04:LTScacti1.2.10+ds1-1ubuntu1.1+esm2UBUNTU-CVE-2022-46169 USN-7226-1
UbuntuPro:22.04:LTScacti1.2.19+ds1-2ubuntu1.1+esm2UBUNTU-CVE-2022-46169 USN-7226-1
SUSEPackage Hub 12, Package Hub 15 SP4cacti, cacti-spine1.2.23-bp154.2.6.1openSUSE-SU-2023:0025-1
openSUSELeap 15.4cacti, cacti-spine1.2.23-bp154.2.6.1openSUSE-SU-2023:0025-1
openSUSETumbleweedcacti1.2.23-1.1openSUSE-SU-2024:12593-1

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · SUSE · openSUSE.

Public exploits

GitHub PoC

Repositories on GitHub named after this CVE or listed for it by the PoC-in-GitHub index. For those marked Harbor Check: matches CVE, Flawharbor read the code and found it implements this CVE's exploitation technique: read, not run, and its dependencies only checked for warning signs, so a pointer and no guarantee. The rest are unverified: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it. How Harbor Check reads them, and what it found.

Detection rules

Ways to detect this CVE, not exploit code: the nuclei template that checks a system for it, and the Suricata and Snort rules that name it. A rule set may ship a rule turned off, so check yours by its sid.

  • Nuclei template Cacti <=1.2.22 - Remote Command Injection
  • Emerging Threats Open ET EXPLOIT Possible Cacti Unauthenticated RCE Inbound M1 (CVE-2022-46169) sid 2043010
  • Emerging Threats Open ET EXPLOIT Possible Cacti Unauthenticated RCE Inbound M2 (CVE-2022-46169) sid 2043011

Attack patterns (CAPEC)

  • CAPEC-6 Argument Injection Likelihood: High · Severity: High
  • CAPEC-15 Command Delimiters Likelihood: High · Severity: High
  • CAPEC-43 Exploiting Multiple Input Interpretation Layers Likelihood: Medium · Severity: High
  • CAPEC-88 OS Command Injection Likelihood: High · Severity: High
  • CAPEC-108 Command Line Execution through SQL Injection Likelihood: Low · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits. More on the page of CWE-74 (37).

References

Check your stackJSON