[Security] Encoded backslash bypass in post_logout_redirect_uri can cause open redirect
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- azure
- Ambito
- authentication, cloud, security
Direzione di ricerca
Inizia riproducendo il flusso in due passaggi /.auth/logout e /.auth/logout/complete con i comandi curl forniti, mantenendo il cookie e ispezionando Location senza seguire i reindirizzamenti. Il report non indica alcun file del repository e identifica il comportamento come gestito dalla piattaforma. Il lavoro è completato quando le destinazioni non sicure contenenti backslash codificati vengono rifiutate o sostituite con una destinazione fissa della stessa origine.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Azure Static Web Apps managed authentication appears to accept an encoded backslash in post_logout_redirect_uri, then reflect the decoded value from /.auth/logout/complete. In browsers, the resulting URL can be normalized as a scheme-relative external redirect.
This appears to be an open redirect in the platform-managed /.auth/* authentication flow.
Affected flow
-
GET /.auth/logout?post_logout_redirect_uri=/%5Cattacker.example -
The request is accepted and establishes the managed-auth logout context.
-
GET /.auth/logout/completewith the resulting cookie. -
The response may be a redirect such as:
Location: /\\attacker.example -
Browser URL normalization can interpret
/\\attacker.exampleas an off-origin scheme-relative URL.
Expected behavior
post_logout_redirect_uri should be accepted only when it is a safe same-origin path, for example /dashboard. Inputs containing backslashes, encoded backslashes, control characters, or any form that can normalize to an authority should be rejected or replaced with a fixed local destination.
Observed behavior
Obvious absolute and scheme-relative external URLs are rejected, but the encoded-backslash form is accepted and reflected by the logout completion endpoint. This suggests validation and browser URL parsing use different normalization rules.
Security impact
An attacker can create a link that appears to target a legitimate Static Web App, but after logout the browser may be redirected to an attacker-controlled origin. This can support phishing and credential-harvesting flows.
Reproduction
Use a test Static Web App domain and a cookie jar:
HOST=https://<static-web-app-domain>
curl -s -D - -o /dev/null -c cookies.txt \
$HOST/.auth/logout?post_logout_redirect_uri=/%5Cattacker.example
curl -s -D - -o /dev/null -b cookies.txt \
$HOST/.auth/logout/complete
Please verify the Location header without following redirects. A vulnerable response is one that reflects a value equivalent to /\\attacker.example, which browsers may normalize to an external scheme-relative URL.
Notes
- This concerns the Azure Static Web Apps managed-auth endpoints, not application route configuration.
- A
staticwebapp.config.jsonroute rule for/.auth/logoutdoes not appear to intercept the reserved managed-auth endpoint before the platform handler processes it. - Please treat this as a security report and advise whether Microsoft prefers private disclosure through the MSRC process.
Suggested fix
Normalize and validate the redirect target using browser-compatible URL parsing. Reject backslashes and encoded backslashes before validation, reject any target whose normalized authority differs from the current host, and use a fixed same-origin fallback when validation fails.
Attack flow
OPEN REDIRECT via SWA managed-auth
affected flow: `/.auth/logout` -> `/.auth/logout/complete`
================================================================================
ATTACKER VICTIM BROWSER AZURE STATIC WEB APPS
(platform managed-auth
layer, `/.auth/*`)
| | |
| phishing link | |
|------------------------->| |
| | |
| STEP 1: seed the redirect target into the cookie |
| | |
| | GET `/.auth/logout` |
| | ?post_logout_redirect_uri=/%5Cattacker.example
| |---------------------------------->|
| | | validate(uri)
| | | `/\` passes
| | 302 Found |
| | Location: `https://identity.5.azurestaticapps.net/`
| | `.redirect/logout?hostName=...`
| | Set-Cookie: `StaticWebAppsAuthContextCookie=<enc>`
| | Secure; HttpOnly; SameSite=None <-- sent cross-site
|<-------------------------| |
| | [target is stored in the managed-auth context]
| | |
| STEP 2: trigger the completion handler |
| | |
| | GET `/.auth/logout/complete` |
| | Cookie: `StaticWebAppsAuthContextCookie=<enc>`
| |---------------------------------->|
| | | reflect(cookie.uri)
| | 302 Found |
| | Location: `/\attacker.example` <== TAINTED
|<-------------------------| |
| | |
| | browser normalizes `/\` -> `//`
| | => scheme-relative URL
| v |
| `https://attacker.example` (off-origin)
| |
|<-------------------------+ attacker-controlled page
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 347
- Fork
- 68
- 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 Azure/static-web-apps
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Azure/static-web-apps#1764 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Azure/static-web-apps#1827 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Azure/static-web-apps#1826 · 5 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Azure/static-web-apps#1825 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
Azure/static-web-apps#1824 ·
Tutte le issue di Azure/static-web-apps
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 69/100
StevenBlack/hosts#3314 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Security sweep findingsApertasecurity-sweep
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
open-policy-agent/opa#9685 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
BSP BSP: NXP bug Component component: drivers
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
RT-Thread/rt-thread#12117 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni