CVE-2026-45045: GoFiber Vulnerable to X-Real-IP Spoofing via Header.Add() in BalancerForward
Summary The BalancerForward proxy helper in GoFiber uses Header.Add() instead of Header.Set() when injecting the X-Real-IP header. This appends the real client IP as a second header value rather than replacing any attacker-supplied value. Upstream servers that read the first X-Real-IP header (nginx, Express, most HTTP servers) use the attacker's spoofed IP for logging, rate limiting, and access control.
Published Jul 2, 2026 · Updated Aug 4, 2026
Affected packages
github.com/gofiber/fiber/v3
- Ecosystem
- Go
- Affected
- <= 3.2.0
- Fixed in
- 3.3.0
- Check
go list -m github.com/gofiber/fiber/v3
github.com/gofiber/fiber/v2
- Ecosystem
- Go
- Affected
- <= 2.52.13
- Fixed in
- 2.52.14
- Check
go list -m github.com/gofiber/fiber/v2
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
The BalancerForward proxy helper in GoFiber uses Header.Add() instead of Header.Set() when injecting the X-Real-IP header. This appends the real client IP as a second header value rather than replacing any attacker-supplied value. Upstream servers that read the first X-Real-IP header (nginx, Express, most HTTP servers) use the attacker's spoofed IP for logging, rate limiting, and access control.
Vulnerable Code
File: middleware/proxy/proxy.go, lines 270-285
func BalancerForward(servers []string, clients ...*fasthttp.Client) fiber.Handler {
r := &roundrobin{
current: 0,
pool: servers,
}
return func(c fiber.Ctx) error {
server := r.get()
if !strings.HasPrefix(server, "http") {
server = "http://" + server
}
c.Request().Header.Add("X-Real-IP", c.IP()) // line 282: Add, not Set
return Do(c, server+c.OriginalURL(), clients...)
}
}Data Flow
- Attacker sends request with
X-Real-IP: 10.0.0.1(spoofed internal IP) BalancerForwardhandler executes at line 282c.Request().Header.Add("X-Real-IP", c.IP())APPENDS the real IP as a second header- Upstream server receives:
X-Real-IP: 10.0.0.1ANDX-Real-IP: <real-attacker-ip> - Most HTTP servers (nginx, Node.js, Apache) read the FIRST value
- Upstream uses
10.0.0.1for all IP-dependent logic
Impact
- Rate limit bypass: IP-based rate limiting at the upstream uses the spoofed IP, allowing unlimited requests
- IP ACL bypass: Internal IP allowlists (e.g., admin panels restricted to
10.0.0.0/8) can be bypassed - Audit log poisoning: Security logs record the spoofed IP, making incident investigation unreliable
- Geolocation bypass: IP-based geofencing or region restrictions are circumvented
Fix
Replace Header.Add() with Header.Set() at line 282:
c.Request().Header.Set("X-Real-IP", c.IP())Header.Set() replaces any existing header value, ensuring only the real client IP is forwarded.
Credited to TristanInSec, ReneWerner87, gaby, 0x01code.
References
- https://github.com/gofiber/fiber/security/advisories/GHSA-gcfq-8gqf-4876
- https://nvd.nist.gov/vuln/detail/CVE-2026-45045
- https://github.com/gofiber/fiber/pull/4260
- https://github.com/gofiber/fiber/pull/4495
- https://github.com/gofiber/fiber/commit/1403cc8292da3220e9316960b4030cc722a0f396
- https://github.com/gofiber/fiber/commit/33c9501288ab47a429c8b5e701493f0c3c0af37d
- https://github.com/gofiber/fiber/releases/tag/v2.52.14
- https://github.com/gofiber/fiber/releases/tag/v3.3.0
- https://github.com/advisories/GHSA-gcfq-8gqf-4876
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Go vulnerabilities
All Go entriesCVE-2026-119285
Fiber: CORS wildcard origins matched without a dot boundary, allowing credentialed cross-origin reads
medium5.9Oct 30, 2026CVE-2026-44332
GoFiber Vulnerable to Username Enumeration via Timing Oracle in BasicAuth Default Authorizer
medium5.3Jul 2, 2026CVE-2026-42554
Fiber vulnerable to XSS in AutoFormat Content Negotiation
medium5.3May 5, 2026CVE-2026-30246
Fiber's cache middleware default key generator ignores query string, causing response mix-up across distinct query parameters
medium6.5Apr 28, 2026CVE-2026-25882
Fiber has a Denial of Service Vulnerability via Route Parameter Overflow
medium6.9Feb 24, 2026CVE-2026-25891
Fiber has an Arbitrary File Read in Static Middleware on Windows
high8.7Feb 24, 2026
