Skip to main content
NEW · APP STORE Now on iOS · macOS · iPad Android & Windows soon GET IT
Prompts Office 365 Audit Log Compromise Analyzer

analyst security skill risk: medium

Office 365 Audit Log Compromise Analyzer

The prompt provides steps to authenticate via MSAL, query the Unified Audit Log for operations like Set-Mailbox and New-InboxRule, enumerate inbox rules and delegation changes, det…

  • Policy sensitive
  • Human review
  • External action: medium

SKILL 4 files · 2 folders

SKILL.md
---
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,"
---
# 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

REQUIRED CONTEXT

  • Azure AD app registration with AuditLog.Read.All, MailboxSettings.Read, Mail.Read permissions
  • Python 3.9+ environment with msal and requests
  • Client secret or certificate
  • Global Reader or Security Reader role

EXPECTED OUTPUT

Format
json
Schema
json_report · forwarding rules, delegation changes, OAuth grants, suspicious audit events, risk scores, timeline
Constraints
  • include risk scores
  • include timeline of indicators
  • list forwarding rules, delegation changes, OAuth grants, and suspicious events

SUCCESS CRITERIA

  • Generate JSON report listing forwarding rules, delegation changes, OAuth grants, and suspicious audit events with risk scores
  • Include timeline of compromise indicators with affected mailboxes

CAVEATS

Dependencies
  • 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
Missing context
  • Exact Microsoft Graph API endpoints or query examples
  • Detailed success criteria or validation methods for each step
Ambiguities
  • The description field is truncated mid-sentence: 'inbox delegation,'

QUALITY

OVERALL
0.60
CLARITY
0.75
SPECIFICITY
0.45
REUSABILITY
0.60
COMPLETENESS
0.65

IMPROVEMENT SUGGESTIONS

  • Complete the truncated description sentence in the header.
  • Expand the numbered steps with concrete API calls, parameters, or pseudocode.

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR ANALYST