T1098.004 Sumo Logic CSE · Sumo

Detect SSH Authorized Keys in Sumo Logic CSE

Adversaries may modify the SSH authorized_keys file to maintain persistence on a victim host. The authorized_keys file specifies SSH keys permitted for logging into a user account, typically found at <user-home>/.ssh/authorized_keys. Adversaries add their own public keys to this file, enabling passwordless SSH access using the corresponding private key. This technique is used by multiple threat actors including Earth Lusca, TeamTNT, and Salt Typhoon, as well as malware families like Skidmap, XCSSET, and Bundlore.

MITRE ATT&CK

Tactic
Persistence Privilege Escalation
Technique
T1098 Account Manipulation
Sub-technique
T1098.004 SSH Authorized Keys
Canonical reference
https://attack.mitre.org/techniques/T1098/004/

Sumo Detection Query

Sumo Logic CSE (Sumo)
sql
_sourceCategory=*linux* OR _sourceCategory=*syslog* OR _sourceCategory=*auditd*
| where _raw matches /authorized_keys/
| parse regex "(?P<proc_name>[a-zA-Z0-9_-]+)\[(?P<pid>\d+)\]" nodrop
| parse regex "(?:user|uid)[=: ]+(?P<username>[a-zA-Z0-9_.@-]+)" nodrop
| parse regex "(?:cmd|command|exe|comm)[=: ]+\"?(?P<command>[^\"\n]+)\"?" nodrop
| parse regex "(?:path|name)[=: ]+\"?(?P<file_path>[^\"\n ]+authorized_keys[^\"\n ]*)\"?" nodrop
| if (_raw matches /\/root\/.ssh/, 1, 0) as IsRootSSHDir
| if (_raw matches /\/etc\/ssh\/keys-/, 1, 0) as IsEtcSSHKeys
| if (_raw matches />>|tee -a|tee --append/, 1, 0) as IsAppendRedirect
| if (_raw matches /ssh-keygen/, 1, 0) as IsSshKeygen
| if (_raw matches /curl|wget/, 1, 0) as IsCurlWget
| if (_raw matches /echo.*authorized_keys|printf.*authorized_keys/, 1, 0) as IsEchoWrite
| (IsRootSSHDir + IsEtcSSHKeys + IsAppendRedirect + IsSshKeygen + IsCurlWget + IsEchoWrite) as SuspicionScore
| where SuspicionScore > 0
| fields _messageTime, _sourceHost, username, proc_name, pid, command, file_path, IsRootSSHDir, IsEtcSSHKeys, IsAppendRedirect, IsSshKeygen, IsCurlWget, IsEchoWrite, SuspicionScore
| sort by _messageTime desc
high severity high confidence

Detects SSH authorized_keys modification in Sumo Logic by searching Linux syslog and auditd source categories for raw messages referencing authorized_keys. Uses multi-pass regex parsing to extract username, process name, PID, command, and file path fields. Computes a six-factor suspicion score covering root SSH directory access, /etc/ssh/keys- paths, append redirect operators, ssh-keygen invocation, curl/wget downloaders, and echo/printf writes. Only alerts when at least one risk factor is present.

Data Sources

Linux syslog via Sumo Logic Installed Collector (sourceCategory=*linux* or *syslog*)Auditd logs via Sumo Logic Installed Collector (sourceCategory=*auditd*)Sumo Logic Cloud SIEM (CSE) with normalized Linux schemaSumo Logic Kubernetes Collection from Linux worker nodes

Required Tables

Log data matching _sourceCategory=*linux*, *syslog*, or *auditd*

False Positives & Tuning

  • Infrastructure-as-code tooling (Terraform remote-exec provisioners, Pulumi local commands, cloud-init scripts) that write SSH public keys to authorized_keys as part of VM provisioning at scale
  • SSH bastion host initialization scripts that pre-populate authorized_keys from a central key management service (HashiCorp Vault SSH secrets engine, AWS Systems Manager, CyberArk) on startup
  • Developers using ssh-copy-id, Visual Studio Code Remote SSH, or JetBrains Gateway to add their workstation public key to development servers or Kubernetes nodes for IDE-based remote development
Download portable Sigma rule (.yml)

Other platforms for T1098.004


Testing Methodology

Validate this detection against 5 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.

  1. Test 1Append Adversary SSH Key to Root authorized_keys

    Expected signal: auditd SYSCALL records for open()/write() on /root/.ssh/authorized_keys if auditd watch is configured. syslog entries from auditd. DeviceFileEvents (if MDE for Linux deployed): FileCreated or FileModified event for FileName=authorized_keys with FolderPath=/root/.ssh. DeviceProcessEvents: Process Create for ssh-keygen and echo/bash with ProcessCommandLine containing 'authorized_keys'. Shell history entry in /root/.bash_history.

  2. Test 2Add SSH Key via curl Download

    Expected signal: DeviceProcessEvents: Process Create for curl with ProcessCommandLine containing 'authorized_keys'. DeviceNetworkEvents: Network connection from curl to 127.0.0.1:18080 (Sysmon Event ID 3 if Sysmon for Linux). DeviceFileEvents: FileModified on authorized_keys with InitiatingProcessFileName=bash or sh. Shell history entries for curl and python3 commands.

  3. Test 3Modify SSH Config to Enable Root Login and Key Auth

    Expected signal: auditd SYSCALL records for open()/write() on /etc/ssh/sshd_config if auditd watch is configured. DeviceFileEvents (if MDE for Linux): FileModified for FileName=sshd_config in FolderPath=/etc/ssh. DeviceProcessEvents: Process Create for sed with ProcessCommandLine containing 'sshd_config' and 'PermitRootLogin'. Shell history entries for sed and grep commands.

  4. Test 4Add SSH Key to Non-Root User Account

    Expected signal: DeviceFileEvents: FileCreated or FileModified for FileName=authorized_keys under /home/<user>/.ssh/. DeviceProcessEvents: Process Create for useradd, ssh-keygen, cat with relevant command lines. auditd records for file operations on the authorized_keys path. Shell history for all commands executed.

  5. Test 5Simulate ESXi authorized_keys Modification

    Expected signal: DeviceFileEvents: FileCreated for FileName=authorized_keys with FolderPath containing /etc/ssh/keys-. DeviceProcessEvents: Process Create for ssh-keygen and cat with ProcessCommandLine containing the ESXi key path. On actual ESXi systems, ESXCLI audit logs and /var/log/auth.log entries would also be generated.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections