Detect Ccache Files in Sumo Logic CSE
Adversaries may attempt to steal Kerberos tickets stored in credential cache (ccache) files. These files store short-lived Kerberos session credentials created at authentication, enabling access to network services without re-entering passwords. On Linux, ccache files are typically located in /tmp with names in the format krb5cc_<UID> or krb5.ccache; storage is governed by the KRB5CCNAME environment variable and /etc/krb5.conf. On macOS, ccache entries are held in memory under an API:{uuid} naming scheme, accessible via lower-level Kerberos framework APIs. Adversaries steal these files and replay tickets to authenticate as the victim without knowing their password (Pass the Ticket). Impacket tools including getST.py, getTGT.py, and ticketer.py are commonly used to programmatically interact with ccache files. Kekeo can convert ccache files to Windows kirbi format for reuse on Windows systems, enabling cross-platform lateral movement. Real-world usage includes APT groups operating in Active Directory environments with Linux-integrated systems.
MITRE ATT&CK
- Tactic
- Credential Access
- Technique
- T1558 Steal or Forge Kerberos Tickets
- Sub-technique
- T1558.005 Ccache Files
- Canonical reference
- https://attack.mitre.org/techniques/T1558/005/
Sumo Detection Query
// Branch 1: Auditd ccache file access watch key hits
(_sourceCategory=*linux*auditd* OR _sourceCategory=*auditd*)
| parse regex "key=\"(?<audit_key>[^\"]+)\""
| parse regex "exe=\"(?<exe>[^\"]+)\"" nodrop
| parse regex "comm=\"(?<comm>[^\"]+)\"" nodrop
| parse regex "name=\"(?<file_name>[^\"]+)\"" nodrop
| parse regex "pid=(?<pid>\d+)" nodrop
| parse regex "uid=(?<uid>\d+)" nodrop
| parse regex "hostname=(?<src_host>[^\s]+)" nodrop
| where audit_key = "kerberos_ccache"
OR (exe matches "*getST*" OR exe matches "*getTGT*" OR exe matches "*ticketer*" OR exe matches "*getNTHash*" OR exe matches "*rbcd*")
OR (
(exe matches "*/python" OR exe matches "*/python2" OR exe matches "*/python3")
AND (_raw matches "*CCache*" OR _raw matches "*krb5cc_*" OR _raw matches "*KRB5CCNAME*" OR _raw matches "*.ccache*")
)
OR (
(exe matches "*/cp" OR exe matches "*/mv" OR exe matches "*/cat" OR exe matches "*/base64"
OR exe matches "*/tar" OR exe matches "*/scp" OR exe matches "*/rsync" OR exe matches "*/curl"
OR exe matches "*/wget" OR exe matches "*/nc" OR exe matches "*/ncat" OR exe matches "*/dd")
AND (_raw matches "*krb5cc_*" OR _raw matches "*krb5.ccache*")
)
| where !(exe matches "*/kinit" OR exe matches "*/klist" OR exe matches "*/kdestroy"
OR exe matches "*/sssd" OR exe matches "*/krb5kdc" OR exe matches "*/kadmind"
OR exe matches "*/sshd" OR exe matches "*/login")
| eval detection_type = if(exe matches "*(getST|getTGT|ticketer|getNTHash|rbcd|getServiceTicket|getPac|getUserSPNs)*",
"ImpacketKerberosTool",
if((exe matches "*/python*") AND (_raw matches "*CCache*" OR _raw matches "*krb5cc_*"),
"PythonKerberosInteraction",
if(audit_key = "kerberos_ccache",
"CcacheFileAccess",
"CcacheFileCopyOrExfiltration"
)
)
)
| fields _messageTime, src_host, uid, pid, exe, comm, file_name, audit_key, detection_type
| sort by _messageTime desc Sumo Logic query against Linux auditd log sources detecting Kerberos ccache file theft. Identifies auditd watch key hits on ccache paths, Impacket Kerberos tool execution, Python scripts manipulating ccache credentials, and shell utility exfiltration of ccache files. Filters out known-legitimate Kerberos system processes.
Data Sources
Required Tables
False Positives & Tuning
- Kerberos-aware monitoring agents that enumerate /tmp for ccache files as part of health or credential expiry checks
- CI/CD pipelines using Python and Kerberos authentication to access internal services, with KRB5CCNAME set in environment
- SRE or ops tooling using scp or rsync to migrate home directories including /tmp symlinks or dot files referencing ccache paths
Other platforms for T1558.005
Testing Methodology
Validate this detection against 4 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.
- Test 1Discover and Copy Ccache File
Expected signal: DeviceProcessEvents: process creation for find (/tmp/krb5cc_*), klist (-c /tmp/krb5cc_<uid>), and cp. DeviceFileEvents: FileCreated for /tmp/.svc_cache_bak with InitiatingProcessFileName=cp. Auditd (linux_audit): SYSCALL records for open/read on /tmp/krb5cc_<uid> with exe=/bin/cp, plus PATH records for both source and destination files. key=kerberos_ccache if auditd watch is configured.
- Test 2Base64 Encode Ccache for Exfiltration
Expected signal: DeviceProcessEvents: process creation for base64 with ProcessCommandLine containing 'krb5cc_<uid>' and xxd with the same path. Auditd (linux_audit): SYSCALL open/read records on /tmp/krb5cc_<uid> with exe=/usr/bin/base64 and exe=/usr/bin/xxd. These processes will appear in linux_audit events alongside EXECVE records showing the full command.
- Test 3Use Impacket Python Library to Read Ccache Tickets
Expected signal: DeviceProcessEvents: python3 process creation with ProcessCommandLine containing 'CCache', 'ccache', 'krb5cc_'. DeviceFileEvents: FileRead event on /tmp/krb5cc_<uid> with InitiatingProcessFileName=python3. Auditd (linux_audit): SYSCALL open record with exe=/usr/bin/python3 on the ccache path. EXECVE record showing full python3 -c invocation with ccache string patterns.
- Test 4Set KRB5CCNAME to Stolen Ticket and Authenticate
Expected signal: DeviceProcessEvents: cp process with /tmp/krb5cc_<uid> in command line, klist process with -c /tmp/attacker_krb5cc argument. DeviceFileEvents: FileCreated for /tmp/attacker_krb5cc with InitiatingProcessFileName=cp. Auditd (linux_audit): SYSCALL records for cp (open/read on source, open/write/creat on destination) and klist (open/read on /tmp/attacker_krb5cc). The unusual ccache path /tmp/attacker_krb5cc is a behavioral anomaly.
References (12)
- https://attack.mitre.org/techniques/T1558/005/
- https://www.binarydefense.com/resources/blog/shining-a-light-in-the-dark-how-binary-defense-uncovered-an-apt-lurking-in-shadows-of-it/
- https://adepts.of0x.cc/kerberos-thievery-linux/
- https://posts.specterops.io/when-kirbi-walks-the-bifrost-4c727807744f
- https://www.fireeye.com/blog/threat-research/2020/04/kerberos-tickets-on-linux-red-teams.html
- https://labs.portcullis.co.uk/download/eu-18-Wadhwa-Brown-Where-2-worlds-collide-Bringing-Mimikatz-et-al-to-UNIX.pdf
- https://github.com/gentilkiwi/kekeo
- https://github.com/fortra/impacket
- https://web.mit.edu/kerberos/krb5-1.12/doc/basic/ccache_def.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1558.005/T1558.005.md
- https://learn.microsoft.com/en-us/defender-endpoint/linux-support-events
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/using_kerberos/introduction-to-kerberos_using-kerberos
Unlock Pro Content
Get the full detection package for T1558.005 including response playbook, investigation guide, and atomic red team tests.