Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languagepython
Severityhigh
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelMedium
Impact LevelHigh
Likelihood LevelMedium

Description

User input from HTTP requests is being used directly as a file path in the open() function without validation or sanitization. This allows attackers to craft requests that access files outside the intended directory, leading to a path traversal vulnerability.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languagepython
Severitymedium
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelLow

Description

User input from HTTP requests is being used directly to select files for FileResponse, without validation. This lets attackers specify any file path, potentially accessing files they shouldn’t be able to.

Impact

An attacker could exploit this to read sensitive files from your server, such as configuration files, user data, or credentials, leading to data breaches or system compromise. This could expose confidential business or personal information and violate security or privacy policies.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languagepython
Severitymedium
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelMedium

Description

The code uses user-supplied input from a web request directly as a file path in the open() function without proper validation or sanitization. This allows attackers to manipulate the file path and potentially access files outside the intended directory.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languagepython
Severitylow
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelLow
Impact LevelLow
Likelihood LevelLow

Description

User input from a web request is being used directly to build file paths with os.path.join() and then passed to open(). This allows attackers to manipulate the file path and potentially access files outside the intended directory.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languagepython
Severitylow
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelLow
Impact LevelMedium
Likelihood LevelLow

Description

User input from HTTP requests is being used directly in file names without proper validation or sanitization, allowing attackers to manipulate file paths. This can let them access or overwrite files outside the intended directory.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languageruby
Severitylow
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelLow
Impact LevelMedium
Likelihood LevelLow

Description

Enabling config.serve_static_assets in a Rails application allows users to request files outside the app’s root directory, exposing sensitive files on the server. This misconfiguration can let attackers probe and access unintended files.

Impact

If exploited, attackers could discover the presence of sensitive files or even access confidential data stored outside the application’s intended directory. This could lead to data leaks, exposure of configuration files, or aid further attacks on the server.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languageruby
Severityhigh
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelHigh

Description

The code uses user-supplied input (such as from params, cookies, or request environment) directly in FTP file operations. This allows attackers to control which files are accessed or modified on the server.

Impact

If exploited, an attacker could read, overwrite, or delete arbitrary files on the server via FTP, potentially exposing sensitive data or disrupting application functionality. This could lead to data breaches or loss of system integrity.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languageruby
Severityhigh
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelHigh

Description

The code is using user input (such as parameters, cookies, or request data) directly in file or directory operations. This allows attackers to control file paths and potentially access or modify files they shouldn’t.

Impact

An attacker could read, modify, or delete sensitive files on the server, leading to data breaches, service disruption, or escalation of privileges. This exposes the application and its users to significant risk, including unauthorized access to confidential information.

Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)

Property
Languageruby
Severityhigh
CWECWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’)
OWASPA05:2017 - Broken Access Control
Confidence LevelMedium
Impact LevelMedium
Likelihood LevelHigh

Description

Avoid rendering user input. It may be possible for a malicious user to input a path that lets them access a template they shouldn’t. To prevent this, check dynamic template paths against a predefined allowlist to make sure it’s an allowed template.