Hoverfly Middleware Command Injection to RCE (CVE-2025-54123)
by 0xk4rth1 · 2026-07-06
- Severity
- Critical
- CVE
- CVE-2025-54123
- Category
- web
- Affected product
- SpectoLabs Hoverfly (HTTP/API service virtualization tool) — admin API, <= v1.11.3
- Affected versions
- Hoverfly <= v1.11.3 (per repository README)
- Disclosed
- 2026-07-06
- Patch status
- unpatched
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-06 |
| Last Updated | 2026-07-06 |
| Author / Researcher | 0xk4rth1 |
| CVE / Advisory | CVE-2025-54123 |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.8 (per NVD) |
| Status | Weaponized |
| Tags | hoverfly, command-injection, middleware, api, token-auth, rce, cwe-78, python |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | SpectoLabs Hoverfly (HTTP/API service virtualization tool) — admin API, <= v1.11.3 |
| Versions Affected | Hoverfly <= v1.11.3 (per repository README) |
| Language / Platform | Python 3.8+ (requests) targeting the Hoverfly REST admin API (default port 8888) |
| Authentication Required | Yes — either dashboard username/password credentials or an existing bearer token |
| Network Access Required | Yes |
Summary
Hoverfly exposes a middleware configuration API (/api/v2/hoverfly/middleware) that lets an authenticated admin register an external “middleware” process to pre/post-process simulated HTTP traffic, specified as a binary (interpreter/executable) plus a script string. Hoverfly does not adequately restrict or sanitize the script/binary values before invoking them, so an authenticated user can register a middleware whose binary is /bin/bash and whose script is an arbitrary shell command; when Hoverfly processes traffic through this middleware, it executes the attacker-controlled command and returns its output (including in error responses). The PoC script authenticates to Hoverfly’s /api/token-auth endpoint (or accepts a pre-obtained bearer token), then issues an authenticated PUT to /api/v2/hoverfly/middleware with a malicious binary/script pair, extracts the command’s STDOUT from the resulting error response, and prints it — demonstrating full command execution as the Hoverfly process user.
Vulnerability Details
Root Cause
The Hoverfly middleware feature accepts a binary and script value from the authenticated admin API and directly executes them as a subprocess without validating that they correspond to an intended, sandboxed middleware script — allowing arbitrary shell commands to be injected as the “script” and run via /bin/bash as the interpreter (CWE-78: OS Command Injection). From CVE-2025-54123.py:
| |
Hoverfly attempts to run the supplied “script” through /bin/bash as a middleware validation step, and when it fails/errors, it leaks the full STDOUT of the executed command inside the JSON error response — giving the attacker both code execution and command output retrieval in a single authenticated API call.
Attack Vector
- Authenticate to the Hoverfly admin API:
POST /api/token-authwith a valid username/password to obtain a bearer token (or supply an already-known/leaked token directly). - Send
PUT /api/v2/hoverfly/middlewarewithAuthorization: Bearer <token>and a JSON body{"binary": "/bin/bash", "script": "<attacker command>"}. - Hoverfly invokes
/bin/bashwith the attacker’sscriptas middleware validation and returns anerrorfield in the JSON response containing the process’sSTDOUT. - Parse the response to recover the command’s output, achieving arbitrary command execution as the Hoverfly service account.
Impact
Remote code execution as the user running the Hoverfly process, for any party holding (or able to obtain) valid Hoverfly admin credentials or a bearer token — a low bar in environments where Hoverfly is deployed with default/weak credentials or exposed admin APIs, since the “middleware” feature is legitimate functionality being abused rather than a memory-safety bug.
Environment / Lab Setup
Target: Hoverfly <= v1.11.3, admin API reachable on TCP/8888 (default), with
valid dashboard credentials or a leaked/obtained access token
Attacker: Python 3.8+
pip install requests
Proof of Concept
PoC Script
See
CVE-2025-54123.pyin this folder.
| |
Example output:
| |
Detection & Indicators of Compromise
Signs of compromise:
PUT /api/v2/hoverfly/middlewarerequests with abinaryof/bin/bash,sh,python, etc. and ascriptvalue resembling a shell command rather than legitimate middleware logic- JSON error responses from Hoverfly containing
STDOUT:sections with command output - Unexpected child processes spawned by the Hoverfly service (e.g.
bash -c "...") - Repeated
/api/token-authrequests from unfamiliar sources, indicating credential brute-forcing
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade Hoverfly to a patched version beyond v1.11.3 that restricts or removes arbitrary middleware binary/script execution via the admin API |
| Interim mitigation | Restrict network access to the Hoverfly admin API (port 8888) to trusted hosts only, enforce strong unique credentials, disable the middleware feature if unused, and monitor/alert on PUT /api/v2/hoverfly/middleware calls |
References
Notes
Mirrored from https://github.com/0xk4rth1/CVE-2025-54123 on 2026-07-06. The script is a functional, working PoC that authenticates to Hoverfly’s token-auth endpoint and PUTs a malicious middleware binary/script pair to achieve command injection/RCE, as confirmed by direct code review.
| |