Windows MSExchange Management events indicating likely MS Exchange RCE CVE-2021-42321 exploitation
Flags Exchange management events showing Get-App cmdlet failures and unhandled InvalidCastException during CVE-2021-42321 RCE attempts.
- Product
- windows
- Service
- msexchange-management
- Author
- Florian Roth (Nextron Systems), @testanull (SigmaHQ), DRL 1.1
- Published
- 2021-11-18
- Updated
- 2026-07-31
ATT&CK techniques
Lateral MovementRecon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
C2
Exfiltration
Impact
What it detects
This rule matches Windows msexchange-management log entries with EventID 6 or 8 that contain evidence of Exchange PowerShell cmdlet failures. It looks for “Cmdlet failed. Cmdlet Get-App” and an “Unhandled exception: System.InvalidCastException” string, which can appear during exploitation attempts targeting CVE-2021-42321. Telemetry relies on the Exchange management logging captured by the Windows msexchange-management service, specifically the EventID and the embedded message/data fields containing those error fragments.
Reporting behind it
Changelog
v5- v5Candidate ingested via manual entry.2026-07-31
- v4Candidate ingested via manual entry.2026-07-31
- v3Candidate ingested via manual entry.2026-07-31
- v2Candidate ingested via manual entry.2026-07-31
- v1No changelog recorded for this version.2026-07-30
Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.
title: Windows MSExchange Management events indicating likely MS Exchange RCE CVE-2021-42321 exploitation
id: 38980bdb-d8dc-41b6-abc8-71fd985fbad6
status: test
description: "This rule matches Windows msexchange-management log entries with EventID 6 or 8 that contain evidence of Exchange PowerShell cmdlet failures. It looks for “Cmdlet failed. Cmdlet Get-App” and an “Unhandled exception: System.InvalidCastException” string, which can appear during exploitation attempts targeting CVE-2021-42321. Telemetry relies on the Exchange management logging captured by the Windows msexchange-management service, specifically the EventID and the embedded message/data fields containing those error fragments."
references:
- https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-42321
- https://github.com/SigmaHQ/sigma/blob/master/rules-emerging-threats/2021/Exploits/CVE-2021-42321/win_exchange_cve_2021_42321.yml
author: Florian Roth (Nextron Systems), @testanull, Huntrule Team
date: 2021-11-18
modified: 2022-07-12
tags:
- attack.lateral-movement
- attack.t1210
- detection.emerging-threats
logsource:
product: windows
service: msexchange-management
detection:
selection:
EventID:
- 6
- 8
Data|contains:
- "Cmdlet failed. Cmdlet Get-App, "
- "Task Get-App throwing unhandled exception: System.InvalidCastException:"
condition: selection
falsepositives:
- Unknown, please report false positives via https://github.com/SigmaHQ/sigma/issues
level: high
license: DRL-1.1
related:
- id: c92f1896-d1d2-43c3-92d5-7a5b35c217bb
type: derived