analyzing-office365-audit-logs-for-compromise
Makes your agent check Office 365 logs for signs of intrusion. It looks for suspicious changes in account settings.
What it does
This tool analyzes your Microsoft 365 account activity logs to find signs that it might have been hacked. It looks for suspicious changes, like email forwarding rules or unauthorized access.
When to use it
- ✓When you suspect your Microsoft 365 account has been compromised.
- ✓To check for unusual activity in your emails.
- ✓When investigating a company security incident.
Example of what to ask your AI
“Check my Microsoft 365 email logs for suspicious hacking activity.”
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
Ready-to-paste message
How it works
The tool connects to your Microsoft 365 account using a secure code. Then, it searches the activity logs for unusual actions, such as creating forwarding rules or granting permissions to unknown apps.
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 analyzing-office365-audit-logs-for-compromiseOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/analyzing-office365-audit-logs-for-compromise/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Analyzing Office 365 Audit Logs for Compromise
Overview
Business Email Compromise (BEC) attacks often leave traces in Office 365 audit logs: suspicious inbox rule creation, email forwarding to external addresses, mailbox delegation changes, and unauthorized OAuth application consent grants. This skill uses the Microsoft Graph API to query the Unified Audit Log, enumerate inbox rules across mailboxes, detect forwarding configurations, and identify compromised account indicators.
When to Use
- When investigating security incidents that require analyzing office365 audit logs for 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
- Azure AD app registration with
AuditLog.Read.All,MailboxSettings.Read,Mail.Read(application permissions) - Python 3.9+ with
msal,requests - Client secret or certificate for authentication
- Global Reader or Security Reader role
Steps
- Authenticate to Microsoft Graph using MSAL client credentials flow
- Query Unified Audit Log for suspicious operations (Set-Mailbox, New-InboxRule)
- Enumerate inbox rules across mailboxes and flag forwarding rules
- Detect mailbox delegation changes (Add-MailboxPermission)
- Identify OAuth consent grants to suspicious applications
- Check for suspicious sign-in patterns from audit logs
- Generate compromise indicator report with timeline
Expected Output
- JSON report listing forwarding rules, delegation changes, OAuth grants, and suspicious audit events with risk scores
- Timeline of compromise indicators with affected mailboxes
FAQ
What are 'audit logs'?
They are like a diary of everything that happens in your Microsoft 365 account, recording who did what and when.
What is 'Business Email Compromise' (BEC)?
It's a type of scam where criminals pretend to be someone you know to trick people into giving information or money.
Do I need to be a tech expert to use this?
No, the tool is designed for anyone to use. It simplifies the analysis of security logs.
Details
Original description by the author
Parse Office 365 Unified Audit Logs via Microsoft Graph API to detect email forwarding rule creation, inbox delegation, suspicious OAuth app grants, and other indicators of account compromise.
Popularity
- GitHub stars
- 35k
- Ranking position
- #5477
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
data-throughput-accelerator
Makes your agent speed up the movement of large data volumes. It finds bottlenecks and ensures data is transferred quickly and correctly.
affaan-m/ECC
inventory-demand-planning
Helps your agent predict product demand in stores. It optimizes stock and plans when to run promotions to sell more.
affaan-m/ECC
market-research
Helps your agent conduct market research and competitive analysis. Provides summaries with source attribution.
affaan-m/ECC