CVE-2026-118658: Echo has Arbitrary Scheme Injection in WWWRedirect/NonWWWRedirect Middlewares via X-Forwarded-Proto
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.
References
- github.com/advisories/GHSA-23wf-92cp-8pcj
- github.com/labstack/echo/commit/ca4f38a474302aabee93c66bdd0052359882e181
- github.com/labstack/echo/commit/d1d8ad3f99dd9b80542cd0c357d56a8916c515df
- github.com/labstack/echo/pull/2953
- github.com/labstack/echo/releases/tag/v4.15.2
- github.com/labstack/echo/releases/tag/v5.1.1
- github.com/labstack/echo/security/advisories/GHSA-23wf-92cp-8pcj
- nvd.nist.gov/vuln/detail/CVE-2026-118658
Code Behaviors & Features
Detect and mitigate CVE-2026-118658 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 →