An Offensive Guide to the OAuth 2.0 Authorization Code Grant #1677
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Automated Content Update
This PR was automatically generated by the HackTricks News Bot based on a technical blog post.
📝 Source Information
🎯 Content Summary
This blog is a hands-on offensive guide to attacking OAuth 2.0 Authorization Code grant flows. It assumes the standard OAuth 2.0 components:
🔧 Technical Details
CSRF and account linking via broken
stateTreat the OAuth
stateparameter as a mandatory CSRF token: generate a cryptographically random value per browser session, store it in a browser‑only location (cookie/local storage), send it in the authorization request, and verify it on return. Exploitation abstracts to: an attacker completes their own OAuth flow, captures but does not send the final request containing theircode, then forces a victim’s browser to send that exact request. Ifstateis missing, optional, predictable, unvalidated, or attacker‑fixable, the Client accepts the request and links the victim’s local account to the attacker’s identity at the IdP, enabling account takeover or persistent unauthorized account association.Authorization code replay via weak
codesemanticsAuthorization codes must be short‑lived, single‑use, and replay‑sensitive. In any OA...
🤖 Agent Actions
Summary:
oauth-to-account-takeover.mdguidance with actionable testing checklists forstatereplay/CSRF, hardened coverage onredirect_urivalidation failures, and a deeper explanation of client-secret exposure in public/native apps along with PKCE expectations.Tests: Not run (not applicable for documentation changes).
This PR was automatically created by the HackTricks Feed Bot. Please review the changes carefully before merging.