Cross-site Request Forgery (CSRF) Affecting github.com/labstack/echo/v4/middleware package, versions <4.16.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.16% (6th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-GOLANG-GITHUBCOMLABSTACKECHOV4MIDDLEWARE-21817537
  • published29 Oct 2026
  • disclosed28 Oct 2026
  • creditbugbunny-research

Introduced: 28 Oct 2026

NewCVE-2026-118266  (opens in a new tab)
CWE-352  (opens in a new tab)

How to fix?

Upgrade github.com/labstack/echo/v4/middleware to version 4.16.0 or higher.

Overview

github.com/labstack/echo/v4/middleware is a middleware package for echo.

Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) via the MethodOverride middleware in middleware/method_override.go. An attacker can bypass CSRF token and Sec-Fetch-Site checks and trigger a state-changing POST handler without a valid token by submitting a cross-site form POST with _method=GET; configured header or query getters can supply the same override. This requires MethodOverride to run before CSRF in the post-routing middleware chain, and the victim to be authenticated.

Notes

  • At the MethodOverride input step, a cross-site form can supply _method=GET only if the middleware uses a form or query getter; the default header getter cannot be set by the form.

Workarounds

  • Register MethodOverride with Echo#Pre so routing uses the overridden method and a POST-to-GET request cannot reach a handler registered only for POST.
  • Register CSRF middleware before MethodOverride so it validates the original POST before the method can be rewritten.
  • Use the default X-HTTP-Method-Override header getter instead of a form or query getter; a cross-site form cannot set that header.

CVSS Base Scores

version 4.0
version 3.1