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

These 3 rules share fields, values, and exclusions.

Fields filtered most (9 distinct)

These fields appear most often in rule filters.

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)

These values appear most often in rule predicates.

FieldKindValueRules (here)Corpus reach
EventTypeeq
creation
158
EventTypeeq
updated
1
EventTypein
exec
1206
EventTypein
exec_event
1150
EventTypein
start
1168
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)

These values appear most often in top-level exclusions.

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

These vendors publish rules tagged with this technique.

Platform: Linux

Domain: Endpoint

Elastic 3 rules