Reliance on Untrusted Inputs in a Security Decision 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.13% (3rd 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-21817641
  • published29 Oct 2026
  • disclosed28 Oct 2026
  • creditsergeykochanov, bugbunny-research, lalalala5678

Introduced: 28 Oct 2026

NewCVE-2026-118657  (opens in a new tab)
CWE-346  (opens in a new tab)
CWE-807  (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 Reliance on Untrusted Inputs in a Security Decision via the Context.Scheme() method in Echo’s request context. A remote unauthenticated attacker can send X-Forwarded-Proto: https to an HTTP endpoint to bypass HTTPSRedirect, leaving users’ traffic on plaintext HTTP and exposed to interception or modification; behind a TLS-terminating proxy, spoofing X-Forwarded-Proto: http can suppress HSTS. Because WWWRedirect and NonWWWRedirect use Context.Scheme() to build redirect URLs, an attacker can also supply a scheme such as javascript and cause the redirect to use that scheme.

Notes

  • At the header-processing step, the attacker must reach the app directly or through a proxy that does not overwrite the spoofed X-Forwarded-Proto; a proxy that overwrites it blocks this attack path.

Workarounds

  • If you cannot upgrade, route every request through a proxy that overwrites X-Forwarded-Proto and removes X-Forwarded-Protocol, X-Forwarded-Ssl, and X-Url-Scheme; prevent direct access to the application so clients cannot spoof scheme headers to bypass HTTPS redirects or suppress HSTS.

CVSS Base Scores

version 4.0
version 3.1