‹ 首页

analyzing-office365-audit-logs-for-compromise

@xalgord · 收录于 昨天 · 上游提交 昨天

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.

适合你,如果需监控 Office 365 账户异常活动并快速定位入侵

/ 通过 npx 安装 校验哈希
npx oh-my-skill add xalgord/xalgorix/analyzing-office365-audit-logs-for-compromise
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- xalgord/xalgorix/analyzing-office365-audit-logs-for-compromise
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify xalgord/xalgorix/analyzing-office365-audit-logs-for-compromise
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
807GitHub stars
~695上下文体积 · 单文件
索引托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · eeaf26b

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
Detection Gaps & Validation
  • Forwarding hides in more than inbox rules: check New-InboxRule/Set-InboxRule/UpdateInboxRules and mailbox-level Set-Mailbox -ForwardingSmtpAddress/-ForwardingAddress, plus transport rules (New-TransportRule). A clean inbox-rule list does not mean no forwarding.
  • Operations attackers use: Add-MailboxPermission/Add-RecipientPermission (delegation), Consent to application / Add app role assignment grant to user (illicit OAuth consent), Add delegated permission grant, and Set-MailboxAuditBypassAssociation (silences mailbox auditing for an identity — a strong tamper signal).
  • MailItemsAccessed (access-scoping for BEC blast radius) only logs with E5/Advanced Audit; on E3 you cannot prove which messages were read.
  • UAL realities: ingestion latency (minutes to hours) means ago(1h) windows miss late events — pivot on the event's own timestamp; default retention is 90/180 days; verify auditing is even on with Get-AdminAuditLogConfig/Get-Mailbox | fl AuditEnabled before trusting an empty result.
  • Validate the query fires: create a benign external-forwarding inbox rule on a test mailbox, then confirm it surfaces via Search-UnifiedAuditLog -Operations New-InboxRule / the Graph auditLogs query; tune FPs by allow-listing approved enterprise apps (AppId) and known delegation service accounts.
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
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。