Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

OAuth State Parameter Not Bound to User Agent Session (Login CSRF)

オープン
#86 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@andrewmusselman がすでに取り組んでいます。

2026年4月23日 から。

評価

この issue はまだ評価されていません。

説明

ASVS priority

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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/infrastructure-asfquart のほかの issue

apache/infrastructure-asfquart の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。