T1558.005

Ccache Files

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.

Microsoft Sentinel / Defender
kusto
let LegitKerbProcesses = dynamic(["kinit", "klist", "kdestroy", "kgetcred", "sssd", "krb5kdc", "kadmind", "sshd", "login", "su", "sudo", "gdm", "lightdm", "pamtester", "pamtest"]);
let ImpacketKerbTools = dynamic(["getST.py", "getTGT.py", "ticketer.py", "getNTHash.py", "rbcd.py", "getServiceTicket.py", "getPac.py", "getUserSPNs.py"]);
let ExfilCommands = dynamic(["cp", "mv", "cat", "base64", "xxd", "tar", "scp", "rsync", "nc", "ncat", "curl", "wget", "dd"]);
// Branch 1: Unexpected processes accessing ccache files on disk
let SuspiciousCcacheFileAccess = DeviceFileEvents
    | where Timestamp > ago(24h)
    | where (FolderPath startswith "/tmp/" and FileName matches regex @"^krb5cc_[0-9]+$")
          or FileName =~ "krb5.ccache"
          or (FolderPath contains "/krb5" and FileName endswith ".ccache")
    | where InitiatingProcessFileName !in~ (LegitKerbProcesses)
    | project Timestamp, DeviceName, AccountName,
              AccessedPath = strcat(FolderPath, "/", FileName),
              ActionType,
              TriggerProcess = InitiatingProcessFileName,
              TriggerCommandLine = InitiatingProcessCommandLine,
              ParentProcess = InitiatingProcessParentFileName,
              DetectionType = "UnexpectedCcacheFileAccess";
// Branch 2: Impacket Kerberos tools or Python interacting with ccache ticket data
let ImpacketOrPythonKerb = DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where ProcessCommandLine has_any (ImpacketKerbTools)
          or (FileName in~ ("python", "python3", "python2")
              and ProcessCommandLine has_any ("CCache", "ccache", "krb5cc", "KRB5CCNAME", ".ccache"))
    | project Timestamp, DeviceName, AccountName,
              AccessedPath = "",
              ActionType = "ProcessExecution",
              TriggerProcess = FileName,
              TriggerCommandLine = ProcessCommandLine,
              ParentProcess = InitiatingProcessFileName,
              DetectionType = "ImpacketKerberosTool";
// Branch 3: Shell utilities referencing ccache file paths (staging or exfiltration)
let ShellCcacheAccess = DeviceProcessEvents
    | where Timestamp > ago(24h)
    | where FileName in~ (ExfilCommands)
    | where ProcessCommandLine matches regex @"krb5cc_[0-9]+"
          or ProcessCommandLine has "krb5.ccache"
    | project Timestamp, DeviceName, AccountName,
              AccessedPath = "",
              ActionType = "ProcessExecution",
              TriggerProcess = FileName,
              TriggerCommandLine = ProcessCommandLine,
              ParentProcess = InitiatingProcessFileName,
              DetectionType = "CcacheFileCopyOrExfiltration";
union SuspiciousCcacheFileAccess, ImpacketOrPythonKerb, ShellCcacheAccess
| sort by Timestamp desc
high severity medium confidence

Data Sources

File: File Access Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint (Linux agent) Microsoft Defender for Endpoint (macOS agent)

Required Tables

DeviceFileEvents DeviceProcessEvents

False Positives

  • Backup agents (Bacula, Veeam for Linux, Amanda) that scan /tmp during filesystem-level backups will trigger Branch 1
  • Security scanning tools (Qualys, Tenable Nessus) performing file discovery across /tmp will generate false positives from Branch 1
  • Legitimate Python applications using the gssapi or krb5 Python libraries for service-to-service Kerberos authentication will trigger Branch 2 — common in Hadoop, Spark, and Kafka deployments
  • System administrators manually running klist followed by cp to clone ccache files for debugging Kerberos delegation or KDC trust issues
  • Automated CI/CD pipeline agents (Jenkins, GitLab Runner) that use Kerberos credentials for accessing internal NFS shares or Kerberized databases

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections