CWE
Home > CWE List > CWE-59 Individual Dictionary Definition (Draft 9)   View the CWE List

CWE-59 Individual Dictionary Definition (Draft 9)

Failure to Resolve Links Before File Access (aka 'Link Following')
Weakness ID
Status: Draft

59 (Weakness Base)

Description

Summary

Link following weaknesses involve insufficient protection against links or shortcuts that can resolve to a file other than the one that was intended.

Alternate Terms

Some people use the phrase "insecure temporary file" when referring to a link following weakness, but other weaknesses can produce insecure temporary files without any symlink involvement at all.

Functional Area

File processing, temporary files

Likelihood of Exploit

Low to Medium

Weakness Ordinality

Resultant (Weakness is typically related to the presence of some other weaknesses)

Causal Nature

Explicit (This is an explicit weakness resulting from behavior of the developer)

Affected Resource

File/Directory

Potential Mitigations

Follow the principle of least privilege when assigning access rights to files. Denying access to a file can prevent an attacker from replacing that file with a link to a sensitive file. Ensure good compartmentalization in the system to provide protected areas that can be trusted.

Context Notes

Link following vulnerabilities are Multi-factor Vulnerabilities (MFV). They are the combination of multiple elements: file or directory permissions, filename predictability, race conditions, and in some cases, a design limitation in which there is no mechanism for performing atomic file creation operations.

Some potentials factors are race conditions, permissions, predictability.

This is not OS specific.

Windows soft links can be exploited remotely since a ".LNK" file can be uploaded like a normal file.

Research Gaps

UNIX hard links, and Windows hard/soft links are under-studied and under-reported.

Relationships
NatureTypeIDName
ChildOfWeakness ClassWeakness ClassWeakness Class21Pathname Traversal and Equivalence Errors
ChildOfCategoryCategory632Weaknesses that Affect Files or Directories
ChildOfViewView635
ParentOfCategoryCategory60UNIX Path Link Problems
ParentOfCategoryCategory63Windows Path Link Problems
CanAlsoBeWeakness BaseWeakness BaseWeakness Base363Race Condition Enabling Link Following
Source Taxonomies

PLOVER - Link Following

Applicable Platforms

All

Related Attack Patterns
CAPEC-IDAttack Pattern Name
35Leverage Executable Code in Nonexecutable Files
17Accessing, Modifying or Executing Executable Files
76Manipulating Input to File System Calls
Page Last Updated: April 22, 2008