OAuth State Parameter Not Bound to User Agent Session (Login CSRF)
@andrewmusselman ci sta già lavorando.
Dal 23/4/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 7
- Fork
- 13
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/infrastructure-asfquart
-
bug priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Document OAuth callback consistency rulesForse già presa @Marrshal15 l’ha presa 12 giorni fa. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
apache/infrastructure-asfquart#126 · 1 commento ·
-
ASVS priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
apache/infrastructure-asfquart#85 · 1 commento ·
-
Triage and track asfquart issuesForse già presa @sbp l’ha presa 11 giorni fa. Aperta
apache/infrastructure-asfquart#134 · 1 assegnatario ·
Tutte le issue di apache/infrastructure-asfquart
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ok-oldking/ok-wuthering-waves#1785 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
healthchecks/healthchecks#1349 ·
-
deployment release-lag
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
nolte/kamerplanter#2374 ·
I maintainer di solito rispondono entro 1 giorno
-
bug v1 v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/python-sdk#3725 ·
I maintainer di solito rispondono entro 1 giorno
-
batchterms() drops queries without a similar() clause, misaligning results with inputsForse già presa @MohammadHijjawi97 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno