Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Microsoft Exchange External Forwarding Detection #1529

Merged
merged 6 commits into from
Mar 4, 2025

Conversation

arielkr256
Copy link
Contributor

@arielkr256 arielkr256 commented Mar 4, 2025

Description:

This PR significantly improves the accuracy and capabilities of the Microsoft Exchange external forwarding detection rule. The changes include:

Key Improvements:

  • Removed dependency on user configuration - The rule now automatically determines internal domains from the event context instead of relying on predefined allow lists (MS_EXCHANGE_ALLOWED_FORWARDING_DESTINATION_EMAILS and MS_EXCHANGE_ALLOWED_FORWARDING_DESTINATION_DOMAINS)
  • Improved external domain detection by properly handling both primary and onmicrosoft.com domains
  • Added detection of multiple suspicious forwarding patterns:
    • Forwarding without keeping a copy (DeliverToMailboxAndForward=False)
    • Message deletion after forwarding (DeleteMessage=True)
    • Rule processing termination (StopProcessingRules=True)
  • Enhanced handling of multiple forwarding methods:
    • SMTP forwarding
    • Direct forwarding
    • Forwarding as attachment
    • Redirect rules
  • Better support for multiple forwarding addresses (semicolon-separated)
  • Added comprehensive test cases covering various scenarios
  • Improved alert context and title formatting to include suspicious patterns

Documentation Updates:

  • Expanded rule description with detailed detection capabilities
  • Added MITRE ATT&CK mappings for:
    • Persistence (T1137.005 - Outlook Rules)
    • Collection (T1114.003 - Email Forwarding Rule)
    • Exfiltration (T1020 - Automated Exfiltration)
  • Added detailed runbook with investigation and response steps
  • Added relevant tags for better categorization

Testing:

The PR includes extensive test cases covering:

  • External vs internal domain forwarding
  • Subdomain handling
  • Multiple forwarding addresses
  • Various suspicious patterns
  • Edge cases (invalid formats, missing organization info)
  • Different TLD scenarios

Impact:

This enhancement will provide better detection coverage for potential data exfiltration attempts via email forwarding while reducing false positives through more accurate domain validation. The removal of configuration dependencies makes the rule more maintainable and reduces the operational overhead of managing allow lists.

@arielkr256 arielkr256 requested a review from a team as a code owner March 4, 2025 00:23
@arielkr256 arielkr256 changed the title reworked the rule to be more accurate Enhanced Microsoft Exchange External Forwarding Detection Mar 4, 2025
@arielkr256
Copy link
Contributor Author

check-deprecated is failing because the RuleID was moved from the bottom of the file to above the tests for better readability. The RuleID itself has not changed.

@arielkr256 arielkr256 marked this pull request as draft March 4, 2025 00:44
@arielkr256 arielkr256 added rules Real-time log data detections tuning detection tuning labels Mar 4, 2025
@arielkr256 arielkr256 marked this pull request as ready for review March 4, 2025 17:03
@arielkr256 arielkr256 added this pull request to the merge queue Mar 4, 2025
Merged via the queue into develop with commit 17515a1 Mar 4, 2025
6 of 7 checks passed
@arielkr256 arielkr256 deleted the ask-1544-exchange-email-config branch March 4, 2025 17:06
akozlovets098 pushed a commit that referenced this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rules Real-time log data detections tuning detection tuning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants