Miggo Logo

CVE-2025-54123: Hoverfly is vulnerable to Remote Code Execution through an insecure middleware implementation

9.8

CVSS Score
3.1

Basic Information

EPSS Score
-
Published
9/10/2025
Updated
9/10/2025
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/SpectoLabs/hoverflygo<= 1.11.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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:

  1. An attacker sends a PUT request to /api/v2/hoverfly/middleware with a malicious payload, for example, {"binary": "/bin/bash", "script": "whoami"}.
  2. The HoverflyMiddlewareHandler.Put function handles this request.
  3. The JSON payload is unmarshalled, and the Middleware.SetBinary function is called, which insecurely sets the path to the executable.
  4. The Hoverfly.SetMiddleware function is then called, which, for validation purposes, immediately triggers an execution of the newly configured middleware by calling LocalMiddleware.Execute.
  5. Inside LocalMiddleware.Execute, the exec.Command function 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Summ*ry It **s ***n *is*ov*r** t**t t** mi**l*w*r* *un*tion*lity in *ov*r*ly is vuln*r**l* to *omm*n* inj**tion t*rou** its `/*pi/v*/*ov*r*ly/mi**l*w*r*` *n*point *u* to insu**i*i*nt v*li**tion *n* s*nitiz*tion in us*r input. ### **t*ils T** vul

Reasoning

T** vuln*r**ility is * *l*ssi* *omm*n* inj**tion issu* wit*in t** mi**l*w*r* ***tur* o* *ov*r*ly. T** root **us* is * l**k o* input v*li**tion on t** '*in*ry' *n* 's*ript' *i*l*s w**n s*ttin* * n*w mi**l*w*r* vi* t** `/*pi/v*/*ov*r*ly/mi**l*w*r*` *n*