OAuth State Parameter Not Bound to User Agent Session (Login CSRF)
@andrewmusselman đang làm issue này rồi.
Từ ngày 23/4/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 7
- Fork
- 13
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/infrastructure-asfquart
-
bug priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Document OAuth callback consistency rulesCó thể đã có người làm @Marrshal15 đã nhận 18 ngày trước. Đang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/infrastructure-asfquart#126 · 1 bình luận ·
-
ASVS priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/infrastructure-asfquart#85 · 1 bình luận ·
-
Triage and track asfquart issuesCó thể đã có người làm @sbp đã nhận 16 ngày trước. Đang mở
apache/infrastructure-asfquart#134 · 1 người được giao ·
Tất cả issue của apache/infrastructure-asfquart
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
CLIMADA-project/climada_python#1337 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
tail without reverseĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
8go/matrix-commander#233 ·
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
documentation enhancement priority:high size:M
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backendCó thể đã có người làm @debesh-biswas đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100