Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
CVE-2024-45388
Summary
Hoverfly is a lightweight service virtualization/API simulation/API mocking tool for developers and testers. The "/api/v2/simulation" POST handler allows users to create new simulation views from the contents of a user-specified file. This feature can be abused by an attacker to read arbitrary files from the Hoverfly server. Note that, although the code prevents absolute paths from being specified, an attacker can escape out of the "hf.Cfg.ResponsesBodyFilesPath" base path by using "../" segments and reach any arbitrary files. This issue was found using the Uncontrolled data used in the path expression CodeQL query for python. Users are advised to make sure the final path ("filepath.Join(hf.Cfg.ResponsesBodyFilesPath, filePath)") is contained within the expected base path ("filepath.Join(hf.Cfg.ResponsesBodyFilesPath, "/")"). This issue is also tracked as GHSL-2023-274. This issue affects github.com/SpectoLabs/hoverfly versions 1.3.0 through 1.10.2.
- LOW
- NETWORK
- NONE
- UNCHANGED
- NONE
- NONE
- HIGH
- NONE
CWE-22 - Path Traversal
Path traversal (or directory traversal), is a vulnerability that allows malicious users to traverse the server's root directory, gaining access to arbitrary files and folders such as application code & data, back-end credentials, and sensitive operating system files. In the worst-case scenario, an attacker could potentially execute arbitrary files on the server, resulting in a denial of service attack. Such an exploit may severely impact the integrity, confidentiality, and availability of an application.
References
Advisory Timeline
- Published