analyzing-office365-audit-logs-for-compromise
This skill queries Microsoft Office 365 Unified Audit Logs via the Microsoft Graph API to detect indicators of business email compromise, including suspicious inbox rule creation, email forwarding to external addresses, unauthorized mailbox delegation changes, and anomalous OAuth application consent grants. Use it when investigating security incidents, building threat detection rules, or performing threat hunting for Office 365 account compromise.
git clone --depth 1 https://github.com/mukul975/Anthropic-Cybersecurity-Skills /tmp/analyzing-office365-audit-logs-for-compromise && cp -r /tmp/analyzing-office365-audit-logs-for-compromise/skills/analyzing-office365-audit-logs-for-compromise ~/.claude/skills/analyzing-office365-audit-logs-for-compromiseSKILL.md
# 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
Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.
Detect dangerous ACL misconfigurations in Active Directory using ldap3
Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.
Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect
Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups' TTPs for detection-gap analysis. Use to compare threat-actor technique coverage, find gaps in detection engineering, or produce Navigator visualizations for threat-intel reporting.
Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query