|
| 1 | +name: Windows Powershell Commands from DNS TXT |
| 2 | +id: b61353cd-5b09-4699-8b86-6517a9038043 |
| 3 | +version: 1 |
| 4 | +creation_date: '2026-07-30' |
| 5 | +modification_date: '2026-07-30' |
| 6 | +author: Raven Tait, Splunk |
| 7 | +status: production |
| 8 | +type: Anomaly |
| 9 | +description: >- |
| 10 | + The following analytic detects execution of powershell commands retrieved from |
| 11 | + a remote DNS TXT query response. The use of the DNS TXT record for C2 is an uncommon |
| 12 | + method for malware that is resilient due to the need for DNS in normal networking |
| 13 | + activities. This can ensure that their c2 is not blocked by any firewalls. False |
| 14 | + positives are highly unlikely due to the very uncommon chaining of powershell |
| 15 | + and DNS TXT queries. |
| 16 | +data_source: |
| 17 | + - Powershell Script Block Logging 4104 |
| 18 | +search: |- |
| 19 | + `powershell` EventCode=4104 |
| 20 | + ( |
| 21 | + (ScriptBlockText="*resolve-dnsname*" AND ScriptBlockText="*-Type TXT*") |
| 22 | + OR (ScriptBlockText="*nslookup*" AND ScriptBlockText="*type=txt*") |
| 23 | + OR (ScriptBlockText="*dig*" AND ScriptBlockText="* TXT*") |
| 24 | + ) |
| 25 | + (ScriptBlockText="*. (*" OR ScriptBlockText="*IEX*") |
| 26 | + | fillnull |
| 27 | + | stats count min(_time) as firstTime max(_time) as lastTime |
| 28 | + by dest signature signature_id |
| 29 | + user_id vendor_product EventID |
| 30 | + Guid Opcode Name |
| 31 | + Path ProcessID ScriptBlockId |
| 32 | + ScriptBlockText |
| 33 | + | `security_content_ctime(firstTime)` |
| 34 | + | `security_content_ctime(lastTime)` |
| 35 | + | `windows_powershell_commands_from_dns_txt_filter` |
| 36 | +how_to_implement: To successfully implement this analytic, you will need to enable PowerShell Script Block Logging on some or all endpoints. Additional setup instructions are available at https://docs.splunk.com/Documentation/ES/latest/Admin/Configurepowershelllogging. |
| 37 | +known_false_positives: False positives are highly unlikely given the uncommon combination of PowerShell execution and DNS TXT query responses. Legitimate use cases for this behavior are extremely rare and should be investigated thoroughly if detected. |
| 38 | +drilldown_searches: |
| 39 | + - name: View the detection results for - "$user_id$" and "$dest$" |
| 40 | + search: '%original_detection_search% | search user_id = "$user_id$" dest = "$dest$"' |
| 41 | + earliest_offset: $info_min_time$ |
| 42 | + latest_offset: $info_max_time$ |
| 43 | + - name: View risk events for the last 7 days for - "$user_id$" and "$dest$" |
| 44 | + search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user_id$", "$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`' |
| 45 | + earliest_offset: 7d |
| 46 | + latest_offset: "0" |
| 47 | +intermediate_findings: |
| 48 | + entities: |
| 49 | + - field: dest |
| 50 | + type: system |
| 51 | + score: 20 |
| 52 | + message: A suspicious PowerShell script with the ScriptBlockId [$ScriptBlockId$] containing DNS TXT query commands was executed on host $dest$ |
| 53 | + - field: user_id |
| 54 | + type: user |
| 55 | + score: 20 |
| 56 | + message: A suspicious PowerShell script with the ScriptBlockId [$ScriptBlockId$] containing DNS TXT query commands was executed on host $dest$ by user $user_id$ |
| 57 | +analytic_story: |
| 58 | + - Malicious PowerShell |
| 59 | + - Command And Control |
| 60 | + - Suspicious DNS Traffic |
| 61 | +asset_type: Endpoint |
| 62 | +mitre_attack_id: |
| 63 | + - T1071.004 |
| 64 | + - T1059.001 |
| 65 | +product: |
| 66 | + - Splunk Enterprise |
| 67 | + - Splunk Enterprise Security |
| 68 | + - Splunk Cloud |
| 69 | +security_domain: endpoint |
| 70 | +category: endpoint |
| 71 | +tests: |
| 72 | + - name: True Positive Test |
| 73 | + attack_data: |
| 74 | + - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1071.004/windows_powershell_commands_from_dns_txt/snapattack_windows.log |
| 75 | + source: XmlWinEventLog:Microsoft-Windows-PowerShell/Operational |
| 76 | + sourcetype: XmlWinEventLog |
| 77 | + test_type: unit |
0 commit comments