Skip to content

New Rules : PowerShell Console History File Access - file_access + proc_creation #5253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

EzLucky
Copy link
Contributor

@EzLucky EzLucky commented Apr 4, 2025

Summary of the Pull Request

Adds two new rules concerning access to the PowerShell console history file.

A red team has been seen using this technique with the following command cmd.exe /q /c powershell.exe "type C:\Users\*\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt" > output_file in order to try to retrieve plaintext passwords that may have been used in PowerShell commands.

Changelog

new: PowerShell Console History File Access - file_access
new: Possible PowerShell Console History File Access Attempt - proc_creation

Example Log Event

Fixed Issues

SigmaHQ Rule Creation Conventions

  • If your PR adds new rules, please consider following and applying these conventions

@github-actions github-actions bot added Rules Windows Pull request add/update windows related rules labels Apr 4, 2025
definition: 'Requirements: Microsoft-Windows-Kernel-File ETW provider'
detection:
selection:
FileName|endswith: 'PSReadLine\ConsoleHost_history.txt'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Powershell, AV, Windows itself and many other processes will request access to this file.

The filters have to be more strict or the rule will generate a lot of FPs

Comment on lines +23 to +26
filter:
Image|endswith:
- '\notepad.exe'
- '\notepad++.exe'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the rule is looking for access attempt, why exclude notepad? Its the easiest way to access that file for an attacker.

I know the aim is to reduce FP from admin. But that should be left to the rule user as it is env specific.

@nasbench nasbench added Work In Progress Some changes are needed Author Input Required changes the require information from original author of the rules labels Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author Input Required changes the require information from original author of the rules Rules Windows Pull request add/update windows related rules Work In Progress Some changes are needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants