DNS TXT Answers Containing Command Execution Keywords (IEX, Invoke-Expression, cmd.exe)
Alerts on DNS TXT answers containing IEX/Invoke-Expression or cmd.exe strings indicative of execution-oriented payloads.
- Category
- dns
- Author
- Markus Neis (SigmaHQ), DRL 1.1
- Published
- 2018-08-08
- Updated
- 2026-07-31
ATT&CK techniques
C2Recon
Resource Dev
Initial Access
Execution
Persistence
Priv Esc
Defense Evasion
Cred Access
Discovery
Lateral Movement
Collection
Exfiltration
Impact
What it detects
This rule flags DNS responses where the TXT record content contains likely command-execution indicators such as "IEX", "Invoke-Expression", or "cmd.exe". Attackers may embed executable commands or scripting triggers in DNS TXT answers to blend C2 traffic with normal DNS activity. It relies on DNS telemetry that includes the DNS record type and the TXT answer payload so the response can be scanned for these specific strings.
Reporting behind it
- twitter.comhttps://twitter.com/stvemillertime/status/1024707932447854592
- github.comhttps://github.com/samratashok/nishang/blob/414ee1104526d7057f9adaeee196d91ae447283e/Backdoors/DNS_TXT_Pwnage.ps1
- github.comhttps://github.com/SigmaHQ/sigma/blob/master/rules/network/dns/net_dns_susp_txt_exec_strings.yml
Changelog
v2- 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: DNS TXT Answers Containing Command Execution Keywords (IEX, Invoke-Expression, cmd.exe)
id: e96f3522-1a4e-4b7f-8462-00f2fdfc03fa
status: test
description: This rule flags DNS responses where the TXT record content contains likely command-execution indicators such as "IEX", "Invoke-Expression", or "cmd.exe". Attackers may embed executable commands or scripting triggers in DNS TXT answers to blend C2 traffic with normal DNS activity. It relies on DNS telemetry that includes the DNS record type and the TXT answer payload so the response can be scanned for these specific strings.
references:
- https://twitter.com/stvemillertime/status/1024707932447854592
- https://github.com/samratashok/nishang/blob/414ee1104526d7057f9adaeee196d91ae447283e/Backdoors/DNS_TXT_Pwnage.ps1
- https://github.com/SigmaHQ/sigma/blob/master/rules/network/dns/net_dns_susp_txt_exec_strings.yml
author: Markus Neis, Huntrule Team
date: 2018-08-08
modified: 2021-11-27
tags:
- attack.command-and-control
- attack.t1071.004
logsource:
category: dns
detection:
selection:
record_type: TXT
answer|contains:
- IEX
- Invoke-Expression
- cmd.exe
condition: selection
falsepositives:
- Unknown
level: high
license: DRL-1.1
related:
- id: 8ae51330-899c-4641-8125-e39f2e07da72
type: derived