本文へ移動
English version →
中 5.3

Echo: Reverse Proxy Forwards Attacker-Supplied X-Real-IP to Upstream by Default

CVE-2026-118651 SecPulse初出

影響パッケージ

種類パッケージ影響を受ける版直った版
labstack echo — —
go github.com/labstack/echo/v5
5.4.0 未満
5.4.0
go github.com/labstack/echo/v4
4.0.0 〜 4.16.2
—
原文の説明 取得元が公開している説明をそのまま載せています (多くは英語)。

Summary

The Echo proxy middleware (middleware/proxy.go) preserves an incoming X-Real-IP header verbatim and forwards it to the upstream service when Echo#IPExtractor is not configured — which is the default. Because any HTTP client can supply an arbitrary X-Real-IP value, an attacker can cause Echo to relay a spoofed client IP address to every upstream service behind the proxy, undermining upstream IP-based access controls, rate limiting, audit logging, and geo-restriction.

Affected Component

  • middleware/proxy.go — ProxyConfig.ToMiddleware(), header-rewriting block (lines 351–355)

Description

The header-preservation condition passes spoofed values to upstream

ProxyConfig.ToMiddleware() (proxy.go:338-405) prepares forwarding headers before dispatching each request. The X-Real-IP rewrite logic at lines 351-355 reads:

// proxy.go:351-355
// Basically it's not good practice to unconditionally pass incoming x-real-ip header to upstream.
// However, for backward compatibility, legacy behavior is preserved unless you configure Echo#IPExtractor.
if req.Header.Get(echo.HeaderXRealIP) == "" || c.Echo().IPExtractor != nil {
    req.Header.Set(echo.HeaderXRealIP, c.RealIP())
}

The condition is TRUE (and therefore overwrites the header with a derived value) only when:

  • The header is absent — req.Header.Get(echo.HeaderXRealIP) == ""; or
  • IPExtractor is explicitly configured — c.Echo().IPExtractor != nil

The condition is `FALS…

出典: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

参照URL

当サイトでは、アクセス解析と広告の効果測定のために Cookie を使います。株式会社Game のサイト共通の設定です。 詳しく