CVE-2024-45388 Arbitrary file read in the `/api/v2/simulation` endpoint in hoverfly (`GHSL-2023-274`)
An attacker can read arbitrary files from the Hoverfly server by exploiting path traversal in the simulation API endpoint.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-45388?
CVE-2024-45388 is a high-severity path traversal vulnerability in SpectoLabs hoverfly, published on 2 Sep 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
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 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.
Which versions are affected by CVE-2024-45388?
5 open source packages ship an affected version, including github.com/SpectoLabs/hoverfly and github.com/spectolabs/hoverfly. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
github.com/SpectoLabs/hoverfly Go | All versions | 1.10.3 |
github.com/SpectoLabs/hoverfly Go | All versions | 1.10.3 |
github.com/SpectoLabs/hoverfly Go | All versions | 1.10.3 |
github.com/spectolabs/hoverfly Go | All versions | 1.10.3 |
github.com/spectolabs/hoverfly Go | All versions | 1.10.3 |
Products include Hoverfly Hoverfly.
How do I fix CVE-2024-45388?
Upgrade github.com/SpectoLabs/hoverfly to 1.10.3 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2024-45388 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-45388 exists.
Public exploit code: 1 Nuclei template.
Other vulnerabilities in SpectoLabs hoverfly
Sources
Also known as GHSA-6xx4-x46f-f897, GO-2024-3108.