High, CVSS 8.7GoPublished
Hoverfly allows an arbitrary file read in the /api/v2/simulation endpoint (GHSL-2023-274)
CVE-2024-45388 · GHSA-6xx4-x46f-f897
- Affected
- Go github.com/spectolabs/hoverfly < 1.10.3
- Fixed in
- 1.10.3· Vendor fix available
- Issue
- Details 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 path expression CodeQL query for python. Proof of Concept Send the following POST request to read the /etc/passwd file: Response will contain the Hoverfly's server /etc/passwd Impact This issue may lead to Information Disclosure. Remediation The code is preventing absolute paths from being read. Make sure the final path (filepath.Join(hf.Cfg.ResponsesBodyFilesPath, filePath)) is contained within the expected base path (filepath.Join(hf.Cfg.ResponsesBodyFilesPath, "/"))
Recommended action: Upgrade to 1.10.3 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.