-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
EzLucky
wants to merge
2
commits into
SigmaHQ:master
Choose a base branch
from
EzLucky:powershell_console_history
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+59
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
rules/windows/file/file_access/file_access_win_powershell_console_history_file_access.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
title: PowerShell Console History File Access | ||
id: 4d052abb-0bee-44f3-9aa0-8dab6b1bd349 | ||
related: | ||
- id: f4ff7323-b5fc-4323-8b52-6b9408e15788 | ||
type: derived | ||
status: experimental | ||
description: Detects access to the PowerShell console history file (ConsoleHost_history.txt), possibly to retrieve plaintext passwords used in PowerShell commands. | ||
references: | ||
- https://0xdf.gitlab.io/2018/11/08/powershell-history-file.html | ||
author: Luc Génaux | ||
date: 2025-04-03 | ||
tags: | ||
- attack.credential-access | ||
- attack.t1552.001 | ||
logsource: | ||
product: windows | ||
category: file_access | ||
definition: 'Requirements: Microsoft-Windows-Kernel-File ETW provider' | ||
detection: | ||
selection: | ||
FileName|endswith: 'PSReadLine\ConsoleHost_history.txt' | ||
filter: | ||
Image|endswith: | ||
- '\notepad.exe' | ||
- '\notepad++.exe' | ||
condition: selection and not filter | ||
falsepositives: | ||
- Curious user opening it's own history file | ||
level: medium |
30 changes: 30 additions & 0 deletions
30
rules/windows/process_creation/proc_creation_win_powershell_console_history_file_access.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
title: Possible PowerShell Console History File Access Attempt | ||
id: f4ff7323-b5fc-4323-8b52-6b9408e15788 | ||
related: | ||
- id: 4d052abb-0bee-44f3-9aa0-8dab6b1bd349 | ||
type: derived | ||
status: experimental | ||
description: Detects possible access attempts to the PowerShell console history file (ConsoleHost_history.txt) in order to retrieve plaintext passwords used in PowerShell commands. | ||
references: | ||
- https://0xdf.gitlab.io/2018/11/08/powershell-history-file.html | ||
author: Luc Génaux | ||
date: 2025-04-03 | ||
tags: | ||
- attack.credential-access | ||
- attack.t1552.001 | ||
logsource: | ||
category: process_creation | ||
product: windows | ||
detection: | ||
selection: | ||
CommandLine|contains: | ||
- 'ConsoleHost_history.txt' | ||
- '(Get-PSReadlineOption).HistorySavePath' | ||
filter: | ||
Image|endswith: | ||
- '\notepad.exe' | ||
- '\notepad++.exe' | ||
Comment on lines
+23
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
condition: selection and not filter | ||
falsepositives: | ||
- Curious user opening it's own history file | ||
level: medium |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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