CWE-1386
Insecure Operation on Windows Junction / Mount Point
Description
The product opens a file or directory, but it does not properly prevent the name from being associated with a junction or mount point to a destination that is outside of the intended control sphere.
{"xhtml:p":["Depending on the intended action\n\t\t\t being performed, this could allow an\n\t\t\t attacker to cause the product to read,\n\t\t\t write, delete, or otherwise operate on\n\t\t\t unauthorized files.","In Windows, NTFS5 allows for file\n\t\t\t system objects called reparse points.\n\t\t\t Applications can create a hard link from one\n\t\t\t directory to another directory, called a\n\t\t\t junction point. They can also create a\n\t\t\t mapping from a directory to a drive letter,\n\t\t\t called a mount point. If a file is used by a\n\t\t\t privileged program, but it can be replaced\n\t\t\t with a hard link to a sensitive file (e.g.,\n\t\t\t AUTOEXEC.BAT), an attacker could escalate\n\t\t\t privileges. When the process opens the file,\n\t\t\t the attacker can assume the privileges of\n\t\t\t that process, tricking the privileged\n\t\t\t process to read, modify, or delete the\n\t\t\t sensitive file, preventing the program from\n\t\t\t accurately processing data. Note that one\n\t\t\t can also point to registries and\n\t\t\t semaphores."]}
Parent Weaknesses (ChildOf)
Common Consequences
Scope
Impact
Read Files or Directories
Scope
Impact
Modify Files or Directories
Scope
Impact
Modify Files or Directories
Potential Mitigations
When designing software that will have different rights than the executer, the software should check that files that it is interacting with are not improper hard links or mount points. One way to do this in Windows is to use the functionality embedded in the following command: "dir /al /s /b" or, in PowerShell, use LinkType as a filter. In addition, some software uses authentication via signing to ensure that the file is the correct one to use. Make checks atomic with the file action, otherwise a TOCTOU weakness (CWE-367) can be introduced.
CVE-2021-26426Privileged service allows attackers to delete unauthorized files using a directory junction, leading to arbitrary code execution as SYSTEM.
CVE-2020-0863By creating a mount point and hard links, an attacker can abuse a service to allow users arbitrary file read permissions.
CVE-2019-1161Chain: race condition (CWE-362) in anti-malware product allows deletion of files by creating a junction (CWE-1386) and using hard links during the time window in which a temporary file is created and deleted.
CVE-2014-0568Escape from sandbox for document reader by using a mountpoint [REF-1264]
Applicable Platforms
Security Training
Train your team to recognize and prevent security threats with our comprehensive security awareness program.
Start TrainingVulnerability Scanning
Discover vulnerabilities in your applications and infrastructure before attackers do.
Scan Now