Skip to content

[Rule Tuning] Windows High-Severity Rules Revamp - 10#6028

Merged
w0rk3r merged 7 commits into
mainfrom
revamp_9
May 6, 2026
Merged

[Rule Tuning] Windows High-Severity Rules Revamp - 10#6028
w0rk3r merged 7 commits into
mainfrom
revamp_9

Conversation

@w0rk3r

@w0rk3r w0rk3r commented May 1, 2026

Copy link
Copy Markdown
Contributor

Issues

Part of https://github.com/elastic/ia-trade-team/issues/619
Part of https://github.com/elastic/ia-trade-team/issues/844
Part of https://github.com/elastic/ia-trade-team/issues/205
Part of https://github.com/elastic/ia-trade-team/issues/636

Summary

This PR fixes/improves our Windows rules by:

  • Improving our investigation guides to be question-driven and actionable, with clear pivots and specific information vs our old checklists
  • Adding Investigate Timeline plugins to help analysts quickly pivot into related alerts, authentication events, file activity, child processes, network activity, directory-service changes, and follow-on Windows Security events
  • Adding setup guides
  • Adding Highlighted fields
  • Fixing/Improving metadata where needed (Description, Mitre tags, references)
  • Improving the order of the fields, so the most relevant information (Name, description, query) are visible without scrolling down too much
  • Tunings where needed (Expand logic, exclude FPs, etc.)

Screenshots / Sample

Highlighted Fields:
image

Investigation Guides: Investigate Plugin

image image

Clicking the investigation plugins launches Timeline with field values populated dynamically from alert fields.

image image

@w0rk3r w0rk3r self-assigned this May 1, 2026
@w0rk3r w0rk3r added Rule: Tuning tweaking or tuning an existing rule OS: Windows windows related rules Domain: Endpoint backport: auto labels May 1, 2026
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Rule: Tuning - Guidelines

These guidelines serve as a reminder set of considerations when tuning an existing rule.

Documentation and Context

  • Detailed description of the suggested changes.
  • Provide example JSON data or screenshots.
  • Provide evidence of reducing benign events mistakenly identified as threats (False Positives).
  • Provide evidence of enhancing detection of true threats that were previously missed (False Negatives).
  • Provide evidence of optimizing resource consumption and execution time of detection rules (Performance).
  • Provide evidence of specific environment factors influencing customized rule tuning (Contextual Tuning).
  • Provide evidence of improvements made by modifying sensitivity by changing alert triggering thresholds (Threshold Adjustments).
  • Provide evidence of refining rules to better detect deviations from typical behavior (Behavioral Tuning).
  • Provide evidence of improvements of adjusting rules based on time-based patterns (Temporal Tuning).
  • Provide reasoning of adjusting priority or severity levels of alerts (Severity Tuning).
  • Provide evidence of improving quality integrity of our data used by detection rules (Data Quality).
  • Ensure the tuning includes necessary updates to the release documentation and versioning.

Rule Metadata Checks

  • updated_date matches the date of tuning PR merged.
  • min_stack_version should support the widest stack versions.
  • name and description should be descriptive and not include typos.
  • query should be inclusive, not overly exclusive. Review to ensure the original intent of the rule is maintained.

Testing and Validation

  • Validate that the tuned rule's performance is satisfactory and does not negatively impact the stack.
  • Ensure that the tuned rule has a low false positive rate.

@tradebot-elastic

tradebot-elastic commented May 1, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

Comment on lines -115 to -123
"ipinfo.io",
"geoplugin.net",
"myip.dnsomatic.com",
"www.geoplugin.net",
"api64.ipify.org",
"ip4.seeip.org",
"*.geojs.io",
"*portmap.io",
"api.2ip.ua",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Duplicates


