BPF Program or Map Load via bpftool

Detects execution of bpftool commands used to load, attach, run, or pin eBPF programs, as well as create or update eBPF maps and links. These operations interact directly with the Linux eBPF subsystem and can modify kernel-level behavior. While commonly used by legitimate networking or observability tooling, unexpected or interactive usage may indicate eBPF-based rootkit activity, policy tampering, or unauthorized kernel instrumentation.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/02/20"
  3integration = ["endpoint", "auditd_manager", "sentinel_one_cloud_funnel", "crowdstrike"]
  4maturity = "production"
  5updated_date = "2026/02/20"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Detects execution of bpftool commands used to load, attach, run, or pin eBPF programs, as well as create or update
 11eBPF maps and links. These operations interact directly with the Linux eBPF subsystem and can modify kernel-level
 12behavior. While commonly used by legitimate networking or observability tooling, unexpected or interactive usage
 13may indicate eBPF-based rootkit activity, policy tampering, or unauthorized kernel instrumentation.
 14"""
 15from = "now-9m"
 16index = [
 17    "auditbeat-*",
 18    "endgame-*",
 19    "logs-auditd_manager.auditd-*",
 20    "logs-endpoint.events.process*",
 21    "logs-sentinel_one_cloud_funnel.*",
 22    "logs-crowdstrike.fdr*",
 23]
 24language = "eql"
 25license = "Elastic License v2"
 26name = "BPF Program or Map Load via bpftool"
 27note = """## Triage and analysis
 28
 29> **Disclaimer**:
 30> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
 31
 32### Investigating BPF Program or Map Load via bpftool
 33
 34This rule flags bpftool executions that load, attach, run, or pin eBPF programs and that create or pin maps/links, actions that can change kernel behavior without traditional user-space artifacts. Adversaries can use bpftool to load a malicious eBPF object, attach it to a tracepoint or traffic control hook, and pin the program and maps in bpffs so it persists and hides or filters activity across reboots.
 35
 36### Possible investigation steps
 37
 38- Capture full command line, parent process, user context, TTY/session, and current working directory to determine whether execution was interactive administration or automated tooling.  
 39- Enumerate loaded and pinned eBPF artifacts and their attachment points using `bpftool prog show`, `bpftool map show`, `bpftool link show`, and a filesystem review of `/sys/fs/bpf` to identify unexpected persistence.  
 40- Identify the eBPF object/source used for the load (path, inode, hash, package origin) and retrieve a copy for analysis, including checking for recent writes or downloads in the same directory tree.  
 41- Correlate the event time with system logs and other telemetry for follow-on activity such as privilege escalation, module loads, network filtering changes, or suspicious process hiding indicators.  
 42- Hunt for persistence mechanisms that would reload the same eBPF program after reboot (systemd units/timers, cron, init scripts, container entrypoints) and validate against known legitimate observability/network stacks in the environment.
 43
 44### False positive analysis
 45
 46- A system administrator or SRE may run `bpftool prog load/attach/pin` or `bpftool map create/pin` during planned troubleshooting or performance investigation to temporarily instrument kernel events and persist objects under `/sys/fs/bpf` for multi-step validation.  
 47- A legitimate system service or boot-time automation may invoke `bpftool` to load and pin eBPF programs/maps as part of expected networking, security policy enforcement, or observability initialization, especially after upgrades or configuration changes that trigger reloading.
 48
 49### Response and remediation
 50
 51- Immediately isolate the host or container from the network and stop the initiating service/session, then detach any active hooks by removing pinned artifacts under `/sys/fs/bpf` and verifying with `bpftool prog show` and `bpftool link show` that the suspicious program/link is no longer attached.  
 52- Preserve evidence by collecting the full `bpftool` command line and parent chain, a recursive copy of `/sys/fs/bpf`, and the exact eBPF object file used for the load (path, hash, permissions, timestamps) before deleting or modifying artifacts.  
 53- Eradicate persistence by removing malicious eBPF pins, deleting or quarantining the associated `.o`/loader binaries, and disabling the boot-time mechanism that reloads them (systemd unit/timer, cron, init scripts, container entrypoint) followed by a controlled reboot to clear any remaining in-kernel state.  
 54- Recover by restoring the system to a known-good configuration, validating expected networking/observability behavior, and monitoring that no new pinned programs/maps/links reappear under `/sys/fs/bpf` after reboot or service restarts.  
 55- Escalate to incident response and kernel/rootkit specialists if the program attaches to security-relevant hooks (e.g., tracepoints/kprobes/LSM/tc) or if pinned objects reappear after removal, indicating an active persistence mechanism or compromised privileged runtime.  
 56- Harden by restricting `bpftool` availability and access to bpffs, enforcing least-privilege for CAP_BPF/CAP_SYS_ADMIN, requiring signed/managed eBPF loaders, and enabling controls that limit eBPF usage to approved components in production images and hosts."""
 57references = [
 58    "https://manpages.ubuntu.com/manpages/jammy/man8/bpftool-prog.8.html",
 59    "https://manpages.ubuntu.com/manpages/noble/man8/bpftool-map.8.html",
 60    "https://man.archlinux.org/man/bpftool-link.8.en",
 61]
 62risk_score = 47
 63rule_id = "2d05fefd-40ba-43ae-af0c-3c25e86b54f1"
 64severity = "medium"
 65tags = [
 66    "Domain: Endpoint",
 67    "OS: Linux",
 68    "Use Case: Threat Detection",
 69    "Tactic: Persistence",
 70    "Tactic: Defense Evasion",
 71    "Threat: Rootkit",
 72    "Data Source: Elastic Endgame",
 73    "Data Source: Elastic Defend",
 74    "Data Source: Auditd Manager",
 75    "Data Source: SentinelOne",
 76    "Data Source: Crowdstrike",
 77    "Resources: Investigation Guide",
 78]
 79timestamp_override = "event.ingested"
 80type = "eql"
 81query = '''
 82process where host.os.type == "linux" and event.type == "start" and
 83event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
 84process.name == "bpftool" and (
 85  (process.args == "prog" and process.args in ("load", "loadall", "attach", "run", "pin")) or
 86  (process.args == "map" and process.args in ("create", "pin")) or
 87  (process.args == "link" and process.args == "pin")
 88)
 89'''
 90
 91[[rule.threat]]
 92framework = "MITRE ATT&CK"
 93
 94[[rule.threat.technique]]
 95id = "T1547"
 96name = "Boot or Logon Autostart Execution"
 97reference = "https://attack.mitre.org/techniques/T1547/"
 98
 99[[rule.threat.technique.subtechnique]]
100id = "T1547.006"
101name = "Kernel Modules and Extensions"
102reference = "https://attack.mitre.org/techniques/T1547/006/"
103
104[rule.threat.tactic]
105id = "TA0003"
106name = "Persistence"
107reference = "https://attack.mitre.org/tactics/TA0003/"
108
109[[rule.threat]]
110framework = "MITRE ATT&CK"
111
112[[rule.threat.technique]]
113id = "T1014"
114name = "Rootkit"
115reference = "https://attack.mitre.org/techniques/T1014/"
116
117[rule.threat.tactic]
118id = "TA0005"
119name = "Defense Evasion"
120reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

Investigating BPF Program or Map Load via bpftool

This rule flags bpftool executions that load, attach, run, or pin eBPF programs and that create or pin maps/links, actions that can change kernel behavior without traditional user-space artifacts. Adversaries can use bpftool to load a malicious eBPF object, attach it to a tracepoint or traffic control hook, and pin the program and maps in bpffs so it persists and hides or filters activity across reboots.

Possible investigation steps

  • Capture full command line, parent process, user context, TTY/session, and current working directory to determine whether execution was interactive administration or automated tooling.
  • Enumerate loaded and pinned eBPF artifacts and their attachment points using bpftool prog show, bpftool map show, bpftool link show, and a filesystem review of /sys/fs/bpf to identify unexpected persistence.
  • Identify the eBPF object/source used for the load (path, inode, hash, package origin) and retrieve a copy for analysis, including checking for recent writes or downloads in the same directory tree.
  • Correlate the event time with system logs and other telemetry for follow-on activity such as privilege escalation, module loads, network filtering changes, or suspicious process hiding indicators.
  • Hunt for persistence mechanisms that would reload the same eBPF program after reboot (systemd units/timers, cron, init scripts, container entrypoints) and validate against known legitimate observability/network stacks in the environment.

False positive analysis

  • A system administrator or SRE may run bpftool prog load/attach/pin or bpftool map create/pin during planned troubleshooting or performance investigation to temporarily instrument kernel events and persist objects under /sys/fs/bpf for multi-step validation.
  • A legitimate system service or boot-time automation may invoke bpftool to load and pin eBPF programs/maps as part of expected networking, security policy enforcement, or observability initialization, especially after upgrades or configuration changes that trigger reloading.

Response and remediation

  • Immediately isolate the host or container from the network and stop the initiating service/session, then detach any active hooks by removing pinned artifacts under /sys/fs/bpf and verifying with bpftool prog show and bpftool link show that the suspicious program/link is no longer attached.
  • Preserve evidence by collecting the full bpftool command line and parent chain, a recursive copy of /sys/fs/bpf, and the exact eBPF object file used for the load (path, hash, permissions, timestamps) before deleting or modifying artifacts.
  • Eradicate persistence by removing malicious eBPF pins, deleting or quarantining the associated .o/loader binaries, and disabling the boot-time mechanism that reloads them (systemd unit/timer, cron, init scripts, container entrypoint) followed by a controlled reboot to clear any remaining in-kernel state.
  • Recover by restoring the system to a known-good configuration, validating expected networking/observability behavior, and monitoring that no new pinned programs/maps/links reappear under /sys/fs/bpf after reboot or service restarts.
  • Escalate to incident response and kernel/rootkit specialists if the program attaches to security-relevant hooks (e.g., tracepoints/kprobes/LSM/tc) or if pinned objects reappear after removal, indicating an active persistence mechanism or compromised privileged runtime.
  • Harden by restricting bpftool availability and access to bpffs, enforcing least-privilege for CAP_BPF/CAP_SYS_ADMIN, requiring signed/managed eBPF loaders, and enabling controls that limit eBPF usage to approved components in production images and hosts.

References

Related rules

to-top