T1546.017

Udev Rules

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.

Microsoft Sentinel / Defender
kusto
DeviceFileEvents
| where Timestamp > ago(24h)
| where (
    FolderPath has "/etc/udev/rules.d/"
    or FolderPath has "/lib/udev/rules.d/"
    or FolderPath has "/usr/lib/udev/rules.d/"
    or FolderPath has "/run/udev/rules.d/"
  )
| where ActionType in ("FileCreated", "FileModified")
| extend FileName_lc = tolower(FileName)
| extend IsRulesFile = FileName endswith ".rules"
| extend IsEtcRules = FolderPath has "/etc/udev/rules.d/"
| extend SuspiciousWriter = InitiatingProcessFileName !in~ (
    "apt", "dpkg", "rpm", "yum", "dnf", "zypper",
    "ansible", "puppet", "chef", "salt-minion"
  )
| project Timestamp, DeviceName, AccountName, ActionType, FileName, FolderPath,
         IsRulesFile, IsEtcRules, SuspiciousWriter,
         InitiatingProcessFileName, InitiatingProcessCommandLine
| where IsRulesFile
| sort by Timestamp desc
high severity medium confidence

Data Sources

File: File Creation File: File Modification Microsoft Defender for Endpoint

Required Tables

DeviceFileEvents

False Positives

  • Linux package installations (apt, dpkg, rpm, yum) that install device management rules as part of hardware driver or udev rule packages
  • Configuration management tools (Ansible, Puppet, Chef, Salt) that deploy custom udev rules for device configuration as part of system baseline enforcement
  • Hardware vendor software that installs udev rules to configure specific hardware devices (e.g., USB security keys, printers, network interfaces)
  • System administrators manually creating udev rules to manage device permissions or automate device-triggered workflows

Unlock Pro Content

Get the full detection package for T1546.017 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections