Logo
-

Byte Open Security

(ByteOS Network)

Log In

Sign Up

ByteOS

Security
Vulnerability Details
Registries
Custom Views
Weaknesses
Attack Patterns
Filters & Tools
CWE-59:Improper Link Resolution Before File Access ('Link Following')
Weakness ID:59
Version:v4.17
Weakness Name:Improper Link Resolution Before File Access ('Link Following')
Vulnerability Mapping:Allowed
Abstraction:Base
Structure:Simple
Status:Draft
Likelihood of Exploit:Medium
DetailsContent HistoryObserved CVE ExamplesReports
▼Description

The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.

▼Extended Description

▼Alternate Terms
insecure temporary file

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.


Zip Slip

"Zip slip" is an attack that uses file archives (e.g., ZIP, tar, rar, etc.) that contain filenames with path traversal sequences that cause the files to be written outside of the directory under which the archive is expected to be extracted [REF-1282]. It is most commonly used for relative path traversal (CWE-23) and link following (CWE-59).

▼Relationships
Relevant to the view"Research Concepts - (1000)"
NatureMappingTypeIDName
▼Memberships
NatureMappingTypeIDName
▼Tags
NatureMappingTypeIDName
▼Relevant To View
▼Background Detail

Soft links are a UNIX term that is synonymous with simple shortcuts on Windows-based platforms.

▼Common Consequences
ScopeLikelihoodImpactNote
ConfidentialityIntegrityAccess ControlN/ARead Files or DirectoriesModify Files or DirectoriesBypass Protection Mechanism

An attacker may be able to traverse the file system to unintended locations and read or overwrite the contents of unexpected files. If the files are used for a security mechanism then an attacker may be able to bypass the mechanism.

OtherN/AExecute Unauthorized Code or Commands

Windows simple shortcuts, sometimes referred to as soft links, can be exploited remotely since a ".LNK" file can be uploaded like a normal file. This can enable remote execution.

Scope: Confidentiality, Integrity, Access Control
Likelihood: N/A
Impact: Read Files or Directories, Modify Files or Directories, Bypass Protection Mechanism
Note:

An attacker may be able to traverse the file system to unintended locations and read or overwrite the contents of unexpected files. If the files are used for a security mechanism then an attacker may be able to bypass the mechanism.

Scope: Other
Likelihood: N/A
Impact: Execute Unauthorized Code or Commands
Note:

Windows simple shortcuts, sometimes referred to as soft links, can be exploited remotely since a ".LNK" file can be uploaded like a normal file. This can enable remote execution.

▼Potential Mitigations
Phase:Architecture and Design
Mitigation ID: MIT-48.1
Strategy: Separation of Privilege
Effectiveness:
Description:

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.

Note:

▼Modes Of Introduction
Phase: Implementation
Note:

REALIZATION: This weakness is caused during implementation of an architectural security tactic.

