Pidfd_getfd is a Linux system call that can duplicate a file descriptor from another process when access checks allow it. It is useful for process management, but it also becomes a high-risk primitive if a target process retains sensitive descriptors during a race window. Attackers can use it to copy authority, not just data.
How pidfd_getfd works
pidfd_getfd is a Linux process-to-process file descriptor duplication mechanism. It lets one process obtain a duplicate of another process’s open descriptor when the kernel’s access checks permit it, which makes it useful for controlled inspection, supervision, and process management.
The important security property is that the primitive transfers the same underlying authority carried by the original descriptor. That may include access to files, sockets, pipes, devices, or other kernel objects, so the call is not just moving data, it is moving the ability to act.
Why the primitive is security-sensitive
The call becomes sensitive because file descriptors often represent more privilege than their names suggest. A descriptor can encode access to a resource that the calling process could not open directly, especially when a target process has inherited privileged handles, temporary access, or long-lived connections.
That means pidfd_getfd can bypass assumptions that security is based only on the current process identity or pathname checks. If the kernel allows duplication at the wrong moment, the caller may gain access to a resource that was meant to remain confined to the target process.
Race windows and authority leakage
The highest risk appears when a target process retains sensitive descriptors during a race window, such as before cleanup, before privilege drop, or while handling transient operational state. In that period, an attacker who can interact with the process relationship may be able to copy authority before the opportunity closes.
This is especially dangerous when descriptors point to secrets-bearing resources, privileged IPC channels, management sockets, or files that were opened under stronger permissions than the attacker has. The copied descriptor can outlive the original trust assumption even if the target later closes it.
Operational boundaries and control expectations
In practice, pidfd_getfd should be treated as a privileged capability whose safe use depends on process isolation, descriptor hygiene, and careful lifecycle control. The call is most defensible when the target process intentionally exposes inspectable state and when sensitive descriptors are closed or revoked as soon as they are no longer required.
Because the primitive can copy authority, not merely content, defenders should think about which resources remain open at each stage of a process’s lifetime and whether those resources are acceptable to duplicate. The real question is not only whether the process is trusted, but whether its open handles are still safe to share.
Risk and Threat Considerations
pidfd_getfd is risky when an attacker can reach a process that still holds privileged or secret-bearing file descriptors, because the attacker may be able to duplicate access during a narrow timing window. That turns a temporary internal handle into a reusable external capability.
Failure mechanism: The security model fails when descriptor lifetime exceeds the period in which the process is supposed to retain elevated access, or when access checks allow duplication before sensitive handles are closed.
Impact: An attacker may inherit access to files, sockets, or other kernel objects, enabling data exposure, unauthorized actions, or lateral movement through a copied communication channel.
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, NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Descriptor access depends on controlled credentials and lifecycle discipline. |
| AC-6 — Least Privilege | pidfd_getfd can transfer authority, so access should be minimized. | |
| SI-4 — System Monitoring | The primitive is security-sensitive because misuse may indicate unauthorized authority transfer. | |
| Recommendation — Limit secret and credential exposure windows so privileged handles cannot be reused after they should expire. Restrict which processes can duplicate or inspect other processes' privileged resources. Monitor for unusual process handle duplication and suspicious cross-process access patterns. | ||
| NIST CSF 2.0 | PR.AA-05 — Identity Management, Authentication and Access Control | The term centers on access enforcement around process-held authority. |
| Recommendation — Enforce access checks on process relationships and sensitive resource delegation. | ||
| CIS Controls v8 | CIS-6 — Access Control Management | The subject is about constraining who can obtain or reuse access paths. |
| Recommendation — Remove or tightly govern any process capability that can duplicate privileged access. | ||
| MITRE ATT&CK | T1212 — Exploitation for Credential Access | Attackers may use the primitive to copy authority from a more privileged process. |
| Recommendation — Hunt for process interactions that expose transferable access rights or credential-bearing handles. | ||
Practitioner Guidance
Why practitioners should care: Treat descriptor ownership as part of process security, not as an implementation detail. If a process can hold a sensitive handle, then the timing of handle release matters as much as the permissions on the underlying object.
What to watch for: Pay special attention to processes that run with mixed privilege, supervise child processes, or bridge trust zones. Those are the situations where a retained descriptor can become an unintended access path if lifecycle cleanup is incomplete.
Practitioner takeaway: Minimize the number of descriptors that remain open across privilege boundaries, and assume that any descriptor still live during a race window may be a transferable security asset.
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 October 30, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org