
Detecting Email Account Compromise
FreeIdentify compromised email accounts in Microsoft 365.
Free · Opens the source repo
What Detecting Email Account Compromise does
Detecting Email Account Compromise (EAC) is a critical skill designed for security professionals and SOC analysts who need to identify unauthorized access to email accounts in Microsoft 365 and Google Workspace. This skill leverages the analysis of Unified Audit Logs and Azure Active Directory (AD) sign-in logs to detect suspicious activities that may indicate a breach. It focuses on key indicators such as impossible travel patterns, the creation or deletion of inbox rules, and unusual access via the Microsoft Graph API.
By utilizing this skill, users can effectively investigate incidents of business email compromise (BEC) and account takeovers. The process involves querying inbox rules to identify potentially malicious forwarding rules and analyzing sign-in logs for unusual user agents or locations. The skill also helps in detecting OAuth token misuse, which can be a sign of persistent access by unauthorized users. The output is a structured JSON report detailing compromised accounts, suspicious rules, and recommended actions, enabling users to respond swiftly to threats.
This skill is particularly useful for organizations that prioritize email security and want to enhance their detection capabilities against common attack vectors. With the increasing sophistication of cyber threats, having a dedicated tool for identifying email account compromises is essential for maintaining the integrity of sensitive information and preventing data breaches.
To utilize this skill effectively, users must have a solid understanding of Microsoft 365's auditing features, Azure AD permissions, and OAuth2 flows. This ensures that they can set up the necessary environment and interpret the findings accurately, making it a valuable addition to any security toolkit.
When to use it
Use this skill when investigating suspected email account compromises or when building detection rules for security monitoring.
When not to use it
This skill is not suitable for environments without Microsoft 365 or Azure AD, or for users unfamiliar with security auditing processes.
What you can build with it
Investigating a Security Incident
Use this skill to analyze email accounts suspected of being compromised during a security breach investigation.
Building Detection Rules
Develop and refine detection rules for monitoring email account activities and identifying potential threats.
Validating Security Monitoring Coverage
Assess your organization's security monitoring capabilities by validating coverage against known attack techniques.
How to install Detecting Email Account Compromise
View source1. Install with the skills CLI
npx skills add mukul975/anthropic-cybersecurity-skills/detecting-email-account-compromise --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mukul975Detecting Email Account Compromise
Overview
Email account compromise (EAC) is a prevalent attack vector where adversaries gain unauthorized access to mailboxes to exfiltrate sensitive data, conduct business email compromise (BEC), or establish persistence through inbox rule manipulation. Attackers commonly create forwarding rules to siphon emails, delete rules to hide evidence, or use OAuth tokens for persistent access. Detection relies on analyzing Microsoft 365 Unified Audit Logs, Azure AD sign-in logs for impossible travel or suspicious locations, inbox rule creation events (Set-InboxRule, New-InboxRule), and Microsoft Graph API access patterns. Key indicators include forwarding rules to external addresses, rules that delete or move messages matching keywords like "invoice" or "payment", and sign-ins from unusual user agents such as python-requests.
When to Use
- When investigating security incidents that require detecting email account compromise
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Microsoft 365 with Unified Audit Logging enabled
- Azure AD P1/P2 for risk detection APIs
- Python 3.9+ with
requests,msallibraries - Microsoft Graph API application registration with Mail.Read, AuditLog.Read.All permissions
- Understanding of OAuth2 client credential flows
Steps
- Export audit logs or connect to Microsoft Graph API using MSAL authentication
- Query inbox rules for all monitored mailboxes via
/users/{id}/mailFolders/inbox/messageRules - Analyze rules for external forwarding (ForwardTo, RedirectTo external addresses)
- Detect suspicious rule patterns: deletion rules, keyword-matching rules targeting financial terms
- Query sign-in logs via
/auditLogs/signInsfor unusual locations and impossible travel - Check for suspicious user agent strings (python-requests, PowerShell, curl)
- Identify OAuth application consent grants for suspicious third-party apps
- Correlate findings across users to detect campaign-level compromise
- Generate compromise indicators report with severity scores
Expected Output
A JSON report listing compromised or suspicious accounts, malicious inbox rules detected, impossible travel events, suspicious OAuth grants, and recommended containment actions with severity ratings.
Frequently asked questions about Detecting Email Account Compromise
Similar skills
Asset Criticality Scoring for Vulns
Prioritize vulnerabilities based on asset criticality.
Performing Alert Triage with Elastic SIEM
Streamline alert triage processes in Elastic Security.
Active Directory Vulnerability Assessment
Secure your Active Directory with comprehensive assessments.
Active Directory Investigation
Streamline your Active Directory compromise investigations.
Parsing Artifacts with Eric Zimmerman Tools
Efficiently parse Windows forensic artifacts for analysis.
Operationalizing MISP Threat Feeds
Enhance threat detection with curated MISP feeds.
