Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#86 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@andrewmusselman ci sta già lavorando.

Dal 23/4/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/infrastructure-asfquart

Tutte le issue di apache/infrastructure-asfquart

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.