Event Triggered Execution: Udev Rules T1546.017

Tactics: Persistence, Privilege Escalation

Adversaries may maintain persistence through executing malicious content triggered using udev rules. Udev is the Linux kernel device manager that dynamically manages device nodes, handles access to pseudo-device files in the `/dev` directory, and responds to hardware events, such as when external devices like hard drives or keyboards are plugged in or removed. Udev uses rule files with `match keys` to specify the conditions a hardware event must meet and `action keys` to define the actions that should follow. Root permissions are required to create, modify, or delete rule files located in `/etc/udev/rules.d/`, `/run/udev/rules.d/`, `/usr/lib/udev/rules.d/`, `/usr/local/lib/udev/rules.d/`, and `/lib/udev/rules.d/`. Rule priority is determined by both directory and by the digit prefix in the rule filename.

Authoring guide

Patterns shared across the 3 rules above: which fields they filter on, what specific values they look for, and what they exclude. The catalog normalizes field names across vendors so Sigma's Image, Elastic's process.name, and Splunk's process_name collapse into one row. Each rule contributes at most once per row.

Fields filtered most (9 distinct)

The fields most rules look at when detecting this technique. The How column shows the operators authors use (eq, wildcard, regex_match, match) and how often each appears. Sample values are concrete examples to start from, not an exhaustive list.

FieldRulesHowSample values
EventType3eq 2, in 1creation, exec, exec_event, start, updated
host.os.type3eq 3
TargetFilename2starts_with 1, wildcard 1/boot/efi/efi/*/grub.cfg, /boot/grub/grub.cfg, /boot/grub2/grub.cfg, /etc/udev/rules.d/, /lib/udev/
Image1is_not_null 1
data_stream.dataset1eq 1fim.event
event.type1eq 1start
file.extension1eq 1rules
process.args1starts_with 1, wildcard 1+x, -m, /etc/NetworkManager/dispatcher.d/*
process_name1eq 1chmod, install

Top indicator values (182 distinct)

Specific (field, operator, value) combinations the rules check for, ranked by how many rules under this technique use each one. The Corpus reach column counts how many rules across the entire catalog (any technique) check the same combination. High numbers point to widely-used indicators that are likely noisy on their own; combine them with another condition for useful signal. Blank means the combination is specific to rules under this technique. Click a value to expand the rules under this technique that use it.

FieldKindValueRules (here)Corpus reach
EventTypeeq
creation
125
EventTypeeq
updated
1
EventTypein
exec
1171
EventTypein
exec_event
1139
EventTypein
start
1134
TargetFilenamestarts_with
/etc/udev/rules.d/
1
TargetFilenamestarts_with
/lib/udev/
1
TargetFilenamestarts_with
/run/udev/rules.d/
1
TargetFilenamestarts_with
/usr/lib/udev/rules.d/
1
TargetFilenamestarts_with
/usr/local/lib/udev/rules.d/
1
TargetFilenamewildcard
/boot/efi/efi/*/grub.cfg
12
TargetFilenamewildcard
/boot/grub/grub.cfg
12
TargetFilenamewildcard
/boot/grub2/grub.cfg
12
TargetFilenamewildcard
/etc/bash.bashrc
12
TargetFilenamewildcard
/etc/cron.allow
13
TargetFilenamewildcard
/etc/cron.d/*
13
TargetFilenamewildcard
/etc/cron.daily/*
13
TargetFilenamewildcard
/etc/cron.deny
13
TargetFilenamewildcard
/etc/cron.hourly/*
13
TargetFilenamewildcard
/etc/cron.monthly/*
13
TargetFilenamewildcard
/etc/cron.weekly/*
13
TargetFilenamewildcard
/etc/crontab
13
TargetFilenamewildcard
/etc/csh.cshrc
12
TargetFilenamewildcard
/etc/csh.login
12
TargetFilenamewildcard
/etc/dbus-1/session.d/*
12
TargetFilenamewildcard
/etc/dbus-1/system.d/*
12
TargetFilenamewildcard
/etc/default/grub
12
TargetFilenamewildcard
/etc/default/grub.d/*
12
TargetFilenamewildcard
/etc/fish/config.fish
12
TargetFilenamewildcard
/etc/grub.d/*
12

Exclusions (83 distinct)

Field/operator/value combinations excluded by rules under this technique (top-level not() clauses), sorted by how many rules exclude each. These are the false-positive paths the community has learned to filter out. A new rule that ignores the high-count entries here will likely fire on the same noisy paths. Click a value to expand the rules under this technique that exclude it.

FieldKindValueRules excluding
CommandLinein
chmod 755 /etc/update-motd.d/
1
CommandLinein
chmod 777 /etc/update-motd.d/
1
Imagein
./usr/bin/podman
1
Imagein
/bin/autossl_check
1
Imagein
/bin/chef-client
1
Imagein
/bin/dnf
1
Imagein
/bin/dnf-automatic
1
Imagein
/bin/dockerd
1
Imagein
/bin/dpkg
1
Imagein
/bin/dpkg-divert
1
Imagein
/bin/microdnf
1
Imagein
/bin/pacman
1
Imagein
/bin/pamac-daemon
1
Imagein
/bin/podman
1
Imagein
/bin/puppet
1

Rules under this technique

Every rule in the catalog tagged with this technique, grouped by vendor. Click a rule title for its full predicates, exclusions, and indicators.

Platform (all)
Domain (all)

Elastic 3 rules