scope-drift-detection-spn
БесплатноБез исполняемых скриптовНе проверенUse this skill when asked to detect scope drift, behavioral expansion, or gradual privilege/access creep in service principals or automation accounts…
от SCStelz★ 256 звёзд на GitHubОб этом скилле
Service Principal Scope Drift Detection — Instructions
Purpose
Credit: The scope drift detection concept for service principals was inspired by Iftekhar Hussain's article The Agentic SOC Era: How Sentinel MCP Enables Autonomous Security Reasoning (Feb 2026), which demonstrated multi-source correlation across AADServicePrincipalSignInLogs, AuditLogs, and SecurityAlert to build 90-day behavioral baselines and surface drift via weighted scoring.
This skill detects scope drift — the gradual, often imperceptible expansion of access or behavior beyond an established baseline — in Entra ID service principals. Unlike sudden compromise (which triggers alerts), scope drift is a slow-burn pattern that evades threshold-based detections.
Entity Type: Service Principal
| Identifier | Primary Table(s) | Use Case |
|---|---|---|
| ServicePrincipalName / ServicePrincipalId | AADServicePrincipalSignInLogs |
App registrations, automation accounts, managed identities |
What this skill detects:
- Volume spikes in sign-in activity relative to historical baseline
- New target resources (APIs, services) not previously accessed
- New source IP addresses or geographic locations
- Increased failure rates indicating probing or misconfiguration
- Credential/permission changes correlated with behavioral shifts
- Security alerts involving the drifting entities
Related skills:
- User Scope Drift — for user accounts (UPNs)
- Device Scope Drift — for endpoints/devices
📑 TABLE OF CONTENTS
- Critical Workflow Rules - Start here!
- Output Modes - Inline chat vs. Markdown file
- Quick Start - 7-step investigation pattern
- Drift Score Formula - Weighted composite scoring (5 dimensions)
- Execution Workflow - Complete 4-phase process
- Sample KQL Queries - Validated query patterns (Queries 1-4)
- Report Template - Output format specification
- Known Pitfalls - Edge cases and false positives
- Error Handling - Troubleshooting guide
- SVG Dashboard Generation - Visual dashboard from report
Investigation shortcuts:
- SPN drift triage (TP Q5): Q1 (baseline vs recent — drift scores + dimension ratios) → Q4 (alert/incident correlation) → Tier 1 deep dives for flagged SPNs
- Compromised SPN forensics (TP Q5 + incident context): Q1 (behavioral profile) → Q3 (detailed AuditLog changes — credential adds, consent grants, timestamps, actors) → Q4 (incident status/classification check)
- Permission escalation investigation (TP Q10, standalone): Q2 (AuditLog summary — operation counts baseline vs recent) → Q3 (detailed per-operation rows with initiator/target/modified properties) → Graph API: app permission audit
- IP infrastructure expansion (TP Q5, high IPDrift): Q1 (new IPs list from
NewIPsarray) → anti-join baseline IPs to identify novel sources → IP enrichment (enrich_ips.pyorioc-investigation) for non-Azure IPs
⛔ Shortcut Default Rule: When a matching shortcut exists for the investigation context, use it — don't run the full workflow. Only run the full query set when the user explicitly requests "full investigation", "comprehensive", or "deep dive". Shortcuts render only the report sections relevant to their query chain (plus Executive Summary and Recommendations, always).
⚠️ CRITICAL WORKFLOW RULES - READ FIRST ⚠️
Before starting ANY SPN scope drift analysis:
- ALWAYS enforce Sentinel workspace selection (see Workspace Selection section below)
- ALWAYS ask the user for output mode if not specified: inline chat summary or markdown file report (or both)
- ALWAYS build baseline FIRST before comparing recent activity
- ALWAYS apply the low-volume denominator floor to prevent false-positive drift scores on sparse baselines
- ALWAYS correlate across all required data sources (AADServicePrincipalSignInLogs, AuditLogs, SecurityAlert)
- ALWAYS run independent queries in parallel for performance
- NEVER report a drift flag without corroborating evidence from at least one secondary data source
Data Sources
| Data Source | Role | Purpose |
|---|---|---|
AADServicePrincipalSignInLogs |
✅ Primary | SPN sign-in behavioral baseline |
AuditLogs |
✅ Corroboration | Permission/credential/role changes |
SecurityAlert |
✅ Corroboration | Corroborating alert evidence |
SecurityIncident |
✅ |
Установить scope-drift-detection-spn в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл scope-drift-detection-spn?
Use this skill when asked to detect scope drift, behavioral expansion, or gradual privilege/access creep in service principals or automation accounts. Triggers on keywords like "scope drift", "service principal drift", "SPN behavioral change", "automation account drift", "baseline deviation", "access expansion", or when investigating whether a service principal has gradually expanded beyond its intended purpose. This skill builds a 90-day behavioral baseline per SPN, compares it with 7-day recent activity, computes a weighted Drift Score across 5 dimensions, and correlates with SecurityAlert and AuditLogs for corroborating evidence.
Как установить скилл scope-drift-detection-spn?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл scope-drift-detection-spn запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic