Linux Process Execution of bpftrace with the --unsafe Option

Alerts when bpftrace is executed with the --unsafe option on Linux.

FreeReviewedSigma · Medium · v3
Product
linux
Category
process_creation
Author
Andreas Hunkeler (@Karneades) (SigmaHQ), DRL 1.1
Published
2022-02-11
Updated
2026-07-31
title: Linux Process Execution of bpftrace with the --unsafe Option
id: 46363c82-b859-430d-a723-a75366823783
status: test
description: This rule flags process executions where the command line for bpftrace includes the --unsafe option. The unsafe flag enables behavior that can increase risk and may be used by an attacker to bypass safeguards when running bpftrace. It relies on process creation telemetry capturing the executed image path ending with bpftrace and the command-line arguments.
references:
  - https://embracethered.com/blog/posts/2021/offensive-bpf-bpftrace/
  - https://bpftrace.org/
  - https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_bpftrace_unsafe_option_usage.yml
author: Andreas Hunkeler (@Karneades), Huntrule Team
date: 2022-02-11
tags:
  - attack.execution
  - attack.t1059.004
logsource:
  category: process_creation
  product: linux
detection:
  selection:
    Image|endswith: bpftrace
    CommandLine|contains: --unsafe
  condition: selection
falsepositives:
  - Legitimate usage of the unsafe option
level: medium
license: DRL-1.1
related:
  - id: f8341cb2-ee25-43fa-a975-d8a5a9714b39
    type: derived