[Osquery_manager] Powershell history artifact saved query #16079
+139
−6
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.
PowerShell History Artifact
The PowerShell History artifact provides comprehensive forensic visibility into PowerShell execution activity by capturing module logging (Event ID 4103), script block logging (Event ID 4104), and process creation with command line auditing (Event ID 4688). This multi-layered approach enables detection of obfuscated commands, full script execution analysis, and parent/child process relationship tracking for fileless malware investigations.
Core Forensic Artifacts Coverage
Queries by Platform
🪟 Windows - PowerShell Execution & Fileless Malware Detection
Description
Comprehensive PowerShell forensic monitoring query that captures three critical event types from Windows Event Logs to detect suspicious PowerShell activity and fileless malware execution. The query correlates module logging (Event ID 4103) for obfuscated command detection, script block logging (Event ID 4104) for full script content analysis, and process creation events (Event ID 4688) for command line auditing and process relationship tracking. This multi-layered approach provides complete visibility into PowerShell-based attacks aligned with MITRE ATT&CK technique T1059.001.
Detection Focus:
Result
Query results provide three distinct data sets:
This comprehensive approach enables security analysts to reconstruct complete PowerShell attack chains, from initial execution to payload delivery.
Platform
windowsInterval
300seconds (5 minutes)Query ID
powershell_history_windows_elasticECS Field Mappings
event.created→datetimeevent.code→eventidevent.provider→provider_namelog.level→levelhost.name→computer_nameprocess.pid→pidprocess.thread.id→tidevent.action→taskpowershell.provider.name→ProviderNamepowershell.context_info→ContextInfopowershell.payload→Payloadpowershell.file.script_block_id→ScriptBlockIdpowershell.file.script_block_text→ScriptBlockTextfile.path→ScriptPathprocess.command_line→CommandLineprocess.name→ProcessNameprocess.parent.name→ParentProcessNameSQL Query
This PR was AI assisted by Claude Code