Cross-source coverage

T1548.003 / ATT&CK

Abuse Elevation Control Mechanism: Sudo and Sudo Caching

75 rules across 9 sources.

4 deprecated hidden · include

From MITRE ATT&CK 19.2

Adversaries may perform sudo caching and/or use the sudoers file to elevate privileges. Adversaries may do this to execute commands as other users or spawn processes with higher privileges.

Within Linux and MacOS systems, sudo (sometimes referred to as "superuser do") allows users to perform commands from terminals with elevated privileges and to control who can perform these commands on the system. The sudo command "allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments." Since sudo was made for the system administrator, it has some useful configuration features such as a timestamp_timeout, which is the amount of time in minutes between instances of sudo before it will re-prompt for a password. This is because sudo has the ability to cache credentials for a period of time. Sudo creates (or touches) a file at /var/db/sudo with a timestamp of when sudo was last run to determine this timeout. Additionally, there is a tty_tickets variable that treats each new tty (terminal session) in isolation. This means that, for example, the sudo timeout of one tty will not affect another tty (you will have to type the password again).

The sudoers file, /etc/sudoers, describes which users can run which commands and from which terminals. This also describes which commands users can run as other users or groups. This provides the principle of least privilege such that users are running in their lowest possible permissions for most of the time and only elevate to other users or permissions as needed, typically by prompting for a password. However, the sudoers file can also specify when to not prompt users for passwords with a line like user1 ALL=(ALL) NOPASSWD: ALL. Elevated privileges are required to edit this file though.

Adversaries can also abuse poor configurations of these mechanisms to escalate privileges without needing the user's password. For example, /var/db/sudo's timestamp can be monitored to see if it falls within the timestamp_timeout range. If it does, then malware can execute sudo commands without needing to supply the user's password. Additional, if tty_tickets is disabled, adversaries can do this from any tty for that user.

In the wild, malware has disabled tty_tickets to potentially make scripting easier by issuing echo \'Defaults !tty_tickets\' >> /etc/sudoers. In order for this change to be reflected, the malware also issued killall Terminal. As of macOS Sierra, the sudoers file has tty_tickets enabled by default.

Platforms
Linux · macOS
Telemetry
auditd:SYSCALLmacos:unifiedlog

How MITRE says to detect it DET0052

Behavioral Detection Strategy for Abuse of Sudo and Sudo Caching

Linux Analytic 0142

Correlate command executions involving 'sudo' with elevated effective user ID (euid=0), especially when tty_tickets is disabled or timestamp_timeout is actively abused.

  • auditd:SYSCALL execve call for sudo where euid != uid
  • auditd:SYSCALL execve call for modification of /etc/sudoers or writing to /var/db/sudo

macOS Analytic 0143

Detect sudo activity with NOPASSWD in /etc/sudoers or disabling tty_tickets, followed by immediate privileged commands (e.g., echo 'Defaults !tty_tickets' >> /etc/sudoers).

  • macos:unifiedlog exec or sudo usage with NOPASSWD context or echo modifying sudoers
  • macos:unifiedlog Terminal process killed (killall Terminal) immediately after sudoers modification

splunk/security_content

35 rules
Detection Severity Format
Linux APT Privilege Escalation Undefined SPL
Linux Auditd Doas Conf File Creation Undefined SPL
Linux Auditd Doas Tool Execution Undefined SPL
Linux Auditd Nopasswd Entry In Sudoers File Undefined SPL
Linux Auditd Possible Access To Sudoers File Undefined SPL
Linux Auditd Sudo Or Su Execution Undefined SPL
Linux AWK Privilege Escalation Undefined SPL
Linux Busybox Privilege Escalation Undefined SPL
Linux c89 Privilege Escalation Undefined SPL
Linux c99 Privilege Escalation Undefined SPL

+ 25 more from splunk/security_content → showing the 10 highest-severity

elastic/detection-rules

16 rules
Detection Severity Format
Potential CVE-2025-32463 Sudo Chroot Execution Attempt High Elastic TOML
Potential Privilege Escalation via Sudoers File Modification High Elastic TOML
Potential Privilege Escalation via SUID/SGID High Elastic TOML
Potential Sudo Privilege Escalation via CVE-2019-14287 High Elastic TOML
Suspicious Echo or Printf Execution Detected via Defend for Containers High Elastic TOML
Suspicious SUID Binary Execution High Elastic TOML
Pod or Container Creation with Suspicious Command-Line Medium Elastic TOML
Potential Defense Evasion via Doas Medium Elastic TOML
Potential Sudo Hijacking Medium Elastic TOML
Potential Sudo Token Manipulation via Process Injection Medium Elastic TOML

+ 6 more from elastic/detection-rules → showing the 10 highest-severity

Wazuh Core Ruleset

9 rules
Detection Severity Format
Auditd: User becomes root. High Wazuh XML
Three failed attempts to run sudo High Wazuh XML
syslog: Illegal root login. Medium Wazuh XML
User missed the password to change UID to root. Medium Wazuh XML
Failed attempt to run sudo. Low Wazuh XML
First time user executed sudo. Low Wazuh XML
Successful sudo executed. Low Wazuh XML
Successful sudo to ROOT executed. Low Wazuh XML
Unauthorized user attempted to use sudo. Low Wazuh XML

socfortress/Wazuh-Rules

5 rules
Detection Severity Format
Sudo configuration change to disable password timeout (T1548.003) High Wazuh XML
Sudo configuration modified to disable tty_tickets (T1548.003) High Wazuh XML
Sudoers file modified via echo (tty_tickets disabled) (T1548.003) High Wazuh XML
visudo used to validate modified sudoers file (T1548.003) High Wazuh XML
Privilege escalation via sudo enumeration (T1548.003) Medium Wazuh XML

SigmaHQ/sigma

3 rules
Detection Severity Format
Sudo Privilege Escalation CVE-2019-14287 - Builtin Critical Sigma
Sudo Privilege Escalation CVE-2019-14287 High Sigma
Persistence Via Sudoers.d Files Medium Sigma

elastic/protections-artifacts

3 rules
Detection Severity Format
Potential Privilege Escalation via a Known SUID/SGID Binary Undefined Elastic TOML
Potential Privilege Escalation via a SUID/SGID Binary Undefined Elastic TOML
Suspicious SUID/SGID Utility Execution Undefined Elastic TOML

Bert-JanP/Hunting-Queries-Detection-Rules

2 rules
Detection Severity Format
Hunt for users that have been added to the sudoers group Undefined KQL
MITRE ATT&CK Mapping Undefined KQL

falcosecurity/rules

1 rule
Detection Severity Format
Sudo Potential Privilege Escalation Critical Falco YAML

panther-labs/panther-analysis

1 rule
Detection Severity Format
Kubernetes Privileged Pod Created High Panther Python

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.