The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize absolute path sequences such as "/abs/path" that can resolve to a location that is outside of that directory.
This allows attackers to traverse the file system to access files or directories that are outside of the restricted directory.
Threat Mapped score: 0.0
Industry: Finiancial
Threat priority: Unclassified
CVE: CVE-2022-31503
Python package constructs filenames using an unsafe os.path.join call on untrusted input, allowing absolute path traversal because os.path.join resets the pathname to an absolute path that is specified as part of the input.
CVE: CVE-2002-1345
Multiple FTP clients write arbitrary files via absolute paths in server responses
CVE: CVE-2001-1269
ZIP file extractor allows full path
CVE: CVE-2002-1818
Path traversal using absolute pathname
CVE: CVE-2002-1913
Path traversal using absolute pathname
CVE: CVE-2005-2147
Path traversal using absolute pathname
CVE: CVE-2000-0614
Arbitrary files may be overwritten via compressed attachments that specify absolute path names for the decompressed output.
CVE: CVE-1999-1263
Mail client allows remote attackers to overwrite arbitrary files via an e-mail message containing a uuencoded attachment that specifies the full pathname for the file to be modified.
CVE: CVE-2003-0753
Remote attackers can read arbitrary files via a full pathname to the target file in config parameter.
CVE: CVE-2002-1525
Remote attackers can read arbitrary files via an absolute pathname.
CVE: CVE-2001-0038
Remote attackers can read arbitrary files by specifying the drive letter in the requested URL.
CVE: CVE-2001-0255
FTP server allows remote attackers to list arbitrary directories by using the "ls" command and including the drive letter name (e.g. C:) in the requested pathname.
CVE: CVE-2001-0933
FTP server allows remote attackers to list the contents of arbitrary drives via a ls command that includes the drive letter as an argument.
CVE: CVE-2002-0466
Server allows remote attackers to browse arbitrary directories via a full pathname in the arguments to certain dynamic pages.
CVE: CVE-2002-1483
Remote attackers can read arbitrary files via an HTTP request whose argument is a filename of the form "C:" (Drive letter), "//absolute/path", or ".." .
CVE: CVE-2004-2488
FTP server read/access arbitrary files using "C:\" filenames
CVE: CVE-2001-0687
FTP server allows a remote attacker to retrieve privileged web server system information by specifying arbitrary paths in the UNC format (\\computername\sharename).
N/A
Phase | Note |
---|---|
Implementation | N/A |
Intro: In the example below, the path to a dictionary file is read from a system property and used to initialize a File object.
Body: However, the path is not validated or modified to prevent it from containing relative or absolute path sequences before creating the File object. This allows anyone who can control the system property to determine what file is used. Ideally, the path should be resolved relative to some kind of application or user home directory.
String filename = System.getProperty("com.domain.application.dictionaryFile"); File dictionaryFile = new File(filename);
Intro: This script intends to read a user-supplied file from the current directory. The user inputs the relative path to the file and the script uses Python's os.path.join() function to combine the path to the current working directory with the provided path to the specified file. This results in an absolute path to the desired file. If the file does not exist when the script attempts to read it, an error is printed to the user.
Body: However, if the user supplies an absolute path, the os.path.join() function will discard the path to the current working directory and use only the absolute path provided. For example, if the current working directory is /home/user/documents, but the user inputs /etc/passwd, os.path.join() will use only /etc/passwd, as it is considered an absolute path. In the above scenario, this would cause the script to access and read the /etc/passwd file.
import os import sys def main(): filename = sys.argv[1] path = os.path.join(os.getcwd(), filename) try: with open(path, 'r') as f: file_data = f.read() except FileNotFoundError as e: print("Error - file not found") main()