CVE DatabaseCVE-2022-46169
한국어 권고문 →
CVE-2022-461699.8/CRITICALCISA KEVCWE-74CWE-78CWE-863

Cacti remote_agent.php Authentication Bypass and Remote Code Execution (RCE) Vulnerability Analysis (CVE-2022-46169)

⚡ Jump to Patch
Affected Vendors
cacti
Affected Components
cacti
Published Date
2022-12-05
CVSS v3.1
9.8
CRITICAL
EPSS (30d)
99.8%
FIRST.org
CISA KEV
Exploited

Executive & SecOps Summary

SECOPS ASSESSMENT
Affected Scope

Cacti versions 1.2.x up to 1.2.22, and 1.3.x development branches

Impact

Unauthenticated remote attackers can bypass authentication via HTTP header manipulation and execute arbitrary OS commands with the privileges of the web server

Mitigation

Immediately upgrade Cacti to version 1.2.23 or later, and restrict access to the monitoring interface

Affected Products & Version Scope

All Cacti versions 1.2.x up to 1.2.22, and 1.3.x development releases (Patched in 1.2.23)

Remediation & Live Workaround Commands

PATCH & WORKAROUND

1. Official Patch & Version Upgrade Commands

The recommended solution is to upgrade Cacti to version 1.2.23 or later. Use the following commands to download and apply the official patch.

bash
# Navigate to web root and download the patched release
cd /var/www/html
wget https://github.com/Cacti/cacti/archive/refs/tags/release-1.2.23.tar.gz
tar -zxvf release-1.2.23.tar.gz

# Backup and replace with the updated files
cp -r cacti-release-1.2.23/* ./cacti/
chown -R apache:apache ./cacti/

2. Temporary Workaround & Hardening Configuration

If an immediate upgrade is not feasible, restrict access to remote_agent.php at the web server level to allow only trusted poller IPs.

nginx
# Nginx configuration: Restrict remote_agent.php access to internal subnets
location ~* remote_agent\.php$ {
    allow 10.0.0.0/8;
    allow 192.168.0.0/16;
    deny all;
    
    fastcgi_pass unix:/run/php-fpm/www.sock;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

3. Log Audit & IoC Verification Commands

Inspect web server access logs for suspicious requests targeting remote_agent.php with the polldata action and command injection payloads.

bash
# Search for unauthorized access attempts to remote_agent.php
grep -Ei 'remote_agent\.php.*action=polldata' /var/log/httpd/*access_log /var/log/nginx/access.log 2>/dev/null

# Check for command injection patterns in the poller_id parameter
grep -Ei 'poller_id=.*[%3b|%7c|;|\|]' /var/log/httpd/*access_log /var/log/nginx/access.log 2>/dev/null
Interactive SecOps Remediation Checklist
0/4 (0%)
Recommended Security Control & Mitigation Partner
Cloudflare Enterprise & Pro WAF
Isolate Cacti servers from the public internet and immediately upgrade to version 1.2.23 or higher.

Block Exploits Instantly with Managed Virtual Patching Rules

Can't patch production immediately? Deploy managed WAF rules at the edge to intercept RCE, SQLi, and deserialization payloads before they hit your origin server.

3-min setup · Automated Zero-Day Managed Rules
Practice Exploiting & Patching This Web Vulnerability in an Interactive Lab
Launch Hands-On Security Lab

Technical Root Cause & Exploitation Mechanics

1. Vulnerability Overview & Root Cause

This vulnerability exists in the remote_agent.php file and the client IP resolution logic within lib/functions.php of Cacti. The remote_agent.php endpoint is accessible without authentication. It verifies the client's authorization by calling get_client_addr to retrieve the IP address and resolving it to a hostname via gethostbyaddr. However, get_client_addr trusts client-controlled $_SERVER variables (such as HTTP_X_FORWARDED_FOR). Since Cacti databases contain a default entry in the poller table matching the server's own hostname, an attacker can spoof the server's IP address using headers like Forwarded-For to bypass the authentication check.

2. Exploitation Mechanics & Attack Scenario

Once the authentication bypass is achieved, the attacker can trigger the polldata action within remote_agent.php. The attacker brute-forces the host_id and local_data_id parameters to locate a valid poller item where the action is set to POLLER_ACTION_SCRIPT_PHP. When a matching item is found, the poll_for_data function is executed, which eventually invokes proc_open to run a PHP script. Because the attacker-controlled poller_id parameter is retrieved via get_nfilter_request_var without proper sanitization, it is directly concatenated into the command string passed to proc_open, leading to arbitrary command injection (e.g., appending ;id).

3. Infrastructure & Business Impact

Cacti is a critical infrastructure monitoring platform. This vulnerability has a CVSS score of 9.8 and is listed in the CISA KEV catalog due to active exploitation in the wild. Successful exploitation allows complete takeover of the Cacti server, potentially exposing sensitive infrastructure credentials (such as SNMP community strings and API keys) and allowing lateral movement into internal networks, resulting in severe business disruption.

Official Vendor Advisories & References

NVD Original English Description

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.

Frequently Asked SecOps Questions (CVE-2022-46169)

FAQ

Q1. How critical is CVE-2022-46169 and is it actively exploited in the wild?

CVE-2022-46169 is rated CVSS 9.8 (CRITICAL) with a 30-day EPSS exploitation probability of 99.8%. It is listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, requiring immediate emergency remediation.

Q2. Which vendors and products are affected by CVE-2022-46169?

Primary impacted vendors include cacti across cacti. Scope summary: All Cacti versions 1.2.x up to 1.2.22, and 1.3.x development releases (Patched in 1.2.23)

Q3. What temporary mitigations or workarounds exist for CVE-2022-46169 before patching?

[Mitigation] Immediately upgrade Cacti to version 1.2.23 or later, and restrict access to the monitoring interface Follow the CLI remediation commands and interactive SecOps checklist on this page to restrict exposure prior to your maintenance window.

SECOPS WORKBENCH INTEGRATION

Generate an Internal Engineering Notice or CISO Report for CVE-2022-46169

Instantly format this advisory into an executive CISO summary or engineering patch ticket.

Generate Report →

🔗 Related Advisories in Similar Stack (cacti)

View Category →
SecOps Advisory Dispatch & RSS Feed

Subscribe to Daily Vulnerability Briefings & KEV Alerts

Concise morning briefings for SecOps, DevSecOps, and SRE teams covering newly exploited CVEs and mitigation priorities.

Slack / Teams / RSS Feed:
PatchKO
CVE-2022-46169 Cacti remote_agent.php Authentication Bypass and Remote Code Execution (RCE) Vulnerability Analysis (CVE-2022-46169) (CVSS 9.8) - Patch & Workaround | CVE Pulse