The root cause is that Echo's default configuration (echo.New() with no IPExtractor set) causes Context.RealIP() to trust client-supplied X-Forwarded-For / X-Real-IP headers. The rate limiter middleware's default IdentifierExtractor uses ctx.RealIP() as the per-client bucket key, so an attacker can rotate the X-Forwarded-For header value on each request to obtain a fresh rate-limit bucket and bypass throttling entirely.
The fix (commit 22e4b71109ef072ef011a489066ec662ca9565b2) removes the legacy header-trusting fallback from Context.RealIP(), making it return the direct peer address (RemoteAddr) when no IPExtractor is configured, and moves the old spoofable behavior into a new LegacyIPExtractor/legacyIPExtractor function that is explicitly documented as unsafe.
The vulnerable functions that would appear in a runtime profile during exploitation are:
- Context.RealIP — the method that reads the attacker-controlled header (in the vulnerable version).
- DefaultRateLimiterConfig.IdentifierExtractor — the closure that calls RealIP() to derive the per-client identifier.
- RateLimiter — the convenience function that wires the insecure default into the middleware.
- legacyIPExtractor — the spoofable header-parsing logic (inline in RealIP() before the fix, extracted after).
Note: Go profilers strip package paths, so these are reported as method/function names without the github.com/labstack/echo/v5 package prefix.