Echo arbitrary URI scheme redirects via forwarded scheme headers
labstack echo
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| github.com/labstack/echo/v5 Go |
|
|
| github.com/labstack/echo/v4 Go |
|
|
labstack echo
| Product | Affected | Fixed in |
|---|---|---|
| github.com/labstack/echo/v5 Go |
|
|
| github.com/labstack/echo/v4 Go |
|
|
Echo is a Go web framework. Prior to 4.15.2 and 5.1.1, Context.Scheme returns values from X-Forwarded-Proto, X-Forwarded-Protocol, or X-Url-Scheme without validating that they are supported web schemes. WWWRedirect and NonWWWRedirect use that value to construct a Location header, so an attacker controlling a forwarded scheme header can cause a redirect to use an arbitrary URI scheme. Exploitation requires an affected redirect middleware and user interaction with the response; the HTTPS-specific redirect variants hardcode HTTPS and are unaffected. This issue is fixed in 4.15.2 and 5.1.1.
From the CVE record · GitHub_M
Echo’s Context.Scheme does not validate forwarded scheme headers before WWWRedirect or NonWWWRedirect uses their value in a Location header. An attacker who controls one of those headers can cause a redirect to use an arbitrary URI scheme when an affected middleware is enabled and a user interacts with the response. The HTTPS-specific redirect variants are unaffected.
Check applications using github.com/labstack/echo/v4 before 4.15.2 or github.com/labstack/echo/v5 before 5.1.1.