🛡️ CVE-2026-42554 — fiber
Description
" + b + "
") case "msgpack": return r.MsgPack(body) case "cbor": return r.CBOR(body) } return r.SendString(b) } ``` ## Impact This impacts all current v3 releases ≤ 3.1.0 containing `DefaultRes.AutoFormat`, and all current v2 releases ≤ 2.52.12 where the identical `"" + b + "
"` construction exists in `(*Ctx).Format()`. Exploitation requires that an application call `c.AutoFormat(v)` where `v` (or a field stringified by `%v`) contains request-influenced data. A handler that uses `AutoFormat()` to serve multiple representations of the same data can be turned into an HTML XSS sink when the client sends `Accept: text/html`, even if the developer only tested the JSON path. This may result in: - **Reflected XSS** in the application's origin via any request-derived value reaching `AutoFormat`. - **Stored XSS** where the reflected value originates from persisted input later passed to `AutoFormat`. ## Proposed Patch The injection surface is `r.Type("html")` followed by `r.SendString(b)` with unescaped caller data, where it constructs markup on the caller's behalf around a value whose HTML-ness the caller did not declare. A few options: - `AutoFormat()` should treat `body` as data, not markup, in the `"html"` branch and escape it before concatenating it into the framework-generated `` wrapper. Callers that need raw negotiated HTML should use `Format()` with an explicit HTML handler. - Introduce a sibling method that escapes, leave `AutoFormat` alone for backward compatibility. HTML-escape the value in the "html" branch before concatenating it into the `
` wrapper. ```go import "html" // ... case "html": return r.SendString("
" + html.EscapeString(b) + "
") ``` `html.EscapeString` escapes ``, `&`, `'`, `"`, which is sufficient for an element-text context. Apply the same change to v2's `(*Ctx).Format()`. ## Proof of Concept ```bash # Create project directory mkdir fiber-xss-poc && cd fiber-xss-poc # Initialize Go module go mod init fiber-xss-poc # Install Fiber v3 go get github.com/gofiber/fiber/v3 # Create the PoC file cat > main.go << 'EOF' package main import ( "github.com/gofiber/fiber/v3" ) type User struct { ID int `json:"id"` Name string `json:"name"` } func main() { app := fiber.New() app.Get("/api/user", func(c fiber.Ctx) error { user := User{ ID: 1, Name: c.Query("name", "anonymous"), } return c.AutoFormat(user) }) app.Listen(":3000") } EOF # Run it go run main.go } ``` Benign JSON ```bash curl -s 'http://127.0.0.1:3000/api/user?name=Alice' -H 'AccHow this vulnerability can be exploited
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. A user must be tricked into taking some action. The scope is changed, meaning a successful attack can affect components beyond the vulnerable one. Rated impact: confidentiality low, integrity low, availability none.
Weakness class
CVE-2026-42554 is classified as CWE-79: Cross-site Scripting (XSS). User-supplied data is written into a page without escaping, so attacker script runs in the browser of anyone who views it.
Affected software
CVE-2026-42554 is recorded against 4 packages.
- fiber (from 3.0.0 up to 3.1.0)
- github.com/gofiber/fiber/v2
- github.com/gofiber/fiber/v3
- unknown
Timeline and source
Published on 11 May 2026 and last revised on 17 June 2026. A public exploit is known to exist, which raises the urgency of patching considerably. Record sourced from NVD.
References
Details
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| fiber | 3.0.0 | 3.1.0 |
| github.com/gofiber/fiber/v2 | — | — |
| github.com/gofiber/fiber/v3 | — | — |
| unknown | — | — |
References
Similar Threats
- Medium CVE-2026-53624
- Medium CVE-2026-44332
- Medium CVE-2026-45045
- Medium CVE-2026-30246
- High CVE-2026-25882
Exploit Protection
Are you running fiber?
CVE-2026-42554 carries CVSS 6.1 Medium rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.
Check My Site For CVE-2026-42554 →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.