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.

FreeReviewedSigma · High · v2
Category
dns
Author
Markus Neis (SigmaHQ), DRL 1.1
Published
2018-08-08
Updated
2026-07-31
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