Skip to content

[New Rules] Three Linux File-Related Web Server Rules - #6742

Merged
Aegrah merged 8 commits into
mainfrom
several-new-linux-web-server-file-rules
Sep 11, 2026
Merged

Aegrah merged 8 commits into
mainfrom
several-new-linux-web-server-file-rules

Conversation

@Aegrah

@Aegrah Aegrah commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrating three new rules that were functioning well in endpoint rules to detection rules, without exclusions.

@Aegrah Aegrah self-assigned this Sep 7, 2026
Copilot AI lite review requested due to automatic review settings September 7, 2026 13:03
@Aegrah Aegrah added OS: Linux Rule: New Proposal for new rule Team: TRADE labels Sep 7, 2026
@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 7, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

Copilot AI left a comment

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.

🟡 Changes recommended

The new rules include query/metadata inconsistencies that can cause incorrect matching or rule execution issues (notably EQL inline comment syntax and scope/description mismatches).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR migrates three Linux Elastic Defend (endpoint) file-event EQL detections focused on web-server-related suspicious file creation patterns into the detection-rules repo.

Changes:

  • Adds a polyglot-bypass detection based on file.Ext.header_bytes vs suspicious extensions.
  • Adds a high-entropy file detection based on file.Ext.entropy for web-server-created files.
  • Adds a suspicious double-extension filename detection for web-server-created files.
File summaries
File Description
rules/linux/persistence_webserver_file_polyglot_bypass.toml New EQL rule for web-server-created files with suspicious extensions and mismatching magic bytes.
rules/linux/persistence_webserver_file_high_entropy.toml New EQL rule for web-server-created high-entropy files with web-executable extensions.
rules/linux/persistence_webserver_file_double_dangerous_extension.toml New EQL rule for web-server-created files with suspicious double extensions.
Review details

Suppressed comments (3)

rules/linux/persistence_webserver_file_polyglot_bypass.toml:129

  • Including "elf" in the monitored extensions makes this "polyglot/mismatch" rule also fire on normal ELF binaries named *.elf (where the extension matches the ELF header), which doesn’t align with the rule description.
  "sh", "elf"

rules/linux/persistence_webserver_file_polyglot_bypass.toml:135

  • The EQL query uses trailing // comments inside the value list; this comment style isn’t used elsewhere in EQL rules here and may cause query parse failures. Consider removing them or converting to a supported block comment style.
file.Ext.header_bytes like (
  "ffd8ff*",                // JPEG / JPG
  "89504e470d0a1a0a*",      // PNG 
  "47494638*",              // GIF (GIF87a / GIF89a)
  "00000100*",              // ICO

rules/linux/persistence_webserver_file_high_entropy.toml:130

  • This rule is described as targeting web-executable extensions, but the extension list also includes generic executable/binary extensions ("sh", "elf", "bin"), which broadens scope beyond what the description says.
  "psgi",
  "lua", "luac",
  "sh", "elf", "bin"
)
  • Files reviewed: 3/3 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rules/linux/persistence_webserver_file_high_entropy.toml Outdated
Comment thread rules/linux/persistence_webserver_file_high_entropy.toml
Comment thread rules/linux/persistence_webserver_file_polyglot_bypass.toml Outdated
Comment thread rules/linux/persistence_webserver_file_polyglot_bypass.toml
Aegrah and others added 4 commits September 7, 2026 15:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…py.toml

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 7, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 7, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 7, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 7, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 7, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@bryans3c bryans3c left a comment

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.

LGTM!

@eric-forte-elastic eric-forte-elastic left a comment

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.

Looks good to me too 👍

@elastic-vault-github-plugin-prod

elastic-vault-github-plugin-prod Bot commented Sep 11, 2026

Copy link
Copy Markdown

⛔️ Test failed

Results
  • ❌ File with Suspicious Double Extension Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ Potential Polyglot Bypass File Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta
  • ❌ File with High Entropy Created by Web Server (eql)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@Aegrah
Aegrah merged commit 59659a3 into main Sep 11, 2026
13 checks passed
@Aegrah
Aegrah deleted the several-new-linux-web-server-file-rules branch September 11, 2026 08:31
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.

4 participants