5.3medium
Fiber: X-Real-IP Spoofing via Header.Add() in BalancerForward
- Severity
- 5.3medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.34% (higher than 29% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-gcfq-8gqf-4876GO-2026-5887
Description
Fiber is an Express inspired web framework written in Go. Prior to 3.3.0 and 2.52.14, the BalancerForward proxy helper in middleware/proxy/proxy.go uses Header.Add() instead of Header.Set() when injecting X-Real-IP, allowing an attacker-supplied first X-Real-IP value to be forwarded to upstream servers for logging, rate limiting, and access control. This issue is fixed in version 3.3.0 and 2.52.14.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gofiber fiber | >= 3.0.0-beta.2, < 3.3.0, < 2.52.14, before 2.52.14, from 3.0.0 before 3.3.0 | CVE List, NVD |
| github.com/gofiber/fiber/v3 (Go) | before 3.3.0 | GitHub Advisory Database, Go Vulnerability Database |
| github.com/gofiber/fiber/v2 (Go) | before 2.52.14 | GitHub Advisory Database |
All scores
| GitHub_M | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
Fiber is an Express inspired web framework written in Go. Prior to 3.3.0 and 2.52.14, the BalancerForward proxy helper in middleware/proxy/proxy.go uses Header.Add() instead of Header.Set() when injecting X-Real-IP, allowing an attacker-supplied first X-Real-IP value to be forwarded to upstream servers for logging, rate limiting, and access control. This issue is fixed in version 3.3.0 and 2.52.14.
GitHub Advisory Database
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.
Go Vulnerability Database
GoFiber Vulnerable to X-Real-IP Spoofing via Header.Add() in BalancerForward in github.com/gofiber/fiber
NVD (es)
Fiber es un framework web inspirado en Express escrito en Go. Antes de las versiones 3.3.0 y 2.52.14, el asistente de proxy BalancerForward en middleware/proxy/proxy.go utiliza Header.Add() en lugar de Header.Set() al inyectar X-Real-IP, permitiendo que un primer valor de X-Real-IP proporcionado por el atacante sea reenviado a los servidores ascendentes para registro, limitación de velocidad y control de acceso. Este problema está solucionado en las versiones 3.3.0 y 2.52.14.
References
| https://github.com/gofiber/fiber/security/advisories/GHSA-gcfq-8gqf-4876 | advisory, exploit, vendor-advisory, web | |
| https://github.com/gofiber/fiber/pull/4260 | fix, issue-tracking, patch, web | |
| https://github.com/gofiber/fiber/pull/4495 | issue-tracking, patch, web | |
| https://github.com/gofiber/fiber/commit/1403cc8292da3220e9316960b4030cc722a0f396 | patch, web | |
| https://github.com/gofiber/fiber/commit/33c9501288ab47a429c8b5e701493f0c3c0af37d | patch, web | |
| https://github.com/gofiber/fiber/releases/tag/v2.52.14 | release-notes, web | |
| https://github.com/gofiber/fiber/releases/tag/v3.3.0 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-45045 | advisory | |
| https://github.com/gofiber/fiber | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-45045 changed 2026-07-09 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-gcfq-8gqf-4876 changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-5887 changed 2026-07-24 | CC-BY-4.0 |
| NVD | CVE-2026-45045 changed 2026-10-25 | Public domain |