CVE-2026-118266: Echo has CSRF Protection Bypass via MethodOverride Rewriting POST to Safe Method
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.
References
- github.com/advisories/GHSA-r7w9-592q-9vg4
- github.com/labstack/echo/commit/b838391e2eade87ae7e5a09d7bb5087bec271ec1
- github.com/labstack/echo/commit/fc410094b2f3415cf2bf5204082137b205bfd5af
- github.com/labstack/echo/releases/tag/v4.16.0
- github.com/labstack/echo/releases/tag/v5.4.0
- github.com/labstack/echo/security/advisories/GHSA-r7w9-592q-9vg4
- nvd.nist.gov/vuln/detail/CVE-2026-118266
Code Behaviors & Features
Detect and mitigate CVE-2026-118266 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →