
CVE-2026-22005 の概念実証 (PoC)。短すぎるポーリング間隔を悪用した OAuth 2.0 デバイスコードフィッシングを示すもので、脆弱な Flask サーバーとトークン窃取のためのエクスプロイトフローを含む。
# device_code_server.py - Authorization server with too-fast polling
import time, secrets
codes = {}
@app.route('/device/code')
def device_code():
code = secrets.token_urlsafe(16)
codes[code] = {'user_code': secrets.token_hex(4), 'status': 'pending'}
return jsonify(codes[code])
@app.route('/token')
def token():
code = request.args['device_code']
# Vulnerability: allows polling every 1 second, and attacker can brute-force user_code
if codes[code]['status'] == 'pending':
# Check if user_code was entered (simulated)
time.sleep(0.5) # delay to simulate user
return jsonify({'access_token': 'secret'})
OAuth 2.0 デバイス認可グラントでは、クライアントがトークンエンドポイントを毎秒ポーリングできます。攻撃者はデバイスフローを開始し、ユーザーコードを被害者に表示させ(フィッシング)、ポーリング間隔が非常に短いため、被害者が不正使用に気付く前にアクセストークンを取得できます。
シミュレーションを実行します:
pip install flask
python device_code_server.py
# Attacker starts flow, gets device_code and user_code, phishes victim.