CVE-2025-54123: Hoverfly is vulnerable to Remote Code Execution through an insecure middleware implementation
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
-
CWE
Published
9/10/2025
Updated
9/10/2025
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| github.com/SpectoLabs/hoverfly | go | <= 1.11.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is a classic command injection issue within the middleware feature of Hoverfly. The root cause is a lack of input validation on the 'binary' and 'script' fields when setting a new middleware via the /api/v2/hoverfly/middleware endpoint. An attacker can craft a JSON payload with a malicious command in these fields.
The execution flow of the exploit is as follows:
- An attacker sends a PUT request to
/api/v2/hoverfly/middlewarewith a malicious payload, for example,{"binary": "/bin/bash", "script": "whoami"}. - The
HoverflyMiddlewareHandler.Putfunction handles this request. - The JSON payload is unmarshalled, and the
Middleware.SetBinaryfunction is called, which insecurely sets the path to the executable. - The
Hoverfly.SetMiddlewarefunction is then called, which, for validation purposes, immediately triggers an execution of the newly configured middleware by callingLocalMiddleware.Execute. - Inside
LocalMiddleware.Execute, theexec.Commandfunction is called with the user-controlled binary and script, leading to the execution of the malicious command on the server.
The provided patch does not fix the underlying command injection flaw but mitigates it by disabling the vulnerable /api/v2/hoverfly/middleware endpoint by default. It can only be enabled by starting Hoverfly with the --enable-middleware-api flag, thus reducing the attack surface for default installations.