heroui logo

Linux Non-User Privilege Escalation via Doas

Splunk Security Content

View Source
Summary
Anomaly rule that detects potential Linux privilege escalation via a compromised or bypassed SSH account used to run a doas command as root within a 10-minute window on the same endpoint. The analytic ingests Linux syslog data and searches for an accepted SSH password login ("Accepted password for …") followed by a doas command executed as root ("ran command … as root from …"). It uses Splunk regex extractions to identify: destination host, ssh user, source IP and port, Doas user, command, and working directory. It then derives ssh_login_time and doas_time, computes elapsed_seconds, and filters to non-user accounts from a predefined allowlist (e.g., daemon, bin, www-data, sshd, ntp, etc.). The detection requires both an SSH login event and a doas-root event within 10 minutes for the same user and destination, and surfaces fields such as dest, user, src_ips, src_ports, command, working_directory, and the timestamps. It prioritizes events that match the SSH login (ssh_login=1) and then a doas_root_command (doas_root_command=1) within the time window. The rule is mapped to MITRE techniques T1078.003 (Valid Accounts: SSH), T1548.003 (Abuse Elevation: Abuse Privilege Escalation), and T1021.004 (SSH). Known false positives include legitimate administrative activities where SSH access and doas usage occur within the same window; tuning is advised for authorized privileged accounts and expected management hosts. References include MITRE ATT&CK techniques and SSHHole, and the analytic is intended for endpoint protection use on Linux hosts. The detection output highlights potential unauthorized privilege escalation events on an endpoint and supports incident investigations with a timeline of the SSH login and subsequent doas-root action.
Categories
  • Endpoint
  • Linux
Data Sources
  • Internet Scan
ATT&CK Techniques
  • T1078
  • T1548
  • T1021
  • T1078.003
  • T1548.003
  • T1021.004
Created: 2026-11-16