(
(process.executable : ("?:\\Users\\*\\AppData\\*\\node.exe", "\\Device\\HarddiskVolume?\\\\Users\\*\\AppData\\*\\node.exe") and process.args : "*.js") or
(process.executable : ("?:\\Users\\*\\AppData\\*\\node.exe", "\\Device\\HarddiskVolume*\\Users\\*\\AppData\\*\\node.exe") and process.args : "*.js") or

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

\\Device\\HarddiskVolume?\\\\ would never trigger

Comment on lines +42 to +59
| keep kibana.alert.rule.name, Esql.script_block_id, _id, user.id, process.pid, host.id

// count distinct alerts and filter for matches above the threshold
| stats
Esql.kibana_alert_rule_name_count_distinct = count_distinct(kibana.alert.rule.name),
Esql.kibana_alert_rule_name_values = values(kibana.alert.rule.name),
Esql._id_values = values(_id)
Esql._id_values = values(_id),
Esql.user_id_values = values(user.id),
Esql.process_pid_values = values(process.pid),
Esql.host_id_values = values(host.id)
by Esql.script_block_id

// Apply detection threshold
| where Esql.kibana_alert_rule_name_count_distinct >= 5
| eval user.id = MV_MIN(Esql.user_id_values),
process.pid = MV_MIN(Esql.process_pid_values),
host.id = MV_MIN(Esql.host_id_values)
| keep host.id, user.id, process.pid, Esql.*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adds some fields that will be used to help investigation/pivots

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

user.id --> Esql.user_id_values --> user.id 🥇

Comment on lines +40 to +48
not dll.code_signature.status : ("errorExpired", "errorRevoked", "errorCode_endpoint:*") and

/* HP DOT4 printer driver family FPs (Dot4.sys, Dot4Prt.sys, Dot4usb.sys, Dot4Scan.sys) */
not dll.hash.sha256 : (
"f21c1d478180bc5e932bb2c2e4618e3ed463ca87acedeb139682d218435f82f1",
"7e2f2a139e897eae56038b920bda9381094bc0ae9e626f6634e6b444b8b0c91f",
"12ffdf5f48a79b1b4adbb88ba2cb6c59dd6719554e8ea6beefe99b3e3c66f1ac",
"dbc6afaf80141e2480e19878f581edfe9c2b018da2ec527c4025ff04d5587afd"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@tradebot-elastic

tradebot-elastic commented May 3, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta


- What resident service or device identity is tied to the loaded image?
- Focus: compare `dll.path`, `dll.hash.sha256`, and `dll.code_signature.subject_name` with current Osquery driver inventory and service output.
- Hint: Run `$osquery_0` for non-Microsoft drivers by `image`, `service`, `signed`, `subject_name`, and `VtLink`; use it as current-state context, and keep the alert as the historical load record if no matching image exists.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How does this look with osquery investigation + investigations supplied in the docs? Was this tested/validated to look clean?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

image

It seems that they differ from the investigatye ones, need their own line. Fixed, and thanks for checking

Comment thread rules/windows/defense_evasion_untrusted_driver_loaded.toml Outdated
Comment on lines +42 to +59
| keep kibana.alert.rule.name, Esql.script_block_id, _id, user.id, process.pid, host.id

// count distinct alerts and filter for matches above the threshold
| stats
Esql.kibana_alert_rule_name_count_distinct = count_distinct(kibana.alert.rule.name),
Esql.kibana_alert_rule_name_values = values(kibana.alert.rule.name),
Esql._id_values = values(_id)
Esql._id_values = values(_id),
Esql.user_id_values = values(user.id),
Esql.process_pid_values = values(process.pid),
Esql.host_id_values = values(host.id)
by Esql.script_block_id

// Apply detection threshold
| where Esql.kibana_alert_rule_name_count_distinct >= 5
| eval user.id = MV_MIN(Esql.user_id_values),
process.pid = MV_MIN(Esql.process_pid_values),
host.id = MV_MIN(Esql.host_id_values)
| keep host.id, user.id, process.pid, Esql.*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

user.id --> Esql.user_id_values --> user.id 🥇

Comment thread rules/windows/execution_posh_malicious_script_agg.toml Outdated
@tradebot-elastic

tradebot-elastic commented May 4, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic

tradebot-elastic commented May 4, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

Comment thread rules/windows/execution_posh_malicious_script_agg.toml Outdated
@tradebot-elastic

tradebot-elastic commented May 4, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic

tradebot-elastic commented May 4, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic

tradebot-elastic commented May 6, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ✅ Execution of File Written or Modified by Microsoft Office (eql)
  • ❌ Potential PowerShell HackTool Script by Author (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Foxmail Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Suspicious Execution with NodeJS (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ System Public IP Discovery via DNS Query (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Notepad Markdown RCE Exploitation (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ WPS Office Exploitation via DLL Hijack (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Untrusted Driver Loaded (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Unusual Execution via Microsoft Common Console File (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Malicious PowerShell Based on Alert Correlation (esql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@w0rk3r w0rk3r merged commit 2df45b2 into main May 6, 2026
13 checks passed
@w0rk3r w0rk3r deleted the revamp_9 branch May 6, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport: auto Domain: Endpoint OS: Windows windows related rules Rule: Tuning tweaking or tuning an existing rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants