Join our Newsletter — 33% off our NHI Course
Threats, Abuse & Incident Response

Filldir Function

← Back to Glossary
By NHI Mgmt Group Updated September 25, 2026 Domain: Threats, Abuse & Incident Response

A filldir function is the callback used during directory iteration to populate the list of entries returned to a process. If an attacker replaces that callback, they can filter out selected files or directories and return a modified directory listing that hides evidence from defenders.

What the Filldir Function Does

The filldir function is the callback a filesystem uses while walking a directory to hand entries back to the caller. It is a low-level part of directory iteration, so changing its behavior can directly alter what a process believes exists on disk.

That makes filldir a visibility mechanism rather than a policy control. It does not decide access rights on its own, but it does shape the integrity of directory listings that defenders, tools, and applications may trust.

Why Callback Tampering Matters

Because filldir sits in the path that assembles directory output, a malicious replacement can selectively omit files, suppress directories, or reorder what is returned. In practice, that can hide implant files, tools, staging paths, or traces of compromise without changing the underlying storage.

This is especially dangerous when responders rely on ordinary directory reads to confirm what is present. A modified callback can create a false sense of cleanliness while the filesystem contents remain intact underneath.

How It Relates to Rootkit-Style Hiding

Filldir abuse is commonly associated with rootkit techniques that intercept kernel-level file enumeration. The attacker is not necessarily deleting evidence, only preventing it from being reported through the expected interface.

That distinction matters because many investigative workflows assume enumeration is truthful. If the callback path is subverted, checksum checks, manual browsing, and automated inventory can all be misled unless they use an independent view of the filesystem state.

What Defenders Should Understand About Integrity

The main security issue is integrity of observation. If a listing can be filtered before it reaches user space, then “absence” in the output no longer proves absence on disk. The filldir path therefore becomes part of the trust boundary for host forensics and tamper detection.

When this mechanism is compromised, defenders need to treat directory output as potentially adversarial data. Corroborating evidence from kernel integrity checks, trusted tooling, or offline inspection becomes necessary before concluding that a system is clean.

Risk and Threat Considerations

Filldir tampering can hide malicious files, support persistence, and frustrate incident response by making key artifacts disappear from ordinary enumeration. The danger is not just concealment, but the downstream trust failure when analysts act on incomplete listings.

Failure mechanism: An attacker replaces or hooks the callback used during directory iteration, then filters the entries returned to user space so selected objects never appear in standard output.

Impact: Hidden executables, directories, or evidence can evade detection, delaying containment and enabling longer dwell time.

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 surface, NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, and ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKT1039 — Data from Local SystemDirectory enumeration and hiding files map to local-system discovery and concealment behavior.
Recommendation — Correlate unusual directory enumeration behavior with T1039 and validate results against alternate host views.
NIST CSF 2.0DE.CM-01 — Monitoring for Anomalies and EventsDirectory output tampering is a host-integrity anomaly that monitoring should surface.
Recommendation — Monitor for inconsistent filesystem views and alert when directory results diverge from trusted baselines.
NIST SP 800-53 Rev 5SI-7 — Software, Firmware, and Information IntegrityCallback tampering undermines the integrity of information presented by the system.
Recommendation — Validate host integrity so file-enumeration results cannot be trusted without corroboration.
CIS Controls v8CIS-8 — Audit Log ManagementHidden artifacts and altered listings complicate evidence collection and auditability.
Recommendation — Preserve and review logs so directory-hiding activity can be investigated with independent evidence.
ISO/IEC 27001:2022A.8.16 — Monitoring activitiesModified directory output is a monitoring and detection problem requiring trusted observation.
Recommendation — Use monitoring controls that can detect when observed filesystem results no longer match reality.

Practitioner Guidance

What to watch for: Treat unexpected gaps between different views of the same host, or listings that do not match other filesystem indicators, as a possible sign of callback tampering. Focus on integrity validation rather than assuming a clean directory listing is authoritative.

Practitioner takeaway: Use independent verification paths when directory enumeration is part of the evidence chain, especially on systems where kernel-level hiding is plausible.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 25, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org