AI-Assisted PowerShell Script Enumerated Active Directory in June Incident

· Original article ↗

Summary

Huntress analyzed a threat actor’s bespoke PowerShell script used to enumerate Active Directory after RDP access to a domain-joined server, detailing its behavior, signs of AI generation, and implications for behavior-based detection.

Key points

  • In an incident on June 3, the actor used pre-compromised credentials to access a domain-joined Windows Server via RDP; context suggested initial access through a VPN.
  • The actor ran a custom PowerShell script that located a domain controller and collected Active Directory users, computers, groups, OUs, trusts, and subnet data.
  • The script saved CSV and text files, generated an HTML report, and zipped the output in an AD_Reports directory.
  • The attackers later deployed s5cmd, which can be abused for data exfiltration, and SharpShares to search for accessible data repositories; the article does not confirm what data was exfiltrated.
  • Huntress cited a prompt-iteration title, an unedited placeholder, repetitive fallback logic, and decorative console output as signs the script was AI-generated.
  • The article argues that bespoke scripts weaken reliance on file hashes and static signatures, while underlying enumeration behavior remains detectable.

Article Details

Attack Vectors
  • The attacker established RDP access to a domain-joined Windows Server using pre-compromised credentials; the article says VPN access was suggested by the context.
  • The attacker ran a bespoke AI-generated PowerShell script to discover the domain controller and enumerate Active Directory users, computers, groups, organizational units, subnets, and trusts.
  • The attacker staged tools in C:\ProgramData\ and later deployed s5cmd.exe and SharpShares.exe; SharpShares was used to search for user-accessible data repositories while filtering out common administrative shares.
  • The enumeration script saved collected data to CSV and text files, created an HTML report, and zipped the output in a local staging directory.
Defensive Notes
  • Prioritize behavioral detection of Active Directory enumeration and operating-system interactions rather than relying only on file hashes or static signatures.
  • The article identifies PowerShell Event ID 4104 in Microsoft-Windows-PowerShell/Operational as telemetry used to recover the script.
  • Monitor for unusual RDP access, tool staging in C:\ProgramData\, Active Directory collection activity, and creation of AD_Reports directories and archives.

MITRE ATT&CK

People

Products

Tools

Related Articles