# CVE-2026-42554: Go Fiber XSS in AutoFormat content negotiation

Source: https://junglewise.ai/threats/cve-2026-42554-go-fiber-xss-in-autoformat-content-negotiation  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-11. Updated: 2026-05-15  
License: CC BY 4.0 with a link back

CVE-2026-42554 · Severity: medium · CVSS 4 · Published 2026-05-11

Fiber is a popular web framework for the Go programming language used to build high-performance web applications. A vulnerability in its content negotiation feature allows attackers to inject malicious scripts into web pages. If an application uses the AutoFormat function to display user-provided data, an attacker can force the application to return malicious HTML/JavaScript instead of the intended data format (like JSON), potentially leading to account takeover or unauthorized actions on behalf of users.

Technologies: [Fiber](https://junglewise.ai/threats/technologies/fiber), [github.com/gofiber/fiber/v2 (Go)](https://junglewise.ai/threats/technologies/github-com-gofiber-fiber-v2), [github.com/gofiber/fiber/v3 (Go)](https://junglewise.ai/threats/technologies/github-com-gofiber-fiber-v3). Vendors: [Fiber](https://junglewise.ai/threats/vendors/fiber), [Go](https://junglewise.ai/threats/vendors/go).

## Quick answers

**Is CVE-2026-42554 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-42554 being exploited in the wild.

**How severe is CVE-2026-42554?** Medium severity, with a CVSS score of 4, published 11 May 2026.

**Which products and versions are affected?** Fiber <= 2.52.12, <= 2.52.12, <= 3.1.0; github.com/gofiber/fiber/v2 (Go) <= 2.52.12, SEMVER:introduced=0,fixed=2.52.13; github.com/gofiber/fiber/v3 (Go) <= 3.1.0, SEMVER:introduced=0,fixed=3.2.0.

**Is there a fix for CVE-2026-42554?** Yes. github.com/gofiber/fiber/v2 (Go): upgrade to 2.52.13 or later; github.com/gofiber/fiber/v3 (Go): upgrade to 3.2.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-42554 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-42554?** Check whether you run Fiber, github.com/gofiber/fiber/v2 (Go) or github.com/gofiber/fiber/v3 (Go) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- github.com/gofiber/fiber/v2 (Go): upgrade to 2.52.13 or later

  ```sh
  go get github.com/gofiber/fiber/v2@v2.52.13
  ```

- github.com/gofiber/fiber/v3 (Go): upgrade to 3.2.0 or later

  ```sh
  go get github.com/gofiber/fiber/v3@v3.2.0
  ```


## Technical details

A Cross-Site Scripting (XSS) vulnerability exists in Go Fiber's `AutoFormat()` (v3) and `Format()` (v2) methods. The vulnerability occurs because the framework's content negotiation logic includes an 'html' branch that wraps stringified input data in `<p>` tags without performing HTML entity encoding. While other formats like JSON and XML use safe encoders, the HTML branch performs direct string concatenation. An attacker can trigger this branch by providing a `text/html` value in the `Accept` request header. If the data passed to these methods contains attacker-controlled input, arbitrary HTML or JavaScript can be executed in the context of the victim's browser. The issue is fixed in versions 2.52.12 and 3.1.0 by implementing proper HTML escaping.

## Affected products

- gofiber fiber <= 2.52.12, <= 3.1.0

## Identifiers

- CVE-2026-42554
- GHSA-qjv7-627w-8qjv
- GO-2026-5585

## Timeline

- 2026-04-25: advisory: GitHub Security Advisory published
- 2026-05-11: disclosed: CVE-2026-42554 published to NVD

## References

- [https://github.com/gofiber/fiber/security/advisories/GHSA-qjv7-627w-8qjv](https://github.com/gofiber/fiber/security/advisories/GHSA-qjv7-627w-8qjv)

## Related threats

- [Fiber CORS middleware wildcard domain bypass](https://junglewise.ai/threats/cve-2026-119285-fiber-is-an-express-inspired-web-framework-written-in-go-from-2)
- [Gofiber Fiber HSTS header omission in helmet middleware](https://junglewise.ai/threats/cve-2026-53624-gofiber-fiber-hsts-header-omission-in-helmet-middleware)
- [Gofiber Fiber IP spoofing in BalancerForward proxy helper](https://junglewise.ai/threats/cve-2026-45045-gofiber-fiber-ip-spoofing-in-balancerforward-proxy-helper)
- [Gofiber Fiber username enumeration in BasicAuth middleware](https://junglewise.ai/threats/cve-2026-44332-gofiber-fiber-username-enumeration-in-basicauth-middleware)
- [Gofiber Fiber response mix-up in cache middleware](https://junglewise.ai/threats/cve-2026-30246-gofiber-fiber-response-mix-up-in-cache-middleware)
