Go
CVE-2026-118266
Echo has CSRF Protection Bypass via MethodOverride Rewriting POST to Safe Method
- Severity
- Medium 5.3
- Published
- 28 Oct 2026
- Last changed
- 5 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 4.16.0, 5.4.0
- Exploit chance
- 0.2% in the next 30 daysHigher than 7% of CVEs. EPSS by FIRST, 24 Nov 2026
- Attack
- Over the network · Only under certain conditions · No login needed · Needs someone to click or open something
- Attacker can
- Change data
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N- Also known as
- GHSA-r7w9-592q-9vg4, GO-2026-6877
- Sources
- OSV.dev and GitHub
Description
The MethodOverride middleware accepts any non-empty string as the override target method — including safe methods (GET, HEAD, OPTIONS, TRACE) — when rewriting a POST request. When MethodOverride is registered before CSRF in the post-routing middleware chain (e.Use()), it rewrites the request method to a safe method before CSRF evaluates it. The CSRF middleware then skips token validation for the now-safe method, allowing state-changing POST handlers to execute without any CSRF check. Both the legacy token path and the modern Sec-Fetch-Site protection path are bypassed simultaneously.
MethodOverrideConfig.ToMiddleware() (method_override.go:55-71) restricts the source method (only POST requests are overrideable) but applies no whitelist to the target:
The docstring's security claim — "For security reasons, only POST method can be overridden" — refers only to the source-method restriction. There is no guard preventing POST from being rewritten to GET, HEAD, OPTIONS, or TRACE.
Workarounds
Register MethodOverride with Echo#Pre (as documented), register CSRF before MethodOverride, or use the default header getter (X-HTTP-Method-Override), which a cross-site form cannot set.
Affected software
| Software | Affected versions |
|---|---|
github.com/labstack/echo/v4Go · osv:Go:github.com/labstack/echo/v4 |
|
github.com/labstack/echo/v5Go · osv:Go:github.com/labstack/echo/v5 |
|
About github.com/labstack/echo/v4
Vulnerabilities in github.com/labstack/echo/v4
- In our list
- 10
- Published in the last 12 months
- 10
- Critical, last 12 months
- 0
- High, last 12 months
- 1
- Known exploited
- 0
- CVE-2026-118657Echo: HTTPS Redirect and HSTS Bypass via Unconditional Trust of Forwarded Scheme HeadersMedium 5.9 28 Oct 2026
- CVE-2026-118654Echo static file middleware route protection bypass via encoded dot-dot traversalMedium 5.9 28 Oct 2026
- CVE-2026-118655Echo has a Static Middleware Double-Unescape Path TraversalMedium 5.9 28 Oct 2026
- CVE-2026-118656Echo has Open Redirect via Control-Character Prefix Defeating sanitizeURIMedium 6.1 28 Oct 2026
- CVE-2026-118658Echo has Arbitrary Scheme Injection in WWWRedirect/NonWWWRedirect Middlewares via X-Forwarded-ProtoMedium 4.7 28 Oct 2026
- CVE-2026-118650Echo's middleware.Static: `%2F`-encoded path bypasses route/group middleware guarding a statically-served pathHigh 7.5 28 Oct 2026
About github.com/labstack/echo/v5
Vulnerabilities in github.com/labstack/echo/v5
- In our list
- 10
- Published in the last 12 months
- 10
- Critical, last 12 months
- 0
- High, last 12 months
- 1
- Known exploited
- 0
- CVE-2026-118657Echo: HTTPS Redirect and HSTS Bypass via Unconditional Trust of Forwarded Scheme HeadersMedium 5.9 28 Oct 2026
- CVE-2026-118654Echo static file middleware route protection bypass via encoded dot-dot traversalMedium 5.9 28 Oct 2026
- CVE-2026-118655Echo has a Static Middleware Double-Unescape Path TraversalMedium 5.9 28 Oct 2026
- CVE-2026-118656Echo has Open Redirect via Control-Character Prefix Defeating sanitizeURIMedium 6.1 28 Oct 2026
- CVE-2026-118658Echo has Arbitrary Scheme Injection in WWWRedirect/NonWWWRedirect Middlewares via X-Forwarded-ProtoMedium 4.7 28 Oct 2026
- CVE-2026-118650Echo's middleware.Static: `%2F`-encoded path bypasses route/group middleware guarding a statically-served pathHigh 7.5 28 Oct 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-118266
- GitHub Advisory Database https://github.com/advisories/GHSA-r7w9-592q-9vg4