Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/gofiber/fiber/v2
  4. ›
  5. CVE-2026-42554

CVE-2026-42554: Fiber vulnerable to XSS in AutoFormat Content Negotiation

May 5, 2026

Description

A Cross-Site Scripting (CWE-79) vulnerability in Go Fiber allows a remote attacker to inject arbitrary HTML/JavaScript by supplying Accept: text/html on any request whose handler passes attacker-influenced data to the AutoFormat() feature. This affects github.com/gofiber/fiber/v3 (DefaultRes.AutoFormat) through version 3.1.0 and github.com/gofiber/fiber/v2 (Ctx.Format) through version 2.52.12.

The developer opts into content negotiation by calling AutoFormat(), but does not opt into raw HTML emission for a particular request; Fiber chooses that branch from attacker-controlled Accept. Five of the six branches of the same method already escape. JSON, XML, MsgPack, and CBOR all route through encoders that neutralize markup; the txt branch emits text/plain and cannot execute. The html branch is the sole outlier in a method whose name (AutoFormat) and symmetrical structure actively telegraph “safe, format-agnostic reply.”

References

  • github.com/advisories/GHSA-qjv7-627w-8qjv
  • github.com/gofiber/fiber
  • github.com/gofiber/fiber/security/advisories/GHSA-qjv7-627w-8qjv
  • nvd.nist.gov/vuln/detail/CVE-2026-42554

Code Behaviors & Features

Detect and mitigate CVE-2026-42554 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.52.13

Fixed versions

  • 2.52.13

Solution

Upgrade to version 2.52.13 or above.

Impact 5.4 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

go/github.com/gofiber/fiber/v2/CVE-2026-42554.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 09 May 2026 00:18:34 +0000.