English Advisory →
CVE-2022-461699.8/CRITICALCISA KEV 등재CWE-74CWE-78CWE-863

Cacti remote_agent.php 인증 우회 및 원격 코드 실행(RCE) 취약점 분석 (CVE-2022-46169)

⚡ 패치 명령어 바로가기
영향받는 벤더 / 생태계
cacti
대상 컴포넌트 / 패키지
cacti
권고문 발행일
2022-12-05
CVSS v3.1
9.8
CRITICAL
30일 악용확률
99.8%
FIRST.org
CISA KEV
악용 확인됨

실무자 핵심 요약 (Executive Summary)

SECOPS ASSESSMENT
영향 대상

Cacti 1.2.x 버전군 중 1.2.22 이하 버전 및 1.3.x 개발 버전군

파급 효과

인증되지 않은 원격 공격자가 HTTP 헤더 변조를 통해 인증을 우회하고, 시스템 권한으로 임의의 OS 명령어를 실행하여 서버를 완전히 장악할 수 있습니다

권장 조치

Cacti 공식 패치 버전인 1.2.23 이상으로 즉시 업그레이드하고, 외부 노출된 모니터링 인터페이스에 대한 접근 제어를 강화하십시오

영향받는 제품 및 버전 범위

Cacti 1.2.22 이하의 모든 1.2.x 버전 및 1.3.x 개발 버전 (1.2.23 버전에서 패치 완료)

권장 패치 및 임시 완화(Workaround) 가이드

패치 및 우회 명령어

1. 공식 보안 패치 및 버전 업그레이드 명령어

가장 확실한 해결책은 취약점이 해결된 Cacti 1.2.23 이상 버전으로 업그레이드하는 것입니다. 아래 명령어를 사용하여 최신 안정 버전을 다운로드하고 설치하십시오.

bash
# Cacti 디렉토리로 이동 및 최신 소스 다운로드
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

