← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing Linux Sudoers File Modification Privilege Escalation Dataset

This hunt uses a simulated Linux host dataset (linux_sudoers_mod_2022-08-21T160000.json) capturing T1548.003: Abuse Elevation Control Mechanism - Sudo and Sudo Caching, where an attacker with temporary root/write access modifies /etc/sudoers (or drops a file in /etc/sudoers.d/) to grant a low-privilege account passwordless, unrestricted sudo rights, establishing a durable privilege-escalation backdoor.

Step 1: Hypothesis Formation

Hypothesis: A new or modified entry appears in /etc/sudoers or /etc/sudoers.d/ granting ALL=(ALL) NOPASSWD:ALL to an account that previously had no or limited sudo rights, and this change is not attributable to a documented configuration-management run. Indicators:

Null Hypothesis: A legitimate configuration-management tool pushed an approved sudoers change as part of a documented access-provisioning request. Invalidate by checking the CM tool's run log and the corresponding change/access-request ticket.

Rationale: A sudoers modification is one of the most direct and durable privilege-escalation backdoors on Linux, persisting independently of any process or network artifact; this hunt validates file-integrity monitoring on sudoers paths, correlated against configuration-management logs, as the primary control for catching unauthorized grants.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed events (5 shown) confirm a new file was dropped in /etc/sudoers.d/ granting svc-metrics unrestricted, passwordless sudo, with no corresponding configuration-management run and immediate abuse of the new privilege.

Timestamp (UTC)HostEventDetailIOC/Why Suspicious?
2022-08-21 16:00:05lnx-app-node09auditd PATH (CREATE)/etc/sudoers.d/99-metrics-helper created by root sessionGrant-Vector IOC: use of the sudoers.d drop-in directory (rather than editing /etc/sudoers directly) is a common technique to avoid triggering visudo-specific monitoring while still applying instantly.
2022-08-21 16:00:06lnx-app-node09(file content, via FIM)svc-metrics ALL=(ALL) NOPASSWD: ALLPrivilege IOC: unrestricted, passwordless root access granted to a service account that previously had no sudo entry at all.
2022-08-21 16:00:10lnx-app-node09(CM log check)No Ansible/Puppet run recorded for lnx-app-node09 in the preceding 24 hours; no matching access-request ticketConfirms the change was made manually and out-of-band, not via the approved provisioning pipeline.
2022-08-21 16:01:15lnx-app-node09sudo logsvc-metrics : TTY=pts/2 ; PWD=/home/svc-metrics ; USER=root ; COMMAND=/bin/bash - no password prompt loggedAbuse IOC: the newly-granted account immediately used its passwordless sudo rights to obtain an interactive root shell, within 70 seconds of the grant.
2022-08-21 16:01:16lnx-app-node09auditd EXECVE (as root)useradd svc-monitor2 -m -s /bin/bash and usermod -aG sudo svc-monitor2Redundancy IOC: attacker immediately created a second backdoor account, a common pattern to survive remediation of the first.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - an attacker planted an unauthorized sudoers.d file granting a service account passwordless root access, then immediately used it to obtain a root shell and create a second backdoor account!