CWE-61: UNIX Symbolic Link (Symlink) Following

What is CWE-61?

CWE-61 is UNIX Symbolic Link (Symlink) Following. The flaw arises when the product insufficiently accounts for a file or directory being a symbolic link that resolves outside the intended control sphere, allowing an attacker to make the product operate on unauthorized files. The database currently holds 68 vulnerabilities mapped to CWE-61 and 1 of them are in the CISA Known Exploited Vulnerabilities catalog.

OWASP TOP 10:2025 RANK1 — A01:2025 — Broken Access Control
Related CVES (365 days)68
AbstractionCompound
Likelihood of exploitHigh

Vulnerabilities mapped to CWE-61

68 vulnerabilities209% increase year over year

Vulnerabilities in CISA KEV for CWE-61

1 vulnerabilities

Official definition

ByMitre CWE

The product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. This could allow an attacker to cause the product to operate on unauthorized files.

A product that allows UNIX symbolic links (symlink) as part of paths whether in internal code or through user input can allow an attacker to spoof the symbolic link and traverse the file system to unintended locations or access arbitrary files. The symbolic link can permit an attacker to read/write/corrupt a file that they originally did not have permissions to access.

Detailed description

A product may allow symlinks to participate in paths supplied through internal code or user input. If an attacker can create, replace, or control a symlink before the product uses the path, the link may resolve outside the intended location and enable file-system traversal or access to arbitrary files. Depending on the operation, the product may read, write, or corrupt data that the attacker could not otherwise access; the risk is especially significant for privileged programs and temporary directories that can be manipulated.

Characteristics

This weakness occurs when a path can contain a symlink but the product does not adequately validate the location to which the link resolves. An attacker can spoof or replace the link so that the product operates outside its intended control sphere, particularly during temporary-file handling, privileged operations, backup or archive processing, and error handling. The resulting operation may read, modify, or corrupt files without the attacker's direct authorization.

Common consequences

The primary impacts are confidentiality and integrity. An attacker may read files or directories that should be inaccessible, or modify files and directories, including overwriting, appending to, or corrupting arbitrary files.

ImpactScopeExplanation
Read Files or Directories, Modify Files or DirectoriesConfidentiality, Integrity-

Risk mitigations

  • Restrict temporary storage: When a program creates a temporary directory for files or links, restrict access to that directory so attackers cannot manipulate its contents.
  • Apply least privilege and separation of privilege: Limit access rights and deny access to files where possible, reducing the ability to replace them with links to sensitive files. Use sound compartmentalization to create protected, trusted areas of the system.
  1. ImplementationSymbolic link attacks often occur when a program creates a tmp directory that stores files/links. Access to the directory should be restricted to the program as to prevent attackers from manipulating the files.
  2. Separation of Privilege · Architecture and DesignFollow the principle of least privilege when assigning access rights to entities in a software system. 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.

Detection methods

Automated static analysis, commonly called Static Application Security Testing or SAST, can identify some instances by analyzing source or compiled code without execution. It typically models data flow and control flow, then searches for potentially vulnerable patterns connecting input sources to sinks where data reaches the operating system or another external component. The record describes this as capable of finding some instances, not as a complete detection method.

MethodApproachEffectiveness
Automated Static AnalysisAutomated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)-

Representative vulnerabilities

The following are representative examples from the record, not an exhaustive list:

  • CVE-1999-1386: Some Perl versions follow symlinks with the -e option, allowing local users to overwrite arbitrary files.
  • CVE-2000-1178: A text editor follows symlinks while creating a rescue copy, allowing local users to overwrite other users' files.
  • CVE-2004-0217: An antivirus updater allows arbitrary files to be created or appended to through a symlink attack on a logfile.
  • CVE-2000-0972: A setuid product permits file reading by replacing an edited file with a symlink to the target and exposing the result in parsing error messages.
  • CVE-2005-1879 and CVE-2005-1880: Second-order symlink vulnerabilities.
  • CVE-2015-3629: A Libcontainer component in Docker Engine allows local users to escape containerization and write to an arbitrary host file through a symlink in an image.
  • CVE-2020-26277: A MySQL database deployment tool processes a malicious tarball containing symlinks outside the target, which leads to execution after unpacking.
  • CVE-2021-21272: A Zip Slip vulnerability in an OCI registry product allows writing outside the intended directory through symlinks or hard links in a gzipped tarball.
  • The record also lists CVE-2003-0517, CVE-2004-0689, CVE-2005-1916, and CVE-2005-0824 as related examples involving file overwriting, a symlink in a Python program, or a signal-triggered dump that follows symlinks.

Below are representative vulnerabilities related to this CWE, prioritized by severity.

Sources (2)

CWE™ Program, operated by The MITRE Corporation. Copyright © 2006–2026, The MITRE Corporation. The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. CWE Terms of Use.

Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.