Skip to content
Skillpedia
Analysis & spreadsheets35k · #5477

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

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-office365-audit-logs-for-compromise/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-office365-audit-logs-for-compromise/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
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-compromise

Or 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.md
Technical 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

  1. Authenticate to Microsoft Graph using MSAL client credentials flow
  2. Query Unified Audit Log for suspicious operations (Set-Mailbox, New-InboxRule)
  3. Enumerate inbox rules across mailboxes and flag forwarding rules
  4. Detect mailbox delegation changes (Add-MailboxPermission)
  5. Identify OAuth consent grants to suspicious applications
  6. Check for suspicious sign-in patterns from audit logs
  7. 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.

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#5477
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