CVE-2026-45045: Fiber: X-Real-IP Spoofing via Header.Add() in BalancerForward

Published Jul 2, 2026
·
Updated

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

go 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

1. Attacker sends request with X-Real-IP: 10.0.0.1 (spoofed internal IP) 2. BalancerForward handler executes at line 282 3. c.Request().Header.Add("X-Real-IP", c.IP()) APPENDS the real IP as a second header 4. Upstream server receives: X-Real-IP: 10.0.0.1 AND X-Real-IP: <real-attacker-ip> 5. Most HTTP servers (nginx, Node.js, Apache) read the FIRST value 6. Upstream uses 10.0.0.1 for 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:

go c.Request().Header.Set("X-Real-IP", c.IP())

Header.Set() replaces any existing header value, ensuring only the real client IP is forwarded.

Other sources

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.

MITRE

Affected Software

4 affected componentsFixes available
go/github.com/gofiber/fiber/v2<=2.52.13
go/github.com/gofiber/fiber/v3<=3.2.0
3.3.0
gofiber Fiber Go<2.52.14
gofiber Fiber Go>=3.0.0<3.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/gofiber/fiber/v3 to a version that resolves this vulnerability.

    Fixed in 3.3.0
  2. Upgrade

    Upgrade GoFiber to a version that resolves this vulnerability.

    Fixed in 3.3.0
  3. Upgrade

    Upgrade GoFiber to a version that resolves this vulnerability.

    Fixed in 2.52.14
  4. Configuration

    In middleware/proxy/proxy.go at line 282 in BalancerForward, replace c.Request().Header.Add("X-Real-IP", c.IP()) with c.Request().Header.Set("X-Real-IP", c.IP()) so any attacker-supplied first X-Real-IP value is replaced rather than appended.

    BalancerForward proxy helper (middleware/proxy/proxy.go) Header injection for X-Real-IP = Set instead of Add

Event History

Jul 2, 2026
Advisory Published
via GitHub·01:50 PM
Data Sourced
via GitHub·01:50 PM
DescriptionSeverityWeaknessAffected Software
Jul 8, 2026
CVE Published
via MITRE·07:26 PM
Data Sourced
via MITRE·07:26 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-45045?

The severity of CVE-2026-45045 is medium with a score of 5.3.

2

How do I fix CVE-2026-45045?

To fix CVE-2026-45045, update to the latest version of GoFiber to ensure proper handling of the X-Real-IP header.

3

What systems are affected by CVE-2026-45045?

CVE-2026-45045 affects versions of GoFiber in both v2 and v3.

4

What is the impact of CVE-2026-45045?

The impact of CVE-2026-45045 is that it may allow for the injection of multiple X-Real-IP values, which could mislead upstream servers regarding the true client IP.

5

When was CVE-2026-45045 published?

CVE-2026-45045 was published on July 2, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203