All vulnerabilities

Go

CVE-2026-118658

Echo has Arbitrary Scheme Injection in WWWRedirect/NonWWWRedirect Middlewares via X-Forwarded-Proto

Severity
Medium 4.7
Published
28 Oct 2026
Last changed
5 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
4.15.2, 5.1.1
Exploit chance
0.3% in the next 30 daysHigher than 19% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Open redirect (CWE-601)
Attack
Over the network · Only under certain conditions · No login needed · Needs someone to click or open something
Attacker can
Read some data · Change some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
Also known as
GHSA-23wf-92cp-8pcj, GO-2026-6878
Sources
OSV.dev and GitHub

Description

The c.Scheme() method in Echo (context.go:162-181) trusts the X-Forwarded-Proto, X-Forwarded-Protocol, and X-Url-Scheme request headers without validating that the value is http or https. The WWWRedirect() and NonWWWRedirect() middlewares use this unsanitized scheme to construct redirect URLs, allowing an attacker to inject arbitrary URI schemes into the Location response header.

  • Open redirect to arbitrary scheme URLs when app is not behind a proxy that strips X-Forwarded-Proto
  • Cache poisoning when behind a CDN that caches redirect responses keyed by path
  • file:// scheme injection could trigger file access in some browser configurations
From the GitHub Advisory Database, CC BY 4.0.

Workarounds

Upgrade to a patched version. If you cannot upgrade, have your edge proxy overwrite or remove the X-Forwarded-Proto, X-Forwarded-Protocol and X-Url-Scheme request headers.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
github.com/labstack/echo/v4Go · osv:Go:github.com/labstack/echo/v4
  • Every version before 4.15.2
github.com/labstack/echo/v5Go · osv:Go:github.com/labstack/echo/v5
  • Every version before 5.1.1

About github.com/labstack/echo/v4

About github.com/labstack/echo/v5

References