Skip to content
Skillpedia
Misc35k · #5662

detecting-email-account-compromise

Lets your agent identify compromised email accounts. It analyzes access logs and email rules to detect suspicious activity.

What it does

This tool helps discover if email accounts have been hacked. It looks for suspicious activities like strange forwarding rules, logins from unusual places, or the use of unauthorized applications.

When to use it

  • ✓When you suspect someone has hacked into your email account.
  • ✓To check for email rules that are sending your messages elsewhere without your permission.
  • ✓When investigating a possible identity theft or fraud attack.

Example of what to ask your AI

“Check my email accounts for hacks.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-email-account-compromise/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-email-account-compromise/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool analyzes your email account activity logs and login records. It looks for patterns that indicate a hacker might have access, such as email rules sending messages out or logins from very distant locations.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill detecting-email-account-compromise

Or download just the file:

curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/detecting-email-account-compromise/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Detecting 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, msal libraries
  • Microsoft Graph API application registration with Mail.Read, AuditLog.Read.All permissions
  • Understanding of OAuth2 client credential flows

Steps

  1. Export audit logs or connect to Microsoft Graph API using MSAL authentication
  2. Query inbox rules for all monitored mailboxes via /users/{id}/mailFolders/inbox/messageRules
  3. Analyze rules for external forwarding (ForwardTo, RedirectTo external addresses)
  4. Detect suspicious rule patterns: deletion rules, keyword-matching rules targeting financial terms
  5. Query sign-in logs via /auditLogs/signIns for unusual locations and impossible travel
  6. Check for suspicious user agent strings (python-requests, PowerShell, curl)
  7. Identify OAuth application consent grants for suspicious third-party apps
  8. Correlate findings across users to detect campaign-level compromise
  9. 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.

FAQ

What are 'forwarding rules'?

These are settings you can create in your email to automatically send certain messages to another address. A hacker might create these rules to steal your information.

What does 'impossible travel' mean?

It's when logs show you logged in from very distant locations in a short amount of time, suggesting someone else might be using your account.

Do I need technical knowledge to use this?

No, this tool is designed for anyone to use. It simplifies detecting security issues in your email accounts.

Details

Original description by the author

Detect compromised O365 and Google Workspace email accounts by analyzing Unified Audit Logs and Azure AD sign-in logs for impossible travel, inbox rule creation/deletion (Set-InboxRule, New-InboxRule), external mail forwarding rules, and unusual Microsoft Graph API access or OAuth token use. Use when investigating suspected business email compromise (BEC), account takeover, or mailbox persistence

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#5662
License
Apache-2.0
Updated
8/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills