PowerShell Script Reading Files and Resolving DNS Host Entries

Identifies PowerShell scripts that read files, resolve DNS host entries, and output results to disk.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
Nasreddine Bencherchali (Nextron Systems) (SigmaHQ), DRL 1.1
Published
2023-05-05
Updated
2026-07-31

ATT&CK techniques

Exfiltration
  1. Recon

  2. Resource Dev

  3. Initial Access

  4. Execution

  5. Persistence

  6. Priv Esc

  7. Defense Evasion

  8. Cred Access

  9. Discovery

  10. Lateral Movement

  11. Collection

  12. C2

  13. Impact

What it detects

This rule identifies PowerShell script content that reads files, iterates over items, resolves DNS host entries via .NET, and writes results to a file. Attackers can use this combination to map hostnames to network information and stage data for further collection or exfiltration. Detection relies on PowerShell ScriptBlockText containing the specific strings for Get-content, foreach, [System.Net.Dns]::GetHostEntry, and Out-File.

Related detections9 linkedT1020 — drag to rearrange
Detect Email Forwarding/Redirecting via Exchange PowerShell InboxRule Cmdlets on Windows
AWS CloudTrail: RDS Cluster Modification or Deletion (ModifyDBCluster/DeleteDBCluster)
GitHub Audit Log: Repository or Organization Transfer Detected
GitHub Audit Logs: Private/Internal Forking Policy Enabled or Cleared
O365 Mail Forwarding and Redirecting Rule Changes
PowerShell script exfiltration using Invoke-WebRequest with POST or PUT
Microsoft 365 Cloud App Security Alerts on Suspicious Inbox Forwarding Rules
AWS CloudTrail RDS ModifyDBInstance Master User Password Change
AWS CloudTrail: RestoreDBInstanceFromDBSnapshot Creates Public RDS Instance
PowerShell Script Reading Files and Resolving DNS Host Entries
Pivot detection · T1020 · 9 related

Changelog

v2
  1. v2
    Candidate ingested via manual entry.2026-07-31
  2. v1
    No 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.