Skip to content

Siemphony is in beta and still being built. How a rule earns its badge.

Siemphony’s repertoire

PowerShell console history cleared

Siemphony@siemphonylowT1070.003unverified
AN0469 asks for `Clear-History` invocation or removal of the PSReadLine `ConsoleHost_history.txt` file, and script block logging is the only feed in the brief that carries both on one event, so the rule reads the text of the script block itself. Two shapes are matched: the `Clear-History` cmdlet, and any script block naming `ConsoleHost_history.txt`, which is how the `Remove-Item`, `Clear-Content` and redirect-to-null variants all surface, since the literal filename has to appear whichever verb is used. Limits worth knowing before this is deployed: EventID 4104 requires *Turn on PowerShell Script Block Logging*, which is off in a default install and in the MS and CIS baselines, so zero rows here means blind rather than quiet; `Clear-History` empties only the in-session buffer and never the PSReadLine file, so the two selections are not equivalent; the idiomatic `Remove-Item (Get-PSReadLineOption).HistorySavePath` never spells the filename and is therefore not seen; and the same file deleted from Explorer, from `cmd.exe` with `del`, or by any non-PowerShell process produces nothing on this feed — the brief's Sysmon EventID 23 and Security 4663 legs would be needed for that, and they carry different field names (`TargetFilename`, `ObjectName`) that this rule is not written in. Pre-emptively suppressing the history file with `Set-PSReadLineOption -HistorySaveStyle SaveNothing` is deliberately out of scope: that observable belongs to T1690, Prevent Command History Logging, whose own brief claims it, and a match on it under this technique's tag would mislabel the event. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0165, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full description

The detection

The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.

detection.yml

Sentinel · KQL

Run this as a search.

Event| where (EventID == 4104 and (ScriptBlockText contains "Clear-History" or ScriptBlockText contains "ConsoleHost_history.txt"))

Splunk · SPL

Run this as a search.

index=* (EventID="4104" AND (ScriptBlockText="*Clear-History*" OR ScriptBlockText="*ConsoleHost_history.txt*"))

Elastic · ES|QL

Run this as a search.

FROM logs-*| WHERE (event.code == 4104 AND (TO_LOWER(powershell.file.script_block_text) LIKE "*clear-history*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*consolehost_history.txt*"))

Wazuh · XML rule

Deploy to your manager — this is a rule, not a search.

<group name="sigma,windows,">  <!-- Rule ids must be unique on your manager; 100000+ is the user range. -->  <rule id="100000" level="5">    <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. -->    <field name="EventID" type="pcre2">(?i)^4104$</field>    <field name="ScriptBlockText" type="pcre2">(?i)(Clear-History|ConsoleHost_history\.txt)</field>    <description>PowerShell console history cleared</description>    <mitre>      <id>T1070.003</id>    </mitre>  </rule></group>

Verdicts · reactions · comments

Community

Verdicts from engineers who actually deployed it, and the conversation around it.

Log in to react
Not yet reported on

Nobody has run this in a real environment and said what happened.

Verdicts from engineers who deployed it

0 cast

No verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.

Log in to report a verdict.

Log in to join the discussion.

No comments yet. Someone who deploys this will have something to say about it.