Detect Udev Rules in Sumo Logic CSE
Adversaries may establish persistence by executing malicious content triggered by udev (userspace /dev) rules. Udev is the Linux kernel device manager that handles device events and dynamic file system creation in /dev. Udev rules files (stored at /etc/udev/rules.d/ and /lib/udev/rules.d/) define actions to execute when devices are connected or disconnected, or when other hardware events occur. Adversaries can create malicious udev rules that execute arbitrary commands — potentially as root — when specific device events occur. Since udev runs as root, any RUN directive in a udev rule executes with root privileges, providing both persistence and privilege escalation.
MITRE ATT&CK
- Tactic
- Persistence Privilege Escalation
- Technique
- T1546 Event Triggered Execution
- Sub-technique
- T1546.017 Udev Rules
- Canonical reference
- https://attack.mitre.org/techniques/T1546/017/
Sumo Detection Query
_sourceCategory=linux* OR _sourceCategory=syslog* OR _sourceCategory=auditd*
| parse regex "(?<file_path>/(?:etc|lib|usr/lib|run)/udev/rules\.d/[^\s]+\.rules)" nodrop
| parse regex "(?<process_name>\b(?:apt|dpkg|rpm|yum|dnf|zypper|ansible|puppet|chef|salt-minion|systemd|udevd)\b)" as package_manager nodrop
| parse regex "(?<udevadm_cmd>udevadm\s+(?:trigger|settle|reload|control)[^\n]*)" nodrop
| eval is_udev_rules_write = if (!isNull(file_path) AND ((_raw matches /write|wrote|create|WRITE|CREATE|O_CREAT|WRONLY/)), 1, 0)
| eval is_udev_exec = if (!isNull(udevadm_cmd), 1, 0)
| eval is_package_manager = if (!isNull(package_manager), 1, 0)
| eval suspicious_write = if (is_udev_rules_write == 1 AND is_package_manager == 0, 1, 0)
| eval suspicious_exec = if (is_udev_exec == 1 AND is_package_manager == 0, 1, 0)
| where suspicious_write == 1 OR suspicious_exec == 1
| eval detection_type = if (suspicious_write == 1, "Udev Rules File Write", "Suspicious udevadm Execution")
| fields _messageTime, _sourceHost, _sourceCategory, file_path, udevadm_cmd, detection_type, suspicious_write, suspicious_exec
| sort by _messageTime desc Detects creation or modification of .rules files in udev rules directories (/etc/udev/rules.d/, /lib/udev/rules.d/, /usr/lib/udev/rules.d/, /run/udev/rules.d/) by processes other than known package managers, or suspicious udevadm trigger/settle/reload/control invocations. Attackers abuse udev persistence to execute commands as root whenever specific device events occur.
Data Sources
Required Tables
False Positives & Tuning
- Linux administrators creating udev rules files manually for custom device handling such as persistent network interface naming, USB device permissions, or automount configurations
- Software installation via package managers (apt, yum, dnf, rpm) or manual tarballs that write udev rules as part of driver or firmware installation
- Infrastructure-as-code deployments using Ansible, Puppet, Chef, or SaltStack applying device configuration changes across a fleet during scheduled runs
Other platforms for T1546.017
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Create Malicious Udev Rule for USB Device Persistence
Expected signal: File creation event for /etc/udev/rules.d/99-argus-test.rules. Process creation for tee and udevadm. Auditd records for file creation in /etc/udev/rules.d/. When a USB device is inserted, udevd spawns bash to execute the RUN directive — child process of udevd.
- Test 2Create Udev Rule Triggered by Network Interface
Expected signal: File creation event for 99-argus-net-test.rules in /etc/udev/rules.d/. The rule fires when a network interface is added — logger is spawned by udevd as a child process, creating a syslog entry. Systemd journal shows udevd running the RUN directive.
- Test 3Enumerate All Custom Udev Rules
Expected signal: Process creation for grep, ls with udev directory arguments. Read-only — no modifications. The output reveals all custom rules and their RUN directives.
Unlock Pro Content
Get the full detection package for T1546.017 including response playbook, investigation guide, and atomic red team tests.