GHSA-h53f-rm2w-w7rgMedium· 5.3▾ SunlitEcho: X-Real-IP extractor trusts the header value instead of the sending peer
▾ Sunlit zone — Low / medium · no exploitation signal
impact 29.2 · likelihood 0 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
In Echo v5, ExtractIPFromRealIPHeader checked whether the address supplied in X-Real-IP belonged to a trusted range instead of checking the address of the direct network peer. An untrusted client could therefore supply a loopback or private address and have it returned by c.RealIP() with the extractor's default trust options.
Applications using this extractor for IP allowlists, IP-based rate limiting, audit logs or forwarding headers could accept a spoofed client identity. Exploitation requires that the attacker can reach Echo directly or that an intervening proxy passes through the attacker's X-Real-IP value. Applications using the default direct IP extractor are unaffected. Echo v4 is unaffected by this v5 regression.
All v5 releases from v5.0.0 through v5.4.0 are affected. Upgrade to v5.4.1.
The patch validates the direct peer before accepting a syntactically valid X-Real-IP value, restoring the v4 trust model. Fix commit.
Use ExtractIPDirect until upgrading, or ensure that only trusted proxies can reach Echo and that they replace client-supplied forwarding headers. Configure trusted proxy ranges narrowly for the deployment.
Reported and patched by @rm-Umar. @Duodum independently reported the same issue in GHSA-c3r7-8j36-7mx8, which is tracked as a duplicate of this advisory.
github.com/labstack/echo/v5 >= 5.0.0, < 5.4.1Upgrade to a patched release:
github.com/labstack/echo/v5 5.4.1Connected by shared product, vendor, weakness, or advisory.
GHSA-x9ff-22gv-65f4MediumEcho: BodyDump can discard BodyLimit overflow errors for unknown-length requests
GHSA-cxf3-9h37-7rr8CriticalEcho: Rejected WebSocket upgrades can bypass Echo route-level access controls
GHSA-9969-6676-49h5HighEcho: WebSocket proxy can retain connections and handlers after client disconnect
GHSA-f48p-c9v4-h7xvHighEcho: BodyDump captures request and response bodies without size limits in v4
GHSA-h7wr-284f-5qvcHighEcho: Decompress permits unbounded gzip expansion in v4
GHSA-7cgw-qmxx-7fc2Medium· 4.8Duplicate Advisory: chi: Client IP spoofing in ClientIPFromXFF via X-Forwarded-For