[Enhancement] Windows: Add scheduled task parsing support#19193
Open
w0rk3r wants to merge 4 commits into
Open
Conversation
Contributor
✅ Vale Linting ResultsNo issues found on modified lines! The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale. |
🚀 Benchmarks reportTo see the full report comment with |
💚 Build Succeeded
History
cc @w0rk3r |
|
Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed commit message
Summary
Related issue: github.com/elastic/ia-trade-team/issues/892
Windows Security scheduled task events expose high-value task definition metadata primarily as raw XML in
winlog.event_data.TaskContentandwinlog.event_data.TaskContentNew. This makes scheduled-task detection and tuning rely too heavily onTaskName, which is attacker-controlled and easy to masquerade.This PR parses selected scheduled task XML fields into
winlog.scheduled_task.*for Security scheduled task events in the System and Windows forwarded integrations.Why
Windows scheduled tasks are a common mechanism for persistence, remote execution, privilege abuse, and ransomware deployment. Security events already capture useful scheduled task metadata, but most of the task definition is stored as raw XML in
winlog.event_data.TaskContentandwinlog.event_data.TaskContentNew, withTaskNamebeing the only readily queryable field today.That XML contains the behavioral details needed to understand the task: what it runs, when it runs, which account it uses, and whether it is configured in suspicious ways such as hidden execution or elevated run level. Today, those details are not available as structured fields for search, visualization, tuning, or reliable detection logic.
As a result, some detections have to rely on
TaskName, which is attacker-controlled and easy to make look benign. This weakens detection quality and can make detections bypassable.This PR extracts scheduled task metadata into structured
winlog.scheduled_task.*fields. That makes scheduled task activity easier to investigate and enables more durable detections based on what the task actually does, not just what it is called.What changed
This PR adds scheduled task XML parsing for Windows Security events in both the System
securitydata stream and the Windowsforwardeddata stream.The new parsing extracts selected task definition metadata from
TaskContentandTaskContentNewintowinlog.scheduled_task.*, including:The pipeline handles scheduled task creation, update, enable, disable, and delete events. Delete events do not contain task XML, so they continue to populate the scheduled task name from
TaskNameonly.Performance
A dedicated
system/securitypipeline benchmark was added for the scheduled task parsing path. The benchmark uses Security scheduled task events where every document triggers the new XML parser, so it represents the expected worst-case ingest cost for this change.Warm-run results from the same local environment:
This is a worst-case benchmark because every event in the fixture set is a scheduled task event with task XML. In normal Security event streams, the impact should scale with the proportion of events that are scheduled task events carrying
TaskContentorTaskContentNew.Checklist
changelog.ymlfile.How to test this PR locally
Run the System security pipeline tests:
Run the Windows forwarded pipeline tests:
Run the dedicated pipeline benchmark for the scheduled task parsing path:
cd packages/system elastic-package stack up -d --services=elasticsearch elastic-package benchmark pipeline --data-streams security --use-test-samples=false elastic-package stack downScreenshots