OAuth State Parameter Not Bound to User Agent Session (Login CSRF)
@andrewmusselman がすでに取り組んでいます。
2026年4月23日 から。
評価
この issue はまだ評価されていません。
説明
Issue: FINDING-060 - OAuth State Parameter Not Bound to User Agent Session (Login CSRF)
Labels: bug, security, priority:high, asvs-level:L2
ASVS Level(s): [L2-only]
Description:
Summary
The OAuth state parameter is generated with cryptographic randomness but is not bound to the specific user-agent (browser session) that initiated the flow. Any HTTP client possessing a valid state value can complete the callback, regardless of whether it was the same user agent that initiated the authorization request. This enables Login CSRF attacks where an attacker can trick a victim into completing the attacker's OAuth flow, logging the victim in as the attacker.
Details
Affected Files and Lines:
src/asfquart/generics.py:47-93- OAuth flow without session binding
The state parameter validates CSRF but is not bound to the initiating session, allowing cross-session completion.
Recommended Remediation
Bind the OAuth state to the user-agent using a short-lived cookie:
# During login initiation
nonce = secrets.token_hex(16)
state = hashlib.sha256(nonce.encode()).hexdigest()
# Store nonce with state
pending_states[state] = {
'nonce': nonce,
'created': time.time(),
'redirect': redirect_to
}
# Set cookie
response = quart.redirect(oauth_url)
response.set_cookie(
'oauth_nonce',
nonce,
max_age=workflow_timeout,
secure=True,
httponly=True,
samesite='Lax'
)
# During callback
cookie_nonce = request.cookies.get('oauth_nonce')
if not cookie_nonce or state_data['nonce'] != cookie_nonce:
raise ValueError("OAuth state not bound to session")
Acceptance Criteria
- Nonce generated and stored
- Cookie set with security flags
- Cookie validated on callback
- Session binding enforced
- Integration test verifies binding
- Unit test verifying the fix
References
- Source reports: L2:10.1.2.md, L2:10.2.1.md
- Related findings: FINDING-061, FINDING-062
- ASVS sections: 10.1.2, 10.2.1
Priority
High
- 主要言語
- Python
- スター
- 7
- フォーク
- 13
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/infrastructure-asfquart のほかの issue
-
bug priority
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Document OAuth callback consistency rules対応中かも @Marrshal15 が 12 日前に担当しました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
apache/infrastructure-asfquart#126 · コメント 1 件 ·
-
ASVS priority
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/infrastructure-asfquart#85 · コメント 1 件 ·
-
Triage and track asfquart issues対応中かも @sbp が 11 日前に担当しました。 オープン
apache/infrastructure-asfquart#134 · 担当者 1 名 ·
apache/infrastructure-asfquart の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ok-oldking/ok-wuthering-waves#1785 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
healthchecks/healthchecks#1349 ·
-
deployment release-lag
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
nolte/kamerplanter#2374 ·
メンテナーはふだん 1 日以内に返信
-
bug v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/python-sdk#3725 ·
メンテナーはふだん 1 日以内に返信
-
batchterms() drops queries without a similar() clause, misaligning results with inputs対応中かも @MohammadHijjawi97 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信