getdents64 is the Linux system call used to read directory entries in 64-bit format. Programs use it through libc or directly to list files and subdirectories, and security tools may monitor it because malware and rootkits can hook directory enumeration to hide files.
What getdents64 Does
getdents64 is the Linux system call that returns directory entries in 64-bit format. It is the low-level mechanism behind directory listing, whether a program reaches it directly or through libc. Because it exposes the raw contents of a directory, it sits close to the boundary between normal file enumeration and security monitoring.
At a practical level, getdents64 is what turns a directory into a stream of names, types, and offsets that user space can iterate over. It does not decide access by itself, but it is the interface through which tools observe the visible file system state. That makes it a useful point of reference when discussing enumeration, visibility, and concealment.
Why Directory Enumeration Matters
Directory enumeration is foundational to almost every file-centric workflow: shell commands, file managers, backup tools, endpoint scanners, and forensic utilities all depend on it. When enumeration behaves unexpectedly, the problem is not just usability, it can affect discovery of malicious binaries, hidden configuration files, staged payloads, or evidence that should be visible during review.
Because getdents64 returns what the kernel believes is present in a directory, attackers who can interfere with that path can create a false view of the file system. Rootkits and other stealth mechanisms may try to filter directory entries so that chosen files or directories disappear from standard listings while still existing on disk.
How Security Tools Use It
Security products often watch directory enumeration because it is a common precursor to suspicious activity. A burst of listing activity can indicate reconnaissance, recursive discovery, or malware preparing to find targets and persistence locations. The system call is therefore useful both for visibility into normal activity and for spotting deviations from normal file access patterns.
In defenders’ hands, monitoring getdents64 is most valuable when combined with process lineage, file modification events, and later execution or persistence indicators. Enumeration alone is not proof of compromise, but it can strengthen a timeline by showing which processes asked the kernel to reveal directory contents, and when.
Compromise and Visibility Failure Modes
The main security concern is not the system call itself, but the way malicious code can abuse or tamper with the directory view it provides. If a process hooks or filters getdents64 results, analysts may miss files that would otherwise reveal malware, unauthorized tooling, or hidden persistence artefacts. That can slow detection and make incident scoping incomplete.
For defenders, the key failure mode is a mismatch between the expected directory contents and what user space actually sees. If enumeration, filesystem metadata, and independent inspection methods do not agree, that inconsistency can be a sign that something in the visibility chain has been subverted.
Risk and Threat Considerations
Directory enumeration APIs are attractive to stealth malware because they influence what operators and tooling can see. If getdents64 is hooked, filtered, or otherwise manipulated, hidden files can evade routine inspection and delay discovery of a rootkit, loader, or persistence artefact.
Failure mechanism: A compromised kernel path or injected user-space shim suppresses selected directory entries, so normal listings no longer reflect the true on-disk state.
Impact: Investigators may miss malicious files, undercount affected hosts, or draw the wrong conclusion about whether a system is clean after remediation.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5, CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1033 — System Owner/User Discovery | Directory enumeration is a discovery step used to inspect visible files and directories. |
| Recommendation — Map repeated directory enumeration to discovery activity and correlate it with suspicious process behavior. | ||
| NIST SP 800-53 Rev 5 | AU-6 — Audit Record Review, Analysis, and Reporting | Monitoring directory access depends on review and analysis of system activity records. |
| Recommendation — Review process and filesystem audit data to detect abnormal enumeration and visibility tampering. | ||
| CIS Controls v8 | CIS-8 — Audit Log Management | Directory enumeration monitoring relies on capturing and retaining relevant system activity logs. |
| CIS-13 — Network Monitoring and Defense | Security monitoring of suspicious host activity benefits from correlated detection and alerting. | |
| Recommendation — Collect and retain endpoint logs that can show anomalous directory enumeration behavior. Correlate host telemetry with alerting to spot stealthy file-enumeration patterns. | ||
| NIST CSF 2.0 | DE.CM-01 — Monitoring for Unusual Events | Unexpected directory listing behavior is an observable security event that merits monitoring. |
| Recommendation — Monitor for unusual enumeration activity that suggests concealment or compromise. | ||
Practitioner Guidance
What to watch for: Treat inconsistent directory views as a signal worth investigating, especially when a file appears in one tool but not another, or when standard enumeration disagrees with lower-level inspection. Cross-check the result with trusted utilities and, where possible, with offline or out-of-band analysis.
Practitioner note: getdents64 is best understood as a visibility primitive, not a security control. Its value to defenders comes from correlation, process context, and integrity checks around the file system view, not from the call itself.
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org