Mail forwarding rule created in a script block
Matches AN1589's cmdlet half: a PowerShell script block that names an inbox, transport or mailbox cmdlet together with one of the parameters that actually redirects mail to another recipient. Both halves are required, because the cmdlet alone is ordinary administration — Set-Mailbox is used for a hundred unrelated settings — and the parameter name alone appears in any script that merely reports on forwarding. The whole selection sits on `ScriptBlockText` under EventID 4104, the field that carries the command text after the engine has resolved encoding or obfuscation; the same channel's 4103 records carry the cmdlet in `Payload` instead, so that feed needs a field mapping and is not matched here. The brief's other source, Security 4688, was not used: it sees only powershell.exe's own command line, which for an interactive Exchange session carries no cmdlet text at all. MITRE supplies the TargetMailbox and UserContext knobs; the cmdlet and parameter lists here are authored. Two limits worth stating: a forwarding rule created in the web client, in the mail client's own rules dialog, or through a Graph API call writes nothing to any Windows event channel — that activity is recorded in the tenant's own audit log, which is not in this brief — and EventID 4104 requires *Script Block Logging* to be enabled by policy, which is off in a default install, so zero rows here reads as quiet when it means blind. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0576, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
Sentinel · KQL
Run this as a search.
Event| where ((EventID == 4104 and (ScriptBlockText contains "New-InboxRule" or ScriptBlockText contains "Set-InboxRule" or ScriptBlockText contains "New-TransportRule" or ScriptBlockText contains "Set-TransportRule" or ScriptBlockText contains "Set-Mailbox")) and (ScriptBlockText contains "ForwardTo" or ScriptBlockText contains "ForwardAsAttachmentTo" or ScriptBlockText contains "RedirectTo" or ScriptBlockText contains "RedirectMessageTo" or ScriptBlockText contains "ForwardingSmtpAddress" or ScriptBlockText contains "ForwardingAddress" or ScriptBlockText contains "DeliverToMailboxAndForward" or ScriptBlockText contains "BlindCopyTo"))
Splunk · SPL
Run this as a search.
index=* ((EventID="4104" AND (ScriptBlockText="*New-InboxRule*" OR ScriptBlockText="*Set-InboxRule*" OR ScriptBlockText="*New-TransportRule*" OR ScriptBlockText="*Set-TransportRule*" OR ScriptBlockText="*Set-Mailbox*")) AND (ScriptBlockText="*ForwardTo*" OR ScriptBlockText="*ForwardAsAttachmentTo*" OR ScriptBlockText="*RedirectTo*" OR ScriptBlockText="*RedirectMessageTo*" OR ScriptBlockText="*ForwardingSmtpAddress*" OR ScriptBlockText="*ForwardingAddress*" OR ScriptBlockText="*DeliverToMailboxAndForward*" OR ScriptBlockText="*BlindCopyTo*"))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE ((event.code == 4104 AND (TO_LOWER(powershell.file.script_block_text) LIKE "*new-inboxrule*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*set-inboxrule*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*new-transportrule*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*set-transportrule*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*set-mailbox*")) AND (TO_LOWER(powershell.file.script_block_text) LIKE "*forwardto*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*forwardasattachmentto*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*redirectto*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*redirectmessageto*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*forwardingsmtpaddress*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*forwardingaddress*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*delivertomailboxandforward*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*blindcopyto*"))
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <rule id="100000" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="EventID" type="pcre2">(?i)^4104$</field> <field name="ScriptBlockText" type="pcre2">(?i)(New-InboxRule|Set-InboxRule|New-TransportRule|Set-TransportRule|Set-Mailbox)</field> <field name="ScriptBlockText" type="pcre2">(?i)(ForwardTo|ForwardAsAttachmentTo|RedirectTo|RedirectMessageTo|ForwardingSmtpAddress|ForwardingAddress|DeliverToMailboxAndForward|BlindCopyTo)</field> <description>Mail forwarding rule created in a script block</description> <mitre> <id>T1114.003</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
No comments yet. Someone who deploys this will have something to say about it.