▼Applicable Platforms
Languages
Class: Not Language-Specific(Undetermined Prevalence)
Operating System
Class: Windows(Sometimes Prevalence)
Class: Unix(Often Prevalence)
▼Demonstrative Examples
▼Observed Examples
ReferenceDescription
CVE-1999-1386
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.
CVE-2000-1178
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.
CVE-2004-0217
Antivirus update allows local users to create or append to arbitrary files via a symlink attack on a logfile.
CVE-2003-0517
Symlink attack allows local users to overwrite files.
CVE-2004-0689
Window manager does not properly handle when certain symbolic links point to "stale" locations, which could allow local users to create or truncate arbitrary files.
CVE-2005-1879
Second-order symlink vulnerabilities
CVE-2005-1880
Second-order symlink vulnerabilities
CVE-2005-1916
Symlink in Python program
CVE-2000-0972
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.
CVE-2005-0824
Signal causes a dump that follows symlinks.
CVE-2001-1494
Hard link attack, file overwrite; interesting because program checks against soft links
CVE-2002-0793
Hard link and possibly symbolic link following vulnerabilities in embedded operating system allow local users to overwrite arbitrary files.
CVE-2003-0578
Server creates hard links and unlinks files as root, which allows local users to gain privileges by deleting and overwriting arbitrary files.
CVE-1999-0783
Operating system allows local users to conduct a denial of service by creating a hard link from a device special file to a file on an NFS file system.
CVE-2004-1603
Web hosting manager follows hard links, which allows local users to read or modify arbitrary files.
CVE-2004-1901
Package listing system allows local users to overwrite arbitrary files via a hard link attack on the lockfiles.
CVE-2005-1111
Hard link race condition
CVE-2000-0342
Mail client allows remote attackers to bypass the user warning for executable attachments such as .exe, .com, and .bat by using a .lnk file that refers to the attachment, aka "Stealth Attachment."
CVE-2001-1042
FTP server allows remote attackers to read arbitrary files and directories by uploading a .lnk (link) file that points to the target file.
CVE-2001-1043
FTP server allows remote attackers to read arbitrary files and directories by uploading a .lnk (link) file that points to the target file.
CVE-2005-0587
Browser allows remote malicious web sites to overwrite arbitrary files by tricking the user into downloading a .LNK (link) file twice, which overwrites the file that was referenced in the first .LNK file.
CVE-2001-1386
".LNK." - .LNK with trailing dot
CVE-2003-1233
Rootkits can bypass file access restrictions to Windows kernel directories using NtCreateSymbolicLinkObject function to create symbolic link
CVE-2002-0725
File system allows local attackers to hide file usage activities via a hard link to the target file, which causes the link to be recorded in the audit trail instead of the target file.
CVE-2003-0844
Web server plugin allows local users to overwrite arbitrary files via a symlink attack on predictable temporary filenames.
CVE-2015-3629
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.
CVE-2021-21272
"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.
CVE-2020-27833
"Zip Slip" vulnerability in container management product allows writing arbitrary files outside intended directory via a container image (.tar format) with filenames that are symbolic links that point to other files within the same tar file; however, the files being pointed to can also be symbolic links to destinations outside the intended directory, bypassing the initial check.
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.
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.
Reference: CVE-2004-0217
Description:
Antivirus update allows local users to create or append to arbitrary files via a symlink attack on a logfile.
Reference: CVE-2003-0517
Description:
Symlink attack allows local users to overwrite files.
Reference: CVE-2004-0689
Description:
Window manager does not properly handle when certain symbolic links point to "stale" locations, which could allow local users to create or truncate arbitrary files.
Reference: CVE-2005-1879
Description:
Second-order symlink vulnerabilities
Reference: CVE-2005-1880
Description:
Second-order symlink vulnerabilities
Reference: CVE-2005-1916
Description:
Symlink in Python program
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.
Reference: CVE-2005-0824
Description:
Signal causes a dump that follows symlinks.
Reference: CVE-2001-1494
Description:
Hard link attack, file overwrite; interesting because program checks against soft links
Reference: CVE-2002-0793
Description:
Hard link and possibly symbolic link following vulnerabilities in embedded operating system allow local users to overwrite arbitrary files.
Reference: CVE-2003-0578
Description:
Server creates hard links and unlinks files as root, which allows local users to gain privileges by deleting and overwriting arbitrary files.
Reference: CVE-1999-0783
Description:
Operating system allows local users to conduct a denial of service by creating a hard link from a device special file to a file on an NFS file system.
Reference: CVE-2004-1603
Description:
Web hosting manager follows hard links, which allows local users to read or modify arbitrary files.
Reference: CVE-2004-1901
Description:
Package listing system allows local users to overwrite arbitrary files via a hard link attack on the lockfiles.
Reference: CVE-2005-1111
Description:
Hard link race condition
Reference: CVE-2000-0342
Description:
Mail client allows remote attackers to bypass the user warning for executable attachments such as .exe, .com, and .bat by using a .lnk file that refers to the attachment, aka "Stealth Attachment."
Reference: CVE-2001-1042
Description:
FTP server allows remote attackers to read arbitrary files and directories by uploading a .lnk (link) file that points to the target file.
Reference: CVE-2001-1043
Description:
FTP server allows remote attackers to read arbitrary files and directories by uploading a .lnk (link) file that points to the target file.
Reference: CVE-2005-0587
Description:
Browser allows remote malicious web sites to overwrite arbitrary files by tricking the user into downloading a .LNK (link) file twice, which overwrites the file that was referenced in the first .LNK file.
Reference: CVE-2001-1386
Description:
".LNK." - .LNK with trailing dot
Reference: CVE-2003-1233
Description:
Rootkits can bypass file access restrictions to Windows kernel directories using NtCreateSymbolicLinkObject function to create symbolic link
Reference: CVE-2002-0725
Description:
File system allows local attackers to hide file usage activities via a hard link to the target file, which causes the link to be recorded in the audit trail instead of the target file.
Reference: CVE-2003-0844
Description:
Web server plugin allows local users to overwrite arbitrary files via a symlink attack on predictable temporary filenames.
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.
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.
Reference: CVE-2020-27833
Description:
"Zip Slip" vulnerability in container management product allows writing arbitrary files outside intended directory via a container image (.tar format) with filenames that are symbolic links that point to other files within the same tar file; however, the files being pointed to can also be symbolic links to destinations outside the intended directory, bypassing the initial check.
▼Affected Resources
  • File or Directory
