{"@ID": "61", "@Name": "UNIX Symbolic Link (Symlink) Following", "@Abstraction": "Compound", "@Structure": "Composite", "@Status": "Incomplete", "Description": "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.", "Related_Weaknesses": {"Related_Weakness": [{"@Nature": "ChildOf", "@CWE_ID": "59", "@View_ID": "1000", "@Ordinal": "Primary"}, {"@Nature": "Requires", "@CWE_ID": "362", "@View_ID": "1000"}, {"@Nature": "Requires", "@CWE_ID": "340", "@View_ID": "1000"}, {"@Nature": "Requires", "@CWE_ID": "386", "@View_ID": "1000"}, {"@Nature": "Requires", "@CWE_ID": "732", "@View_ID": "1000"}]}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Resultant"}}, "Applicable_Platforms": {"Language": {"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}}, "Alternate_Terms": {"Alternate_Term": [{"Term": "Symlink following"}, {"Term": "symlink vulnerability"}]}, "Modes_Of_Introduction": {"Introduction": {"Phase": "Implementation", "Note": "These are typically reported for temporary files or privileged programs."}}, "Likelihood_Of_Exploit": "High", "Common_Consequences": {"Consequence": {"Scope": ["Confidentiality", "Integrity"], "Impact": ["Read Files or Directories", "Modify Files or Directories"], "Note": "A product that allows a symbolic link (symlink) as part of a path - 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. An attacker could read, write, or /corrupt a file that they originally did not have permissions to access directly."}}, "Detection_Methods": {"Detection_Method": {"@Detection_Method_ID": "DM-14", "Method": "Automated Static Analysis", "Description": "Automated 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.)"}}, "Potential_Mitigations": {"Mitigation": [{"Phase": "Implementation", "Description": "Symbolic 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."}, {"@Mitigation_ID": "MIT-48.1", "Phase": "Architecture and Design", "Strategy": "Separation of Privilege", "Description": {"xhtml:p": ["Follow 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."], "#text_blocks": ["Follow 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."]}}]}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-1999-1386", "Description": "Some versions of Perl follow symbolic links when running with the -e option, which allows local users to overwrite arbitrary files via a symlink attack.", "Link": "https://www.cve.org/CVERecord?id=CVE-1999-1386"}, {"Reference": "CVE-2000-1178", "Description": "Text editor follows symbolic links when creating a rescue copy during an abnormal exit, which allows local users to overwrite the files of other users.", "Link": "https://www.cve.org/CVERecord?id=CVE-2000-1178"}, {"Reference": "CVE-2004-0217", "Description": "Antivirus update allows local users to create or append to arbitrary files via a symlink attack on a logfile.", "Link": "https://www.cve.org/CVERecord?id=CVE-2004-0217"}, {"Reference": "CVE-2003-0517", "Description": "Symlink attack allows local users to overwrite files.", "Link": "https://www.cve.org/CVERecord?id=CVE-2003-0517"}, {"Reference": "CVE-2004-0689", "Description": "Possible interesting example", "Link": "https://www.cve.org/CVERecord?id=CVE-2004-0689"}, {"Reference": "CVE-2005-1879", "Description": "Second-order symlink vulnerabilities", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-1879"}, {"Reference": "CVE-2005-1880", "Description": "Second-order symlink vulnerabilities", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-1880"}, {"Reference": "CVE-2005-1916", "Description": "Symlink in Python program", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-1916"}, {"Reference": "CVE-2000-0972", "Description": "Setuid product allows file reading by replacing a file being edited with a symlink to the targeted file, leaking the result in error messages when parsing fails.", "Link": "https://www.cve.org/CVERecord?id=CVE-2000-0972"}, {"Reference": "CVE-2005-0824", "Description": "Signal causes a dump that follows symlinks.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-0824"}, {"Reference": "CVE-2015-3629", "Description": "A Libcontainer used in Docker Engine allows local users to escape containerization and write to an arbitrary file on the host system via a symlink attack in an image when respawning a container.", "Link": "https://www.cve.org/CVERecord?id=CVE-2015-3629"}, {"Reference": "CVE-2020-26277", "Description": "In a MySQL database deployment tool, users may craft a maliciously packaged tarball that contains symlinks to files external to the target and once unpacked, will execute.", "Link": "https://www.cve.org/CVERecord?id=CVE-2020-26277"}, {"Reference": "CVE-2021-21272", "Description": "\"Zip Slip\" vulnerability in Go-based Open Container Initiative (OCI) registries product allows writing arbitrary files outside intended directory via symbolic links or hard links in a gzipped tarball.", "Link": "https://www.cve.org/CVERecord?id=CVE-2021-21272"}]}, "Functional_Areas": {"Functional_Area": "File Processing"}, "Affected_Resources": {"Affected_Resource": "File or Directory"}, "Taxonomy_Mappings": {"Taxonomy_Mapping": {"@Taxonomy_Name": "PLOVER", "Entry_Name": "UNIX symbolic link following"}}, "Related_Attack_Patterns": {"Related_Attack_Pattern": {"@CAPEC_ID": "27"}}, "References": {"Reference": [{"@External_Reference_ID": "REF-493"}, {"@External_Reference_ID": "REF-494"}, {"@External_Reference_ID": "REF-62", "@Section": "Chapter 9, \"Symbolic Link Attacks\", Page 518"}]}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This is a well-known Composite of multiple weaknesses that must all occur simultaneously, although it is attack-oriented in nature.", "Comments": "While attack-oriented composites are supported in CWE, they have not been a focus of research. There is a chance that future research or CWE scope clarifications will change or deprecate them. Perform root-cause analysis to determine which weaknesses allow symlink following to occur, and map to those weaknesses. For example, predictable file names might be intended functionality, but creation in a directory with insecure permissions might not.", "Reasons": {"Reason": {"@Type": "Other"}}}, "Notes": {"Note": {"@Type": "Research Gap", "xhtml:p": ["Symlink vulnerabilities are regularly found in C and shell programs, but all programming languages can have this problem. Even shell programs are probably under-reported.", "\"Second-order symlink vulnerabilities\" may exist in programs that invoke other programs that follow symlinks. They are rarely reported but are likely to be fairly common when process invocation is used [REF-493]."], "#text_blocks": ["Symlink vulnerabilities are regularly found in C and shell programs, but all programming languages can have this problem. Even shell programs are probably under-reported.", "\"Second-order symlink vulnerabilities\" may exist in programs that invoke other programs that follow symlinks. They are rarely reported but are likely to be fairly common when process invocation is used [REF-493]."]}}, "Content_History": {"Submission": {"Submission_Name": "PLOVER", "Submission_Date": "2006-07-19", "Submission_Version": "Draft 3", "Submission_ReleaseDate": "2006-07-19"}, "Modification": [{"Modification_Name": "Eric Dalci", "Modification_Organization": "Cigital", "Modification_Date": "2008-07-01", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Time_of_Introduction"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-09-08", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Relationships, Observed_Example, Other_Notes, Research_Gaps, Taxonomy_Mappings, Weakness_Ordinalities"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-10-14", "Modification_Version": "1.0.1", "Modification_ReleaseDate": "2008-10-14", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-07-27", "Modification_Version": "1.5", "Modification_ReleaseDate": "2009-07-27", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-01", "Modification_Version": "1.13", "Modification_ReleaseDate": "2011-06-01", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-05-11", "Modification_Version": "2.2", "Modification_ReleaseDate": "2012-05-15", "Modification_Comment": "updated Observed_Examples, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-10-30", "Modification_Version": "2.3", "Modification_ReleaseDate": "2012-10-30", "Modification_Comment": "updated Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2014-06-23", "Modification_Version": "2.7", "Modification_ReleaseDate": "2014-06-23", "Modification_Comment": "updated Modes_of_Introduction, Other_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-11-08", "Modification_Version": "3.0", "Modification_ReleaseDate": "2017-11-08", "Modification_Comment": "updated Applicable_Platforms, Causal_Nature, Likelihood_of_Exploit, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-04-28", "Modification_Version": "4.7", "Modification_ReleaseDate": "2022-04-28", "Modification_Comment": "updated Research_Gaps"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-10-13", "Modification_Version": "4.9", "Modification_ReleaseDate": "2022-10-13", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-01-31", "Modification_Version": "4.10", "Modification_ReleaseDate": "2023-01-31", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-09-09", "Modification_Version": "4.18", "Modification_ReleaseDate": "2025-09-09", "Modification_Comment": "updated Affected_Resources, Functional_Areas, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Detection_Factors, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2026-10-28", "Modification_Version": "5.0", "Modification_ReleaseDate": "2026-10-28", "Modification_Comment": "updated Common_Consequences, Description"}]}, "entry_type": "Weakness"}
