Skip to main content
skill CX Codex

analyzing-office365-audit-logs-for-compromise — Claude Code skill

analyzing-office365-audit-logs-for-compromise parses Office 365 Unified Audit Logs via Microsoft Graph API to spot inbox forwarding rules, mailbox delegation, and rogue OAuth app grants.

Apache-2.0 304 installs ★ 36,511 updated 2026-08-31

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-office365-audit-logs-for-compromise -a claude-code
Open on GitHub

What analyzing-office365-audit-logs-for-compromise does

This skill targets Business Email Compromise investigations inside Microsoft 365 environments. It queries the Unified Audit Log using the Microsoft Graph API, watching for events such as Set-Mailbox and New-InboxRule. The routine maps out inbox rules across all mailboxes to flag external forwarding, tracks Add-MailboxPermission changes, and uncovers untrusted OAuth consent grants.

Results come back as a JSON report containing risk scores, alongside a chronological timeline of indicators and impacted mailboxes. Analysis maps directly to NIST CSF controls and MITRE ATT&CK techniques T1114.002, T1098.002, T1556.006, and T1078.004.

The workflow fails immediately without an Azure AD app registration holding AuditLog.Read.All, MailboxSettings.Read, and Mail.Read application permissions. You also need Python 3.9+ with msal and requests, a client secret or certificate, and a tenant-level Global Reader or Security Reader role.

What it helps with

  • Flag hidden inbox rules redirecting incoming emails to external destinations
  • Detect unauthorized mailbox delegation granted via Add-MailboxPermission
  • Identify risky OAuth application consent grants within the tenant
  • Build an incident timeline correlating suspicious logins and mailbox reconfigurations

Example prompts for the agent

  • Analyze Office 365 audit logs for suspicious inbox forwarding rules created this week
  • Check Microsoft Graph for recent mailbox delegation changes and suspicious OAuth grants
  • Generate a compromise indicator report with risk scores for the affected mailboxes

How to install analyzing-office365-audit-logs-for-compromise

1Skills CLI (Vercel)

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-office365-audit-logs-for-compromise -a claude-code

2Manually: put the files in place

~/.claude/skills/analyzing-office365-audit-logs-for-compromise/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/analyzing-office365-audit-logs-for-compromise/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about analyzing-office365-audit-logs-for-compromise

How do I install analyzing-office365-audit-logs-for-compromise in Claude Code?

Run npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill analyzing-office365-audit-logs-for-compromise -a claude-code. This registers the skill file at ~/.claude/skills/analyzing-office365-audit-logs-for-compromise/SKILL.md.

What does this skill inspect in Office 365?

It checks the Unified Audit Log and mailbox configurations via Microsoft Graph API. It searches for forwarding rules, delegation grants, abnormal sign-in events, and OAuth app permissions associated with account takeover.

What permissions does the script require in Microsoft 365?

You must register an Azure AD app with application permissions AuditLog.Read.All, MailboxSettings.Read, and Mail.Read. The executing principal needs either Global Reader or Security Reader roles.

Source text

SKILL.md · Apache-2.0
---
name: analyzing-office365-audit-logs-for-compromise
description: 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.
domain: cybersecurity
subdomain: cloud-security
tags:
- Office365
- Microsoft-Graph
- audit-logs
- email-compromise
- inbox-rules
- OAuth
- BEC
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.IR-01
- ID.AM-08
- GV.SC-06
- DE.CM-01
mitre_attack:
- T1114.002
- T1098.002
- T1556.006
- T1078.004
---

# 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

© mahipal · Apache-2.0 · mukul975/Anthropic-Cybersecurity-Skills

Similar skills

All skills for Security →

From the same set152

The whole set →
analyzing-powershell-script-block-logging The analyzing-powershell-script-block-logging skill parses PowerShell Script Block Logging events from EVTX files and flags obfuscated commands, Base64 payloads and AMSI bypass attempts. CX Codex +1 313installs analyzing-ransomware-encryption-mechanisms analyzing-ransomware-encryption-mechanisms analyzes ransomware encryption schemes, key management routines, and file structures. Helps evaluate whether encrypted files can be recovered without paying a ransom. CX Codex +1 312installs performing-web-application-firewall-bypass performing-web-application-firewall-bypass guides security testing agents through bypassing web application firewalls. It provides obfuscation techniques, parameter pollution, and HTTP tricks to test SQLi and XSS payloads. CX Codex +1 310installs auditing-aws-s3-bucket-permissions auditing-aws-s3-bucket-permissions audits AWS S3 bucket permissions, public access, bucket policies, and encryption via AWS CLI and Prowler. Helps baseline new cloud accounts and verify compliance for SOC 2 or PCI DSS. CX Codex +1 307installs exploiting-jwt-algorithm-confusion-attack The exploiting-jwt-algorithm-confusion-attack skill tests JWT authentication for algorithm switching, alg:none, and key-header issues. Use it for authorized API security checks. CX Codex +1 303installs analyzing-powershell-empire-artifacts The analyzing-powershell-empire-artifacts skill hunts for PowerShell Empire traces in Windows event logs and builds a report with IOCs, decoded payloads, and MITRE ATT&CK mappings. CX Codex +1 303installs configuring-oauth2-authorization-flow The configuring-oauth2-authorization-flow skill guides OAuth 2.0 setup for web, mobile, SPA, and machine clients. Use it when adding authorization or reviewing an existing flow. CX Codex +1 301installs exploiting-broken-function-level-authorization The exploiting-broken-function-level-authorization skill for Claude Code tests APIs for OWASP API5:2023: whether low-privilege users can invoke admin functions by manipulating HTTP methods, paths, and parameters. CX Codex +1 299installs

Project sponsors

Companies that keep this analytics open