▼Functional Areas
  • File Processing
▼Weakness Ordinalities
OrdinalityDescription
Resultant
N/A
Ordinality: Resultant
Description:
N/A
▼Detection Methods
Automated Static Analysis - Binary or Bytecode
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Cost effective for partial coverage: ```

Bytecode Weakness Analysis - including disassembler + source code weakness analysis

Effectiveness:SOAR Partial
Note:

N/A


Manual Static Analysis - Binary or Bytecode
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Cost effective for partial coverage: ```

Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies

Effectiveness:SOAR Partial
Note:

N/A


Dynamic Analysis with Automated Results Interpretation
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Cost effective for partial coverage: ```

Web Application Scanner Web Services Scanner Database Scanners

Effectiveness:SOAR Partial
Note:

N/A


Dynamic Analysis with Manual Results Interpretation
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Cost effective for partial coverage: ```

Fuzz Tester Framework-based Fuzzer

Effectiveness:SOAR Partial
Note:

N/A


Manual Static Analysis - Source Code
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Highly cost effective: ```

Focused Manual Spotcheck - Focused manual analysis of source Manual Source Code Review (not inspections)

Effectiveness:High
Note:

N/A


Automated Static Analysis - Source Code
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Cost effective for partial coverage: ```

Source code Weakness Analyzer Context-configured Source Code Weakness Analyzer

Effectiveness:SOAR Partial
Note:

N/A


Architecture or Design Review
Detection Method ID:
Description:

According to SOAR, the following detection techniques may be useful:

``` Highly cost effective: ```

Formal Methods / Correct-By-Construction ``` Cost effective for partial coverage: ```

Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Effectiveness:High
Note:

N/A

▼Vulnerability Mapping Notes
Usage:Allowed
Reason:Acceptable-Use
Rationale:

This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.

Comments:

Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

Suggestions:
▼Notes
Theoretical

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 potential factors are race conditions, permissions, and predictability.

N/A

▼Taxonomy Mappings
Taxonomy NameEntry IDFitEntry Name
PLOVERN/AN/ALink Following
CERT C Secure CodingFIO02-CN/ACanonicalize path names originating from untrusted sources
CERT C Secure CodingPOS01-CN/ACheck for the existence of links when dealing with files
SEI CERT Perl Coding StandardFIO01-PLCWE More SpecificDo not operate on files that can be modified by untrusted users
Software Fault PatternsSFP18N/ALink in resource name resolution
Taxonomy Name: PLOVER
Entry ID: N/A
Fit: N/A
Entry Name: Link Following
Taxonomy Name: CERT C Secure Coding
Entry ID: FIO02-C
Fit: N/A
Entry Name: Canonicalize path names originating from untrusted sources
Taxonomy Name: CERT C Secure Coding
Entry ID: POS01-C
Fit: N/A
Entry Name: Check for the existence of links when dealing with files
Taxonomy Name: SEI CERT Perl Coding Standard
Entry ID: FIO01-PL
Fit: CWE More Specific
Entry Name: Do not operate on files that can be modified by untrusted users
Taxonomy Name: Software Fault Patterns
Entry ID: SFP18
Fit: N/A
Entry Name: Link in resource name resolution
▼Related Attack Patterns
IDName
CAPEC-132
Symlink Attack
CAPEC-17
Using Malicious Files
CAPEC-35
Leverage Executable Code in Non-Executable Files
CAPEC-76
Manipulating Web Input to File System Calls
ID: CAPEC-132
Name: Symlink Attack
ID: CAPEC-17
Name: Using Malicious Files
ID: CAPEC-35
Name: Leverage Executable Code in Non-Executable Files
ID: CAPEC-76
Name: Manipulating Web Input to File System Calls
▼References
Reference ID: REF-62
Title: The Art of Software Security Assessment
Author: Mark Dowd, John McDonald, Justin Schuh
Section: Chapter 9, "Symbolic Link Attacks", Page 518
Publication:
Publisher:Addison Wesley
Edition:1st Edition
URL:
URL Date:
Day:N/A
Month:N/A
Year:2006
Reference ID: REF-1282
Title: Zip Slip Vulnerability
Author: Snyk
Section:
Publication:
Publisher:
Edition:
URL:https://security.snyk.io/research/zip-slip-vulnerability
URL Date:
Day:05
Month:06
Year:2018
Details not found