Join our Newsletter — 33% off our NHI Course
Home› Glossary› Architecture & Implementation› UNIX Hard Link
Architecture & Implementation

UNIX Hard Link

← Back to Glossary
By NHI Mgmt Group Updated October 17, 2026 Domain: Architecture & Implementation

UNIX Hard Link is a directory entry that points to the same underlying file data as another name on the same filesystem. If applications trust file names instead of checking the target, attackers can use hard links to overwrite or access sensitive files. Defenders should verify inode and ownership before acting on files.

A UNIX hard link is not a copy of a file, it is another directory entry for the same inode. That means two or more names can reference the same underlying data, so changes through any name affect the same file object.

This matters because security decisions based only on a pathname can be fooled. If software assumes a file name uniquely identifies a safe target, the link relationship can redirect that trust to a different file on the same filesystem.

Hard links are dangerous when privileged code opens, truncates, writes, or deletes files without verifying what the name resolves to. A process may think it is handling an ordinary temporary or working file, while actually acting on a sensitive target that shares the same inode.

The classic failure mode is race condition through link following, where code checks a path too early or too narrowly and then performs a privileged action on the wrong object. Hard links are especially relevant in local privilege escalation and file overwrite scenarios because they exploit the gap between name-based checks and object-based reality.

Defenders should treat hard links as part of the broader class of path confusion problems, and they should verify inode, ownership, permissions, and expected file type before trusting any file that a privileged process will modify.

A hard link points directly to the same inode, while a symbolic link stores a separate pathname that is resolved at access time. That difference changes both behavior and risk: hard links stay valid as long as the inode exists on the same filesystem, while symbolic links can cross pathname boundaries and point elsewhere.

Because hard links are tied to filesystem semantics rather than string resolution, they can survive simple pathname-based checks. That is why secure file-handling code must reason about the underlying object, not just the text of the path supplied by a user or another process.

In practice, hard links also have operational limits that matter for security review. They usually cannot span filesystems and they do not create a new copy of the content, so any control that assumes “new name means new file” is incomplete.

Hard links become a security concern wherever software creates, opens, or replaces files in locations that an attacker can influence. Temporary files, log files, spool directories, backup workflows, and privileged maintenance jobs are common places where link confusion can become exploitable.

Secure handling starts with object-aware validation. A privileged program should not rely on the filename alone; it should verify that the file it is about to use is the expected inode, belongs to the expected owner, and has not been substituted through a link relationship.

When the filesystem design or application workflow makes that verification difficult, the safer pattern is to reduce the privilege of the process, isolate writable locations, and avoid operating on attacker-controlled paths altogether.

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 CIS Controls v8, NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS-3 — Data ProtectionHard links can redirect privileged file operations onto sensitive data.
Recommendation — Harden file handling paths and restrict write access to sensitive directories.
NIST SP 800-53 Rev 5SI-10 — Information Input ValidationThe issue arises when file paths and targets are not validated before use.
AC-6 — Least PrivilegePrivilege amplifies the impact of link-based file confusion.
Recommendation — Validate file targets and reject unsafe path-based inputs before privileged file operations. Limit file-handling privileges so a mistaken path cannot overwrite high-value files.
OWASP ASVSV15 — Secure Coding and ArchitectureSecure file access requires object-aware handling and defensive design against link confusion.
Recommendation — Design file operations to verify the target object, not just the submitted name.
MITRE ATT&CKT1222 — File and Directory Permissions ModificationAdversaries abuse filesystem semantics to alter access to files and directories.
Recommendation — Map suspicious file-system access patterns to filesystem abuse techniques and hunt for privilege escalation.

Practitioner Guidance

What to watch for: Review any code or script that runs with elevated privileges and touches files in shared, temporary, or user-influenced directories. The key question is whether the program trusts a path string more than the underlying file object.

Practitioner takeaway: If a process can be tricked into acting on the wrong inode, the security bug is usually in the file-handling logic, not the link itself. Use object-level checks and conservative filesystem access patterns wherever privilege is involved.

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.

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