技能 硬件工程 检测O365邮件账户泄露

检测O365邮件账户泄露

v20260601
detecting-email-account-compromise
本技能提供了一套完整的流程,用于检测O365和Google Workspace中的邮件账户泄露。它通过分析关键指标,如未经授权的收件箱规则创建(如转发或删除规则)、可疑的登录地点(如无法旅行事件),以及使用Microsoft Graph和统一审计日志检测异常的API访问模式。主要用于安全威胁狩猎和事件响应,以防范商业邮件欺诈(BEC)。
获取技能
287 次下载
概览

Detecting Email Account Compromise

Overview

Email account compromise (EAC) is a prevalent attack vector where adversaries gain unauthorized access to mailboxes to exfiltrate sensitive data, conduct business email compromise (BEC), or establish persistence through inbox rule manipulation. Attackers commonly create forwarding rules to siphon emails, delete rules to hide evidence, or use OAuth tokens for persistent access. Detection relies on analyzing Microsoft 365 Unified Audit Logs, Azure AD sign-in logs for impossible travel or suspicious locations, inbox rule creation events (Set-InboxRule, New-InboxRule), and Microsoft Graph API access patterns. Key indicators include forwarding rules to external addresses, rules that delete or move messages matching keywords like "invoice" or "payment", and sign-ins from unusual user agents such as python-requests.

When to Use

  • When investigating security incidents that require detecting email account 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

  • Microsoft 365 with Unified Audit Logging enabled
  • Azure AD P1/P2 for risk detection APIs
  • Python 3.9+ with requests, msal libraries
  • Microsoft Graph API application registration with Mail.Read, AuditLog.Read.All permissions
  • Understanding of OAuth2 client credential flows

Steps

  1. Export audit logs or connect to Microsoft Graph API using MSAL authentication
  2. Query inbox rules for all monitored mailboxes via /users/{id}/mailFolders/inbox/messageRules
  3. Analyze rules for external forwarding (ForwardTo, RedirectTo external addresses)
  4. Detect suspicious rule patterns: deletion rules, keyword-matching rules targeting financial terms
  5. Query sign-in logs via /auditLogs/signIns for unusual locations and impossible travel
  6. Check for suspicious user agent strings (python-requests, PowerShell, curl)
  7. Identify OAuth application consent grants for suspicious third-party apps
  8. Correlate findings across users to detect campaign-level compromise
  9. Generate compromise indicators report with severity scores

Expected Output

A JSON report listing compromised or suspicious accounts, malicious inbox rules detected, impossible travel events, suspicious OAuth grants, and recommended containment actions with severity ratings.

信息
Category 硬件工程
Name detecting-email-account-compromise
版本 v20260601
大小 9.74KB
更新时间 2026-06-03
语言