# 기존 파일 백업 및 새 버전 덮어쓰기
cp -r cacti-release-1.2.23/* ./cacti/
chown -R apache:apache ./cacti/

2. 패치 전 임시 완화(Workaround) 및 접근 제어 설정

즉각적인 업그레이드가 어려운 경우, 웹 서버(Nginx/Apache) 설정을 변경하여 외부로부터의 remote_agent.php 접근을 원천 차단하거나 신뢰할 수 있는 Poller IP만 허용하도록 제한하십시오.

nginx
# Nginx 설정 예시: remote_agent.php 접근을 특정 내부 IP 대역으로만 제한
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. 침해 흔적(IoC) 및 로그·버전 점검 스크립트

웹 서버 액세스 로그에서 remote_agent.php를 호출하면서 polldata 액션과 함께 비정상적인 특수문자(예: ;, |, &)가 포함된 요청이 있는지 점검하십시오.

bash
# Apache/Nginx 로그에서 원격 코드 실행 시도 흔적 검색
grep -Ei 'remote_agent\.php.*action=polldata' /var/log/httpd/*access_log /var/log/nginx/access.log 2>/dev/null

# poller_id 매개변수에 세미콜론이나 파이프 등 명령 구분자가 포함되었는지 확인
grep -Ei 'poller_id=.*[%3b|%7c|;|\|]' /var/log/httpd/*access_log /var/log/nginx/access.log 2>/dev/null
실무자 패치 대응 자가 점검 체크리스트
0/4 (0%)
권장 아키텍처 방어 통제 (Recommended Security Control)
Cloudflare Enterprise & Pro WAF
Cacti 모니터링 서버의 외부 노출을 즉시 차단하고, 신속히 1.2.23 이상 버전으로 패치를 적용하십시오.

코드 수정 전에도 가상 패치(Virtual Patching)로 웹 공격을 즉시 차단하세요

서버 재시작이나 긴급 패치가 어려운 운영 환경이라면 클라우드 WAF 관리형 룰셋을 활성화하여 SQLi, RCE, XSS 익스플로잇 페이로드를 엣지에서 1분 만에 차단할 수 있습니다.

평균 설정 시간 3분 · Zero-Day 자동 룰 업데이트
이 웹 취약점(WAF 우회 & RCE)을 안전한 실습 랩에서 직접 재현해 보세요
실습 랩 & 보안 강의 보러가기

취약점 발생 원리 및 공격 메커니즘

1. 취약점 개요 및 발생 원인 (Root Cause)

본 취약점은 오픈소스 네트워크 모니터링 플랫폼인 Cacti의 remote_agent.php 파일 및 lib/functions.php 내 클라이언트 IP 식별 로직에서 발생합니다. remote_agent.php는 인증 없이 접근 가능한 엔드포인트로, 내부적으로 get_client_addr 함수를 호출하여 클라이언트의 IP를 확인합니다. 그러나 이 함수는 HTTP_X_FORWARDED_FOR 등 공격자가 임의로 조작할 수 있는 $_SERVER 환경 변수들을 검증 없이 신뢰합니다. Cacti 데이터베이스의 poller 테이블에는 기본적으로 Cacti 서버 자체의 IP와 호스트네임 정보가 등록되어 있으므로, 공격자가 HTTP 헤더를 통해 서버 자신의 IP를 전달하면 인증 필터를 손쉽게 우회할 수 있게 됩니다.

2. 공격 메커니즘 및 익스플로잇 시나리오

인증 우회에 성공한 공격자는 remote_agent.php가 제공하는 polldata 액션을 호출할 수 있습니다. 이 과정에서 공격자는 host_id와 local_data_id 매개변수를 무차별 대입(Brute-forcing)하여, 실행 액션이 POLLER_ACTION_SCRIPT_PHP로 설정된 유효한 폴러 아이템을 탐색합니다. 유효한 아이템이 식별되면 내부적으로 poll_for_data 함수가 실행되며, 최종적으로 proc_open 함수를 통해 PHP 스크립트가 실행됩니다. 이때 공격자가 제어 가능한 poller_id 매개변수가 적절한 필터링 없이 proc_open에 전달되는 인자 문자열에 그대로 삽입되므로, 세미콜론(;) 등의 메타문자를 이용한 커맨드 인젝션(Command Injection)이 가능해집니다.

3. 비즈니스 및 인프라 파급 영향

Cacti는 인프라 전반의 트래픽과 장비 상태를 모니터링하는 핵심 관리 서버입니다. 이 취약점은 CVSS 9.8의 치명적인 등급을 받았으며, CISA KEV(Known Exploited Vulnerabilities) 목록에 등재되어 실제 야생(In-the-Wild)에서 활발히 악용되고 있습니다. 공격자가 이 취약점을 악용할 경우, 모니터링 대상 장비들의 자격 증명(SNMP 커뮤니티 스트링, API 키 등)이 탈취될 수 있으며, 내부망 침투를 위한 거점으로 악용되어 기업 인프라 전체가 침해되는 심각한 비즈니스 중단 사태를 초래할 수 있습니다.

공식 보안 권고문 및 참조 링크

NIST NVD 공식 영문 원문 (Original Record)

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.

자주 묻는 실무 질문 (FAQ — CVE-2022-46169)

FAQ

Q1. CVE-2022-46169 취약점의 위험도와 실제 악용 가능성은 어느 정도입니까?

CVE-2022-46169의 기본 점수는 CVSS 9.8 (CRITICAL)이며, 향후 30일 내 실제 악용 확률을 나타내는 EPSS 점수는 99.8%입니다. 현재 미국 CISA KEV(실제 악용이 확인된 취약점 카탈로그)에 등재되어 있으므로 최우선 긴급 패치가 필요합니다.

Q2. CVE-2022-46169에 영향을 받는 벤더와 제품은 무엇입니까?

주요 영향 벤더는 cacti이며, 대상 컴포넌트는 cacti입니다. 상세 영향 범위: Cacti 1.2.22 이하의 모든 1.2.x 버전 및 1.3.x 개발 버전 (1.2.23 버전에서 패치 완료)

Q3. 서버 재기동이나 정규 패치 전 즉시 적용할 수 있는 완화 조치(Workaround)는 무엇입니까?

[권장 조치] Cacti 공식 패치 버전인 1.2.23 이상으로 즉시 업그레이드하고, 외부 노출된 모니터링 인터페이스에 대한 접근 제어를 강화하십시오 본문의 패치 및 우회 명령어 섹션과 자가 점검 체크리스트를 참고하여 외부 노출 포트를 차단하거나 WAF 탐지 규칙을 선적용하십시오.

실무자 보고서 워크벤치 연동

CVE-2022-46169 사내 보안 패치 공지문 · CISO 경영진 보고서 초안 자동 생성

클릭 한 번으로 사내 이메일·노션·결재 문서에 바로 붙여넣을 수 있는 공식 보고서 양식을 생성합니다.

보고서 초안 생성하기 →

🔗 함께 점검해야 할 동일 벤더·스택 연관 취약점 (cacti)

동일 카테고리 전체 보기 →
SecOps Advisory Dispatch & RSS Feed

일간 취약점 브리핑 및 긴급 Zero-Day 경보 구독

보안 실무자와 인프라·백엔드 엔지니어를 위해 매일 아침 주요 취약점과 패치 우선순위를 요약해 발송합니다.

Slack / Teams / RSS 리더 연동:
패치 명령EN
CVE-2022-46169 Cacti remote_agent.php 인증 우회 및 원격 코드 실행(RCE) 취약점 분석 (CVE-2022-46169) (CVSS 9.8) - 패치 및 보안 권고 | CVE Pulse