豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

[New Rules] False Negatives for New BPFDoor Variants#5939

Open
Aegrah wants to merge 5 commits intomainfrom
bpf-door-fn-permission-change
Open

[New Rules] False Negatives for New BPFDoor Variants#5939
Aegrah wants to merge 5 commits intomainfrom
bpf-door-fn-permission-change

Conversation

@Aegrah
Copy link
Copy Markdown
Contributor

@Aegrah Aegrah commented Apr 9, 2026

Summary

Adding coverage for BPFDoor false negatives as per detonations and references in:

The rules were checked across telemetry and are performing well, especially when accounting for the additional noise reduction via the new_terms rule type.

Shell History Clearing via Environment Variables

This rule detects the clearing of the shell history via environment variables. Attackers may clear the shell history to hide their activities from being tracked. By leveraging environment variables such as HISTSIZE, HISTFILESIZE, HISTCONTROL, and HISTFILE, attackers can clear the shell history by setting them to 0, ignoring spaces, or redirecting the history to /dev/null, effectively erasing the command history.

{B26B9FA6-409F-4695-A6EF-CC8A60545A7B}

File Creation in World-Writable Directory by Unusual Process

This rule detects the creation of files in world-writable directories by an unusual process. Attackers may attempt to hide their activities by creating files in world-writable directories, which are commonly used for temporary file storage. This behavior is often associated with lateral movement and can be an indicator of an attacker attempting to move laterally within a network.

1k+ TPs in detonate last 90d, and limited FPs in telemetry:

{B94498A5-74E6-4EFE-8192-983ED152E0DC}

@Aegrah Aegrah self-assigned this Apr 9, 2026
@Aegrah Aegrah added OS: Linux Rule: New Proposal for new rule Team: TRADE labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Rule: New - Guidelines

These guidelines serve as a reminder set of considerations when proposing a new rule.

Documentation and Context

  • Detailed description of the rule.
  • List any new fields required in ECS/data sources.
  • Link related issues or PRs.
  • Include references.

Rule Metadata Checks

  • creation_date matches the date of creation PR initially 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, considering performance for diverse environments. Non ecs fields should be added to non-ecs-schema.json if not available in an integration.
  • min_stack_comments and min_stack_version should be included if the rule is only compatible starting from a specific stack version.
  • index pattern should be neither too specific nor too vague, ensuring it accurately matches the relevant data stream (e.g., use logs-endpoint.process-* for process data).
  • integration should align with the index. If the integration is newly introduced, ensure the manifest, schemas, and new_rule.yaml template are updated.
  • setup should include the necessary steps to configure the integration.
  • note should include any additional information (e.g. Triage and analysis investigation guides, timeline templates).
  • tags should be relevant to the threat and align/added to the EXPECTED_RULE_TAGS in the definitions.py file.
  • threat, techniques, and subtechniques should map to ATT&CK always if possible.

New BBR Rules

  • building_block_type should be included if the rule is a building block and the rule should be located in the rules_building_block folder.
  • bypass_bbr_timing should be included if adding custom lookback timing to the rule.

Testing and Validation

  • Provide evidence of testing and detecting the expected threat.
  • Check for existence of coverage to prevent duplication.

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 9, 2026

⛔️ Test failed

Results
  • ❌ File Creation in World-Writable Directory by Unusual Process (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Shell History Clearing via Environment Variables (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 9, 2026

⛔️ Test failed

Results
  • ❌ File Creation in World-Writable Directory by Unusual Process (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Shell History Clearing via Environment Variables (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 9, 2026

⛔️ Test failed

Results
  • ❌ File Creation in World-Writable Directory by Unusual Process (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Shell History Clearing via Environment Variables (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 9, 2026

⛔️ Test failed

Results
  • ❌ File Creation in World-Writable Directory by Unusual Process (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Shell History Clearing via Environment Variables (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds two new Linux detection rules intended to address observed false negatives in BPFDoor-related activity by expanding coverage for (1) shell history clearing via environment variables and (2) suspicious file creation in shared writable locations using a new_terms approach to reduce noise.

Changes:

  • Added a Linux EQL rule to detect shell history suppression via HIST* environment variables.
  • Added a Linux KQL new_terms rule to detect file creation in shared writable/runtime paths by unusual processes and executables.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
rules/linux/defense_evasion_shell_history_clearing_via_environment_variables.toml New EQL rule for detecting shell history clearing via environment-variable manipulation.
rules/linux/defense_evasion_file_creation_world_writeable_dir_by_unusual_process.toml New KQL new_terms rule for suspicious file creation in shared writable/runtime directories by unusual processes.

query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.env_vars like~ (
"HISTSIZE=0", "HISTFILESIZE=0", "HISTCONTROL=ignorespace", "HISTFILE=/dev/null"
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.

Suggested change
"HISTSIZE=0", "HISTFILESIZE=0", "HISTCONTROL=ignorespace", "HISTFILE=/dev/null"
"HISTSIZE=0", "HISTFILESIZE=0", "HISTCONTROL=ignorespace", "HISTCONTROL=ignoreboth", "HISTFILE=/dev/null"

I think we should add ignoreboth as well.

Ref: https://www.geeksforgeeks.org/linux-unix/histcontrol-command-in-linux-with-examples/

Copy link
Copy Markdown
Contributor Author

@Aegrah Aegrah Apr 20, 2026

Choose a reason for hiding this comment

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

ignoreboth is commonly used, so it might be okay for DR, but for ER its too restrictive (based on telemetry)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants