Techniques
Sample rules
Linux Possible SSH Bypass for Non-User Account
- source: splunk
- technicques:
Description
The following analytic detects a failed SSH password authentication followed by a successful password authentication for the same common non-user Linux account, source address, and endpoint within five seconds. This may indicate abuse of an authentication bypass or another weakness that allowed access to an account whose shadow entry is typically locked or passwordless. The account list is a cross-distribution heuristic; verify the account’s shadow status for each image.
Detection logic
`linux_syslog`
("Failed password for" OR "Accepted password for")
| rex field=_raw "^(?<event_timestamp>\\w{3}\\s+\\d+\\s+\\d{2}:\\d{2}:\\d{2})\\s+(?<dest>\\S+)\\s+(?:\\S+\\s+)?sshd(?:-session)?(?:\\.pam)?\\[\\d+\\]:\\s+(?<auth_result>Failed
|Accepted) password for (?:invalid user )?(?<user>\\S+) from (?<src_ip>\\S+) port (?<src_port>\\d+) ssh2"
| eval user=lower(user)
| where isnotnull(auth_result) AND in(user, "daemon", "bin", "sys", "sync", "shutdown", "halt", "games", "man", "lp", "mail", "news", "uucp", "operator", "www-data", "backup", "list", "irc", "gnats", "nobody", "_apt", "systemd-network", "systemd-resolve", "messagebus", "uuidd", "sshd", "ntp", "ftp", "chrony", "postfix", "redis", "mysql", "mariadb", "postgres", "alpine", "guest")
| eval event_priority=if(auth_result="Failed", 0, 1)
| sort 0 _time event_priority
| streamstats global=f window=1 current=f last(auth_result) as previous_auth_result last(_time) as failure_time by dest user src_ip
| where auth_result="Accepted" AND previous_auth_result="Failed" AND _time-failure_time<=5
| eval success_time=_time, elapsed_seconds=success_time-failure_time
| `security_content_ctime(failure_time)`
| `security_content_ctime(success_time)`
| table failure_time success_time elapsed_seconds dest user src_ip src_port
| `linux_possible_ssh_bypass_for_non_user_account_filter`