PowerShell Logging Not Enabled
PowerShell script block, module and transcription logging are not enabled, so PowerShell activity leaves little record for detection or investigation.
| Severity | Low |
| CVSS 3.1 | 3.3 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N Open in the calculator |
| CVSS 4.0 | 4.8 CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-778: Insufficient Logging |
| OWASP Top 10 | A09:2025 Security Logging and Alerting Failures |
| MITRE ATT&CK | T1059.001 PowerShell |
| Category | Insufficient Logging |
Description
Windows PowerShell and PowerShell 7 can record the code they run, but this logging is not enabled through policy, so only limited detail of PowerShell activity is recorded. The settings concerned are Turn on PowerShell Script Block Logging, which records the content of scripts and commands as they run (event 4104 in the Microsoft-Windows-PowerShell/Operational log); Turn on Module Logging, which records pipeline execution details (event 4103); and Turn on PowerShell Transcription, which writes a text record of each session to a chosen folder. Without script block logging enabled, only script blocks that PowerShell itself judges suspicious are logged.
An attacker who runs PowerShell on the host, which is common in both commodity malware and targeted intrusions, therefore leaves little record of what was run, so the activity is less likely to be detected, and an investigation may be unable to establish what was done, which data was accessed or which other systems were contacted. Related weaknesses are an operational log too small to hold more than a short period of activity, logs kept only on the host where an attacker can clear them, and PowerShell 7 installed without its separate policy settings. The weakness gives an attacker no access in itself; it reduces the organisation's ability to detect and respond to an intrusion that has already begun.
The weakness is identified by reviewing the values under HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell or the resultant Group Policy, and by running a test command and checking which events are recorded.
Remediation
Enable PowerShell logging through Group Policy under Computer Configuration\Policies\Administrative Templates\Windows Components\Windows PowerShell, or the equivalent Intune settings:
- Turn on PowerShell Script Block Logging: Enabled.
- Turn on Module Logging: Enabled, with
*as the list of module names. - Turn on PowerShell Transcription: Enabled, writing to a protected folder or network share that users can add to but not read or alter.
- For PowerShell 7, install its policy templates and enable the matching settings, or select the option in those templates to follow the Windows PowerShell policy.
Increase the maximum size of the Microsoft-Windows-PowerShell/Operational log, forward the events to a central log platform or SIEM, and build detections for suspicious content. Logged script blocks can contain secrets, so restrict access to the logs and consider Protected Event Logging. Confirm the fix by running a test command and checking that event 4104 records its content, both on the host and in the central platform.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.