/attacking-oauth-with-device-code-phishing
Run OAuth 2.0 device-code and illicit-consent phishing attacks against
$ npx -y skills add mukul975/Anthropic-Cybersecurity-Skills --skill attacking-oauth-with-device-code-phishing --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/attacking-oauth-with-device-code-phishing
Context preview
The summary Claude sees to decide when to auto-load this skill.
Run OAuth 2.0 device-code and illicit-consent phishing attacks against
SKILL.md
attacking-oauth-with-device-code-phishing.SKILL.mdname: attacking-oauth-with-device-code-phishing
description: 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.
domain: cybersecurity
subdomain: identity-access-management
tags:
- device-code-phishing
- oauth
- entra-id
- token-theft
- mfa-bypass
- illicit-consent
- tokentactics
- red-team
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.AA-03
mitre_attack:
- T1528
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
- Refresh tokens across Microsoft 365 resources (Graph, Outlook, Azure management) to expand access
- Execute the illicit-consent variant by registering and phishing consent for a malicious multi-tenant app
- Enumerate accessible resources and data with ROADtools to demonstrate impact
- Document MFA bypass and produce remediation recommendations
MITRE ATT&CK Mapping
| ID | Technique | Application in this skill | |----|-----------|---------------------------| | T1528 | Steal Application Access Token | Phishing the device-code flow / consent grant yields attacker-controlled OAuth access and refresh tokens that are reused to access cloud services without re-authenticating |
Related techniques frequently chained: **T1566** Phishing (delivery), **T1550.001** Application Access Toke
Read more
name: attacking-oauth-with-device-code-phishing description: 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. domain: cybersecurity subdomain: identity-access-management tags: - device-code-phishing - oauth - entra-id - token-theft - mfa-bypass - illicit-consent - tokentactics - red-team version: '1.0' author: mahipal license: Apache-2.0 nist_csf: - PR.AA-03 mitre_attack: - T1528
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
- Refresh tokens across Microsoft 365 resources (Graph, Outlook, Azure management) to expand access
- Execute the illicit-consent variant by registering and phishing consent for a malicious multi-tenant app
- Enumerate accessible resources and data with ROADtools to demonstrate impact
- Document MFA bypass and produce remediation recommendations
MITRE ATT&CK Mapping
| ID | Technique | Application in this skill | |----|-----------|---------------------------| | T1528 | Steal Application Access Token | Phishing the device-code flow / consent grant yields attacker-controlled OAuth access and refresh tokens that are reused to access cloud services without re-authenticating |
Related techniques frequently chained: **T1566** Phishing (delivery), **T1550.001** Application Access Toke
817 structured cybersecurity skills for AI agents · Mapped to 6 frameworks: MITRE ATT&CK, NIST CSF 2.0, MITRE ATLAS, D3FEND, NIST AI RMF & MITRE F3 (Fight Fraud) · agentskills.io standard · Works with Claude Code, GitHub Copilot, Codex CLI, Cursor, Gemini CLI & 20+ platforms · 29 security domains · Apache 2.0
Repo: mukul975/Anthropic-Cybersecurity-Skills
Other skills on cybersecurity-skills.
- /abusing-dpapi-for-credential-access
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket's dpapi.py, including domain-wide decryption via the DPAPI backup key. Use
Open skill - /abusing-shadow-credentials-for-privesc
Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target's NT hash without a password reset. Use when BloodHound shows
Open skill - /achieving-cmmc-level-2-compliance
Prepare a defense-contractor environment for CMMC Level 2 certification: scope CUI and FCI, implement the 110 NIST SP 800-171 Rev 2 security requirements across 14 families, compute the SPRS score with the DoD Assessment Methodology, manage a compliant POA&M, and ready the
Open skill - /acquiring-disk-image-with-dd-and-dcfldd
Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving
Open skill - /analyzing-active-directory-acl-abuse
Detect dangerous ACL misconfigurations in Active Directory using ldap3
Open skill - /analyzing-android-malware-with-apktool
Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and
Open skill

