本文へスキップ
Skillpedia
エージェント35k · #7856

detecting-oauth-token-theft

できること

このツールは、Microsoftのシステムにおけるトークンの盗難を検出し、対応するのに役立ちます。トークンを盗んだり再利用したりして、情報に不正にアクセスしようとする攻撃から守ります。

使う場面

  • ✓不正アクセスが発生したと疑われるとき。
  • ✓ログインログで普段と違う活動を調査するとき。
  • ✓トークン盗難への防御を設定するとき。

スキルのリンク

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-oauth-token-theft/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-oauth-token-theft/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Microsoft Entra IDで、トークンに関する異常なアクセス警告を調査して。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、Microsoft Entra IDのログインログとセキュリティ設定を分析します。盗難や不正利用を示すトークンの使用パターン、例えば「ありえない移動」によるログインや、再利用されたトークンなどを確認します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Detecting OAuth Token Theft

When to Use

  • Investigating alerts for impossible travel or anomalous token usage in Microsoft Entra ID
  • Responding to a suspected session hijacking or pass-the-cookie attack
  • Configuring proactive defenses against OAuth token theft in an Azure/M365 environment
  • Detecting OAuth device code phishing campaigns that bypass MFA
  • Analyzing sign-in logs for token replay indicators
  • Implementing Token Protection conditional access policies to bind tokens to devices

Do not use for on-premises Kerberos ticket attacks (pass-the-ticket, golden ticket); use Active Directory-specific investigation techniques for those scenarios.

Prerequisites

  • Microsoft Entra ID P2 license (required for Identity Protection risk detections and conditional access)
  • Global Administrator or Security Administrator role in the Entra admin center
  • Microsoft Defender for Cloud Apps (MDCA) license for session anomaly detection
  • Access to Entra ID Sign-in Logs and Audit Logs (requires Diagnostic Settings configured to Log Analytics or Sentinel)
  • Familiarity with OAuth 2.0 authorization flows (authorization code, device code, client credentials)
  • Microsoft Sentinel or equivalent SIEM ingesting Entra ID sign-in and audit logs

Workflow

Step 1: Understand the Token Theft Attack Surface

Identify which token types are at risk and how they are stolen:

Token Type            | Lifetime     | Theft Vector                    | Impact
----------------------|-------------|----------------------------------|------------------
Access Token          | 60-90 min   | Memory dump, proxy interception  | API access for token lifetime
Refresh Token         | Up to 90 days| Browser cookie theft, malware   | Persistent access, new access tokens
Primary Refresh Token | Session-based| Mimikatz, AADInternals, malware | Full SSO to all M365/Azure apps
Session Cookie        | Varies      | XSS, browser exploit, AitM proxy | Full session hijacking
Device Code Token     | 15 min auth | Phishing (device code flow abuse)| Attacker gets refresh token via social engineering

Common attack techniques:

  • AitM Phishing (Adversary-in-the-Middle): Attacker proxies the legitimate login page via tools like Evilginx2, capturing session cookies and tokens after the user completes MFA
  • Device Code Phishing: Attacker generates a device code, sends it to the victim via email/Teams, victim authenticates, attacker receives the token
  • PRT Extraction: Attacker with local admin on a device extracts the Primary Refresh Token using Mimikatz (sekurlsa::cloudap) or AADInternals
  • Browser Cookie Theft: Malware or infostealer exfiltrates browser cookies containing session tokens

Step 2: Configure Entra ID Sign-in Risk Detection

Enable Identity Protection to flag anomalous token usage:

Entra Admin Center > Protection > Identity Protection > Risk Detections

Key risk detections for token theft:
- Anomalous Token        : Token has unusual characteristics (claim anomalies)
- Token Issuer Anomaly   : Token issued by an unusual token issuer
- Unfamiliar Sign-in     : Sign-in from a location not seen before for the user
- Impossible Travel      : Sign-ins from geographically distant locations in impossible time
- Malicious IP Address   : Sign-in from a known malicious IP
- Suspicious Browser     : Sign-in from a suspicious or attacker-controlled browser

Configure risk-based conditional access:

Entra Admin Center > Protection > Conditional Access > New Policy

Policy Name: "Block High-Risk Sign-ins - Token Theft Protection"
Assignments:
  Users: All users (exclude break-glass accounts)
  Cloud Apps: All cloud apps
Conditions:
  Sign-in Risk: High
Grant:
  Block access

Policy Name: "Require MFA for Medium-Risk Sign-ins"
Assignments:
  Users: All users
  Cloud Apps: All cloud apps
Conditions:
  Sign-in Risk: Medium
Grant:
  Require multifactor authentication
  Require password change

Step 3: Enable Token Protection (Preview)

Configure Token Protection to bind sign-in session tokens to the device:

Entra Admin Center > Protection > Conditional Access > New Policy

Policy Name: "Enforce Token Protection for Desktop Sessions"
Assignments:
  Users: All users (start with a pilot group)
  Cloud Apps: Office 365 Exchange Online, Office 365 SharePoint Online
  Conditions:
    Device Platforms: Windows
Session:
  Require token protection for sign-in sessions (Preview): Enabled
Grant:

…
よくある質問

アクセストークンとリフレッシュトークンとは何ですか?

アクセストークンは、リソースにアクセスするための一時的な鍵のようなものです。リフレッシュトークンは、期限切れになった古いアクセストークンの代わりに新しいものを取得するために使われ、より長くアクセスできるようにします。

「ありえない移動」とは何ですか?

地理的に離れた場所から、短時間のうちに同じユーザーがログインしたことをシステムが検出する状態です。アカウントが侵害されている可能性を示します。

なぜKerberos攻撃には使わないのですか?

このツールはMicrosoft Entra ID(クラウド)専用です。Kerberos攻撃は社内のオンプレミスネットワークで発生するため、別の調査方法が必要です。

詳細

作者による元の説明

Detect and respond to OAuth token theft and replay in Microsoft Entra ID (Azure AD), covering access token theft, refresh token replay, Primary Refresh Token (PRT) abuse, pass-the-cookie attacks, and Token Protection conditional access policies. Use for impossible-travel or anomalous token-usage alerts, suspected session hijacking, sign-in log analysis, or configuring token-binding defenses in Azu

repo: mukul975/Anthropic-Cybersecurity-Skills

人気

GitHubのスター
35k
ランキング
#7856
ライセンス
Apache-2.0
更新日
2026/8/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル