Описание
Hoverfly is vulnerable to Remote Code Execution through an insecure middleware implementation
Summary
It has been discovered that the middleware functionality in Hoverfly is vulnerable to command injection through its /api/v2/hoverfly/middleware endpoint due to insufficient validation and sanitization in user input.
Details
The vulnerability exists in the middleware management API endpoint /api/v2/hoverfly/middleware.
This issue is born due to combination of three code level flaws:
- Insufficient Input Validation in middleware.go line 94-96:
- Unsafe Command Execution in local_middleware.go line 14-19:
- Immediate Execution During Testing in hoverfly_service.go line 173:
POC
- Send the below HTTP PUT request to
http://localhost:8888in order to create our malicious middleware, this will execute a simplewhoamicommand on target. (ADMIN UI/API)
Here, when you send this request, The hoverify will processes the request and writes the script to a temporary file and During middleware validation, Hoverfly executes: /bin/bash /tmp/{hoverfly_script}, and Boom! The malicious script will get executed with Hoverfly's privileges.
(Here, the user is kr1shna4garwal)
Impact
This allows an attacker to gain remote code execution (RCE) on any system running the vulnerable Hoverfly service. Since the input is directly passed to system commands without proper checks, an attacker can upload a malicious payload or directly execute arbitrary commands (including reverse shells) on the host server with the privileges of the hoverfly process.
Reporter: @kr1shna4garwal
Ссылки
- https://github.com/SpectoLabs/hoverfly/security/advisories/GHSA-r4h8-hfp2-ggmf
- https://nvd.nist.gov/vuln/detail/CVE-2025-54123
- https://github.com/SpectoLabs/hoverfly/pull/1203
- https://github.com/SpectoLabs/hoverfly/commit/17e60a9bc78826deb4b782dca1c1abd3dbe60d40
- https://github.com/SpectoLabs/hoverfly/commit/a9d4da7bd7269651f54542ab790d0c613d568d3e
- https://github.com/SpectoLabs/hoverfly/blob/master/core/hoverfly_service.go#L173
- https://github.com/SpectoLabs/hoverfly/blob/master/core/middleware/local_middleware.go#L13
- https://github.com/SpectoLabs/hoverfly/blob/master/core/middleware/middleware.go#L93
Пакеты
github.com/SpectoLabs/hoverfly
<= 1.11.3
Отсутствует
Связанные уязвимости
Hoverfly is an open source API simulation tool. In versions 1.11.3 and prior, the middleware functionality in Hoverfly is vulnerable to command injection vulnerability at `/api/v2/hoverfly/middleware` endpoint due to insufficient validation and sanitization in user input. The vulnerability exists in the middleware management API endpoint `/api/v2/hoverfly/middleware`. This issue is born due to combination of three code level flaws: Insufficient Input Validation in middleware.go line 94-96; Unsafe Command Execution in local_middleware.go line 14-19; and Immediate Execution During Testing in hoverfly_service.go line 173. This allows an attacker to gain remote code execution (RCE) on any system running the vulnerable Hoverfly service. Since the input is directly passed to system commands without proper checks, an attacker can upload a malicious payload or directly execute arbitrary commands (including reverse shells) on the host server with the privileges of the Hoverfly process. Commit 1