CVE-2023-48228
📋 TL;DR
This vulnerability allows attackers to bypass PKCE (Proof Key for Code Exchange) protection in authentik's OAuth2 flows. When an OAuth2 flow is initiated with a code_challenge but the attacker omits the code_verifier during token exchange, authentik accepts the request without validation. This affects all authentik deployments using OAuth2 with PKCE before the patched versions.
💻 Affected Systems
- authentik
📦 What is this software?
Authentik by Goauthentik
Authentik by Goauthentik
⚠️ Risk & Real-World Impact
Worst Case
Complete OAuth2 authorization bypass allowing attackers to obtain access tokens without proper authentication, potentially leading to account takeover and unauthorized access to protected resources.
Likely Case
Attackers can bypass PKCE protection to obtain OAuth2 tokens, enabling unauthorized access to applications relying on authentik for authentication.
If Mitigated
With proper network segmentation and monitoring, impact is limited to potential token misuse within the authentication system scope.
🎯 Exploit Status
Exploitation requires understanding of OAuth2 flows but is straightforward once the vulnerability is understood. No authentication needed to trigger the vulnerable endpoint.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 2023.8.5 or 2023.10.4
Vendor Advisory: https://github.com/goauthentik/authentik/security/advisories/GHSA-xxxx-xxxx-xxxx
Restart Required: Yes
Instructions:
1. Backup your authentik configuration and database. 2. Update authentik to version 2023.8.5 or 2023.10.4 using your deployment method (Docker, Kubernetes, etc.). 3. Restart authentik services. 4. Verify the update completed successfully.
🔧 Temporary Workarounds
Disable OAuth2 provider
allTemporarily disable the OAuth2 provider if not essential for operations
Edit authentik configuration to disable OAuth2 provider or remove OAuth2 applications
Network isolation
allRestrict access to OAuth2 endpoints to trusted networks only
Configure firewall rules to limit access to /application/o/token/ endpoint
🧯 If You Can't Patch
- Implement WAF rules to detect and block OAuth2 token requests missing code_verifier when code_challenge was used
- Increase monitoring and alerting on OAuth2 token issuance events for anomalous patterns
🔍 How to Verify
Check if Vulnerable:
Check if authentik version is below 2023.8.5 or 2023.10.4 and OAuth2 provider is enabled
Check Version:
docker exec authentik authentik version or check authentik admin interface version info
Verify Fix Applied:
After update, verify version is 2023.8.5 or higher, or 2023.10.4 or higher. Test OAuth2 flow with missing code_verifier should be rejected.
📡 Detection & Monitoring
Log Indicators:
- OAuth2 token requests without code_verifier parameter
- Successful token issuance without PKCE validation
Network Indicators:
- HTTP POST requests to /application/o/token/ endpoint with missing code_verifier parameter
SIEM Query:
source="authentik" AND "token" AND NOT "code_verifier" AND "code_challenge"
🔗 References
- https://github.com/goauthentik/authentik/blob/dd4e9030b4e667d3720be2feda24c08972602274/authentik/providers/oauth2/views/token.py#L225
- https://github.com/goauthentik/authentik/commit/3af77ab3821fe9c7df8055ba5eade3d1ecea03a6
- https://github.com/goauthentik/authentik/commit/6b9afed21f7c39f171a4a445654cfe415bba37d5
- https://github.com/goauthentik/authentik/commit/b88e39411c12e3f9e04125a7887f12354f760a14
- https://github.com/goauthentik/authentik/pull/7666
- https://github.com/goauthentik/authentik/pull/7668
- https://github.com/goauthentik/authentik/pull/7669
- https://github.com/goauthentik/authentik/releases/tag/version%2F2023.10.4
- https://github.com/goauthentik/authentik/releases/tag/version%2F2023.8.5
- https://github.com/goauthentik/authentik/security/advisories/GHSA-fm34-v8xq-f2c3
- https://github.com/goauthentik/authentik/blob/dd4e9030b4e667d3720be2feda24c08972602274/authentik/providers/oauth2/views/token.py#L225
- https://github.com/goauthentik/authentik/commit/3af77ab3821fe9c7df8055ba5eade3d1ecea03a6
- https://github.com/goauthentik/authentik/commit/6b9afed21f7c39f171a4a445654cfe415bba37d5
- https://github.com/goauthentik/authentik/commit/b88e39411c12e3f9e04125a7887f12354f760a14
- https://github.com/goauthentik/authentik/pull/7666
- https://github.com/goauthentik/authentik/pull/7668
- https://github.com/goauthentik/authentik/pull/7669
- https://github.com/goauthentik/authentik/releases/tag/version%2F2023.10.4
- https://github.com/goauthentik/authentik/releases/tag/version%2F2023.8.5
- https://github.com/goauthentik/authentik/security/advisories/GHSA-fm34-v8xq-f2c3