Klinchin builds his case around an intrusion investigated earlier in 2026 by Huntress, where an attacker walked into an environment with stolen credentials, pivoted over Remote Desktop Protocol (RDP), and ran a bespoke, AI-assisted PowerShell script to map Active Directory. The artificial intelligence angle grabbed headlines, as it tends to do in 2026. Yet strip away the shiny LLM wrapper, and what remains is an uncomfortable truth for Windows administrators: the script didn't invent a new vulnerability. It simply exploited legitimate tools backed by overly broad, always-on permissions.
Inside the Huntress Case: Old Tradecraft, New Script Factory
To appreciate why the commentary hits a nerve, it helps to look directly at the primary Huntress investigation published on July 8, 2026 by researchers Jevon Ang and Dray Agha. In an incident dating to June 3, 2026, Huntress recovered a "vibe-coded" PowerShell script—complete with a header labeling it 100% Working AD Information Gathering Script - FULLY FIXED—that an operator had generated through iterative AI prompting. Once inside via an RDP pivot, the script hunted for the Domain Controller, mapped domains, users, and computers, exported collected data into a newly created directory, and even compiled a tidy AD_Report.html summary before fast exfiltration.
Huntress's July 2026 Adversary Tactics review put the incident in blunt perspective: AI is turning mediocre operators into one-off "script factories," allowing them to dodge static, signature-based detections aimed at well-known offensive kits like BloodHound or PowerSploit. Crucially, however, AI did not rewrite the attack lifecycle. The intruder already possessed valid credentials and remote access, and the script relied on noisy, textbook Active Directory enumeration.
- Initial foothold: Compromised credentials used to establish an interactive RDP session.
- Execution method: A disposable, LLM-assisted PowerShell script performing standard directory queries (
Get-WmiObject, DNS lookups, and AD object mapping). - Defensive reality: Changing the syntax of a script does not disguise the underlying behavior of enumerating an entire domain and staging data for exfiltration.
Section takeaway: The AI-generated script was a symptom, not the cause. Even the cleverest prompt engineering cannot conjure domain-wide visibility out of thin air unless the compromised account already has the reach to ask for it.
Why "Just Block PowerShell" Is a Non-Starter
Whenever PowerShell shows up in an incident report, someone inevitably asks why organizations don't just disable it across the fleet. As MITRE ATT&CK documents under sub-technique T1059.001 (Command and Scripting Interpreter: PowerShell), adversaries abuse it for everything from system discovery to fileless in-memory execution precisely because it is built into Windows. It is the textbook "living off the land" utility.
Yet for Windows IT teams, nuking PowerShell is neither realistic nor effective:
- Operational dependency: Server provisioning, Active Directory administration, routine maintenance, and cloud automation all lean heavily on PowerShell. Blocking it outright breaks day-to-day administration and pushes busy sysadmins toward risky workarounds.
- The
.NETbypass reality: MITRE ATT&CK notes that attackers don't even need to launchpowershell.exedirectly; they can invoke PowerShell's underlyingSystem.Management.Automationassembly DLL via the.NET framework and Windows Common Language Interface. Blocking the binary gives defenders false comfort while leaving the engine accessible. - Legitimate credentials hide malicious intent: When commands run under an authentic administrator account, monitoring alone struggles to tell routine housekeeping apart from pre-ransomware reconnaissance.
Section takeaway: Treating PowerShell as malware creates operational chaos without closing the underlying execution path. Security has to govern who gets to wield that power and for how long.
Standing Privilege vs. Just-in-Time Access—and Checking the Vendor Angle
In his SecurityBrief commentary, Klinchin draws a sharp line between the scripting tool and the authority attached to the identity running it. In a conventional Windows shop, an administrator signs in with a permanently elevated account—or pulls out a shared privileged password—that carries sweeping rights across servers and stays active long after a 15-minute maintenance window closes. If an attacker steals that credential, they inherit every machine and directory object it can touch.
To break that pattern, Klinchin advocates three core shifts: separating an administrator's daily user account from privileged credentials, enforcing multifactor authentication (MFA) before granting an authorized session without exposing the underlying password, and replacing permanent rights with just-in-time (JIT) access that expires automatically. As an illustrative example, an admin who needs elevated access to a single server for 30 minutes should receive scoped access to that host for that window—not perpetual Domain Admin or local Administrator rights across the network.
Here is where an objective editorial check is essential: Klinchin is co-founder of 12Port, a privileged access management (PAM) vendor, and his commentary pitches agentless PAM as a frictionless way to wrap controls around PowerShell, RDP, and SSH without deploying software to every endpoint. Agentless architectures certainly appeal to teams tired of managing yet another endpoint agent, and the commentary provides no comparative benchmark or product-level proof—so it should be evaluated as one architectural option rather than a universal cure-all.
More importantly, JIT and PAM reduce the blast radius of a compromised credential; they do not make accounts invincible, a limitation Klinchin himself acknowledges. If an attacker compromises an active elevated session, exploits an unpatched local privilege escalation bug, or breaches the PAM broker itself, standing-privilege hygiene alone won't save the day.
How Microsoft's Native Stack Compares
Windows and Microsoft 365 administrators don't necessarily have to start from scratch with third-party tooling to tackle standing privilege. Microsoft documents several native layers that complement—or compete with—dedicated PAM platforms:
| Control Layer | Primary Scope | How It Limits PowerShell / Admin Risk | Key Caveat Verified in Microsoft Docs |
|---|---|---|---|
| Just Enough Administration (JEA) | Windows PowerShell endpoints (Server 2016+ / Windows 10 1607+ preinstalled) | Uses virtual accounts or gMSAs to let non-admins run only allowlisted cmdlets and parameters. | Does not protect against users who already belong to Domain Admins or local Administrators. |
| Microsoft Entra PIM | Microsoft Entra ID & Azure RBAC roles | Converts permanent roles into "eligible" roles activated JIT with MFA, justification, approval, and auto-expiration. | Requires Microsoft Entra ID P2 (or equivalent) licensing; governs cloud/hybrid RBAC rather than on-prem local admin passwords alone. |
| Microsoft Purview PAM | Microsoft 365 administrative tasks | Enforces scoped, time-bound, approval-gated elevation at the individual task level. | Designed specifically to layer with Entra PIM for M365 workloads rather than raw Windows Server RDP sessions. |
| Agentless PAM (Vendor Model) | Cross-platform sessions (PowerShell, RDP, SSH) | Proxies/authorizes existing admin workflows without installing agents on target endpoints. | Introduces a critical control-plane dependency that must itself be hardened and audited. |
Look closely at Microsoft's own security warning on Just Enough Administration (JEA): JEA is brilliant for scenarios like letting a DNS administrator restart the DNS service or clear a poisoned cache on a Domain Controller without making them a Domain Admin. However, Microsoft explicitly cautions that JEA cannot constrain someone who already holds Domain Admin or local Administrator membership, because those accounts can simply open an RDP session, launch MMC, connect to unconstrained PowerShell, or rewrite the JEA configuration itself. That is precisely why Microsoft's JEA documentation recommends pairing JEA for routine tasks with a JIT privileged access management system for full-admin elevation.
Section takeaway: Whether you choose native Microsoft Entra PIM, JEA, or an agentless PAM broker, the goal is identical: ensure no routine credential carries permanent keys to the kingdom.
Logging PowerShell Properly—Without Creating a New Leak
Reducing standing privilege does not eliminate the need to see what happens inside a session. In the Huntress case, Klinchin notes that PowerShell Script Block Logging helped investigators reconstruct the attacker's commands after the fact. Yet turning logging on without understanding its nuances—and its security pitfalls—can either blind your SOC or hand attackers fresh secrets.
Microsoft's official documentation draws important distinctions across Windows PowerShell 5.1 and modern PowerShell 7 deployments:
- Know where Event ID 4104 lives: When Script Block Logging is enabled, PowerShell records the full content of executed commands, script blocks, functions, and scripts under Event ID 4104. On Windows PowerShell 5.1, those events land in
Microsoft-Windows-PowerShell/Operational. On PowerShell 7, they write toPowerShellCore/Operational—and unlike macOS or Linux, Windows requires registering the PowerShell 7 event provider before events can be logged. - Use Policy or Registry enforcement consistently: In Group Policy, navigate to
Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell > Turn on PowerShell Script Block Logging(Computer settings take precedence over User settings). Under the hood, this writesEnableScriptBlockLoggingtoHKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging. Think carefully before enabling Script Block Invocation Logging (start/stop tracking), as Microsoft warns it generates high event volumes. - Encrypt sensitive logs with Protected Event Logging: Microsoft explicitly cautions that deep script logging can write passwords, tokens, or sensitive variables into local event logs in plaintext—giving an intruder on a compromised endpoint a roadmap for lateral movement. For anything beyond short-term diagnostics, Microsoft recommends enabling Protected Event Logging (
Administrative Templates > Windows Components > Event Logging > Enable Protected Event Logging). Protected Event Logging uses the IETF Cryptographic Message Syntax (CMS) standard: endpoints encrypt log entries with a deployed X.509 public key, while the private decryption key stays isolated on a hardened central log collector or SIEM. - Correlate telemetry, don't hoard it: MITRE ATT&CK detection strategy DET0455 (analytic AN1252) emphasizes chaining PowerShell events (
4103,4104,4105,4106, plus engine metadata400and403) with Sysmon process creation (EventCode=1) and module loads (EventCode=7). Watching for encoded flags (-enc,-nop), unusual parent processes likeWinWordormshtaspawning PowerShell, or unexpected network connections helps catch abuse regardless of whether a script was hand-typed or "vibe-coded."
Finally, take Klinchin's concluding operational point to heart: raw command logs are twice as valuable when tied to access governance. When an alert fires on Event ID 4104, incident responders shouldn't have to guess why that script ran—they should be able to trace it straight back to who authenticated via MFA, which ticket or approval unlocked the session, which target server was scoped, and when that temporary privilege expired.
Practical Checklist for Windows Administrators
If you want to act on this lesson before an AI-written recon script lands on your domain controller, start with five concrete steps:
- Audit standing privilege first: Identify every account with permanent local Administrator, Domain Admin, or Entra ID privileged roles, and eliminate shared admin passwords where named authentication can replace them.
- Scope elevation by system and time: Move routine server maintenance onto JEA endpoints where feasible, and enforce time-bound, MFA-gated JIT elevation for full administrative tasks.
- Verify Script Block Logging across both PowerShell editions: Confirm Event ID 4104 collection is active for both
Microsoft-Windows-PowerShell/Operationaland PowerShell 7'sPowerShellCore/Operational. - Turn on Protected Event Logging: Deploy a CMS encryption certificate via Group Policy so sensitive script-block payloads cannot be harvested locally from compromised hosts.
- Link SIEM alerts to identity approvals: Correlate PowerShell telemetry and RDP logons with PIM or PAM elevation records so unusual activity immediately stands out from approved maintenance.
PowerShell isn't going anywhere—and frankly, Windows administration would grind to a halt without it. The smartest move isn't declawing your best administrative tool; it's ensuring that when an attacker inevitably comes knocking with a stolen password, there isn't a pile of permanent privilege waiting behind the door.
Correction (November 24, 2026): The article originally described the recovered script's header as "AD Information Gathering Script v3.0". Huntress's report gives the script's title as "100% Working AD Information Gathering Script - FULLY FIXED".
References
- PowerShell Isn't the Security Problem. Standing Privilege Is - SecurityBrief Asia SecurityBrief Asia · 2026-11-24T16:00:00+00:00
- PowerShell Isn't the Security Problem. Standing Privilege Is - SecurityBrief New Zealand SecurityBrief New Zealand · 2026-11-24T16:00:00+00:00
- PowerShell Isn't the Security Problem. Standing Privilege Is securitybrief.co.uk