본문으로 건너뛰기
Skillpedia
보안35k · #7673

attacking-oauth-with-device-code-phishing

하는 일

이 도구는 이메일이나 파일 같은 Microsoft 서비스의 액세스 토큰을 훔치기 위한 피싱 공격을 시뮬레이션합니다. 사용자를 속여 공격자의 접근을 승인하게 만들어 다단계 인증(MFA)을 우회합니다.

사용하는 경우

  • ✓승인된 Microsoft 365 시스템에 대한 보안 테스트를 할 때.
  • ✓MFA와 토큰 도난 방지 기능이 작동하는지 확인할 때.
  • ✓MFA 우회의 위험성과 더 강력한 인증이 필요하다는 점을 보여 줄 때.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/attacking-oauth-with-device-code-phishing/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/attacking-oauth-with-device-code-phishing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“내 Microsoft 365 계정에 대해 장치 코드 피싱 공격을 시뮬레이션해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 사용자를 정상적인 Microsoft 페이지로 안내해 '장치를 연결'하도록 만듭니다. 사용자가 도구가 제공한 코드를 입력하면, 사용자는 무심코 공격자가 토큰에 접근하도록 승인하게 됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Attacking OAuth with Device-Code Phishing

Legal Notice: This skill is for authorized security testing, red-team engagements, and educational purposes only. Device-code and consent-grant phishing manipulate real users into authorizing attacker-controlled access to corporate identities. Execute only against tenants you own or have explicit written authorization (rules of engagement) to test. Unauthorized use violates the Computer Fraud and Abuse Act and equivalent laws worldwide.

Overview

The OAuth 2.0 Device Authorization Grant (RFC 8628) was designed for input-constrained devices (smart TVs, CLI tools) that cannot easily present a browser-based login. A device requests a short user_code and a device_code, displays the user_code and a verification URL to the user, and polls the token endpoint while the user authenticates on a separate, fully-featured device. Attackers weaponize this flow: instead of a smart TV, the "device" is the attacker's machine. The attacker initiates the device-code request, then phishes a victim to visit the legitimate Microsoft verification page (https://microsoft.com/devicelogin) and enter the attacker-generated user_code. Because the victim authenticates on the genuine Microsoft login page — completing MFA — the resulting tokens are minted to the attacker's polling session. This bypasses MFA entirely: the second factor is satisfied by the victim, but the bearer tokens land with the attacker (mapped to MITRE ATT&CK T1528 – Steal Application Access Token).

Microsoft Threat Intelligence, Volexity, and Proofpoint documented sharp growth in device-code phishing through 2025, with Russia-aligned actors (tracked by Microsoft as Storm-2372) among the most prolific. Mandiant's M-Trends reporting similarly highlights OAuth token theft as a leading cloud initial-access vector. A closely related technique is the illicit consent grant ("OAuth phishing"): the attacker registers a multi-tenant app and tricks the victim into clicking an /adminconsent or user-consent URL, granting the malicious app delegated Microsoft Graph permissions (Mail.Read, Files.ReadWrite.All, offline_access) that persist independently of password resets. This skill covers both, plus token replay across Microsoft 365 services using TokenTactics and validation/access mapping with ROADtools.

The defining property red teams exploit: access tokens minted via the device-code flow are valid for roughly 60–90 minutes, but the accompanying refresh token (with offline_access scope) survives for up to 90 days and can be redeemed for fresh tokens against any first-party resource the client is allowed to request — Outlook, SharePoint, Teams, Azure Resource Manager — enabling durable, MFA-surviving access.

When to Use

  • During an authorized red-team or assumed-breach engagement targeting Microsoft 365 / Entra ID where social-engineering is in scope
  • When validating Conditional Access policies, MFA enforcement, and token-protection controls against real phishing techniques
  • When testing whether an organization restricts the OAuth device-code flow or blocks unverified multi-tenant app consent
  • When demonstrating MFA-bypass risk to justify phishing-resistant authentication (FIDO2) and token-binding controls
  • When building detections (paired with the blue-team hunting-saas-sso-token-abuse skill) and you need realistic telemetry

Prerequisites

  • Written authorization / rules of engagement explicitly permitting phishing and token theft against the target tenant
  • A controlled pretext-delivery channel (sanctioned phishing infrastructure or an internal test mailbox)
  • Linux or Windows attacker host with Python 3.8+ and PowerShell 7+
  • TokenTactics (PowerShell) and ROADtools (Python) installed:
    # ROADtools (roadrecon + roadtx) — Dirk-jan Mollema / Outsider Security
    pip install roadtools roadtools_auth
    # roadtx (ROADtools Token eXchange) ships in roadtools_auth
    roadtx --help
    
    # TokenTactics v2 (rvrsh3ll)
    git clone https://github.com/rvrsh3ll/TokenTactics.git
    pwsh -c "Import-Module ./TokenTactics/TokenTactics.psd1"
    
  • Familiarity with OAuth 2.0 grant types, JWT structure, and Microsoft Graph scopes

Objectives

  • Initiate an OAuth device-code request against Entra ID using a first-party client ID
  • Deliver a credible pretext that drives the victim to the genuine Microsoft device-login page
  • Poll the token endpoint and capture the victim's access and refresh tokens

…

자주 묻는 질문

액세스 토큰과 리프레시 토큰은 무엇인가요?

액세스 토큰은 서비스에 접근하기 위한 임시 열쇠와 같습니다. 리프레시 토큰은 비밀번호를 바꾼 뒤에도 새 액세스 토큰을 만들 수 있는 장기 열쇠입니다.

이것은 어떻게 MFA를 우회하나요?

사용자가 정상적인 Microsoft 페이지에 코드를 입력하므로 2단계 인증은 완료됩니다. 하지만 생성된 토큰은 정상 사용자가 아니라 공격자에게 전달됩니다.

이 도구를 사용하려면 허가가 필요한가요?

네, 테스트를 위해 시스템 소유자의 명시적인 서면 승인이 꼭 필요합니다. 허가 없이 사용하는 것은 불법입니다.

상세 정보

작성자의 원본 설명

Run OAuth 2.0 device-code and illicit-consent phishing attacks against Microsoft Entra ID, using TokenTactics-style tooling to steal access and refresh tokens, bypass MFA, and pivot across Microsoft 365 services. Use for authorized red-team engagements simulating device-code or consent-grant phishing against a tenant you have explicit written permission to test.

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#7673
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