CVE-2026-118266
## Summary 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. ## Affected Component - `middleware/method_override.go` — `MethodOverrideConfig.ToMiddleware()` (lines 55–71): no whitelist on the override target method - `middleware/csrf.go` — `CSRFConfig.ToMiddleware()` (lines 188–189): safe-method bypass branch reads the already-rewritten method - `middleware/csrf.go` — `checkSecFetchSiteRequest()` (line 283): `Sec-Fetch-Site` safe check also reads the rewritten method ## Description ### MethodOverride accepts safe methods as override targets `MethodOverrideConfig.ToMiddleware()` (`method_override.go:55-71`) restricts the **source** method (only POST requests are overrideable) but applies no whitelist to the **target**: ```go // method_override.go:61-67 req := c.Request() if req.Method == http.MethodPost { m := config.Getter(c) if m != "" { req.Method = m // ← any non-empty string accepted, including "GET" } } ``` 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`. The test suite (`method_override_test.go`) only tests POST→DELETE and POST→PUT; POST→GET is never tested or blocked. ### CSRF safe-method branch reads the already-rewritten method `CSRFConfig.ToMiddleware()` (`csrf.go:188-189`) makes its validation deci
Properties
- Severity
- medium
- Summary
- Echo has CSRF Protection Bypass via MethodOverride Rewriting POST to Safe Method
- Nvd fetched at
- 2026-10-28T23:43:43.157973+00:00
- Cvss severity
- MEDIUM
- Cvss score
- 5.3
- Retrieved at
- 2026-10-28T23:45:49+00:00
- Ghsa published
- 2026-10-28T19:53:36Z
- Source url
- https://github.com/advisories/GHSA-r7w9-592q-9vg4
- Ghsa updated
- 2026-10-28T19:53:37Z
- Ghsa id
- GHSA-r7w9-592q-9vg4
- Last source
- GitHub Advisory Database
- Score
- 5.3
- Cvss version
- 3.1
- Cve id
- CVE-2026-118266
- Cvss vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
- First seen by Signal
- 2026-10-28T23:44:40+00:00
- Is ghsa only
- false
- Vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
- Published at
- 2026-10-28T20:17:21.577
- Last modified
- 2026-10-28T20:17:21.577
Related Entities (5)
AFFECTS (2)
VULNERABLE_TO (2)
HAS_WEAKNESS (1)
Explore deeper with Ninja Signal's threat intelligence graph