Chuyển đến nội dung
Skillpedia
Bảo mật35k · #7673

attacking-oauth-with-device-code-phishing

Skill này làm gì

Công cụ này mô phỏng các cuộc tấn công lừa đảo để đánh cắp access token của các dịch vụ Microsoft như email và file. Nó đánh lừa người dùng cho phép kẻ tấn công truy cập, vượt qua xác thực đa yếu tố (MFA).

Khi nào nên dùng

  • ✓Trong các kiểm thử bảo mật được ủy quyền trên hệ thống Microsoft 365.
  • ✓Để kiểm tra xem MFA và các biện pháp chống đánh cắp token có hoạt động không.
  • ✓Để chứng minh rủi ro của việc vượt qua MFA và sự cần thiết của xác thực mạnh hơn.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/attacking-oauth-with-device-code-phishing/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Mô phỏng một cuộc tấn công lừa đảo device code nhắm vào tài khoản Microsoft 365 của tôi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ khởi tạo một quy trình trong đó người dùng được dẫn đến một trang Microsoft hợp pháp để “kết nối thiết bị”. Khi người dùng nhập mã do công cụ cung cấp, họ vô tình cho phép kẻ tấn công truy cập token của mình.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

…

Câu hỏi thường gặp

Access token và refresh token là gì?

Access token giống như chìa khóa tạm thời để truy cập dịch vụ. Refresh token là chìa khóa dài hạn có thể tạo access token mới, ngay cả sau khi đổi mật khẩu.

Công cụ vượt qua MFA như thế nào?

Người dùng nhập mã trên trang Microsoft hợp pháp, hoàn tất xác thực hai yếu tố. Tuy nhiên, các token được tạo ra sẽ chuyển đến kẻ tấn công, không phải người dùng hợp pháp.

Tôi có cần quyền để dùng công cụ này không?

Có. Cần sự cho phép bằng văn bản rõ ràng từ chủ hệ thống cho mọi hoạt động kiểm thử. Dùng trái phép là vi phạm pháp luật.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#7673
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự