---
id: "GHSA-cxf3-9h37-7rr8"
kind: "vulnerability"
aliases: ["GHSA-cxf3-9h37-7rr8"]
title: "Echo: Rejected WebSocket upgrades can bypass Echo route-level access controls"
severity: "critical"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "github.com/labstack/echo/v4", "fixed": ["4.16.1"], "affected": ">= 4.0.0, < 4.16.1", "ecosystem": "go"}, {"name": "github.com/labstack/echo/v5", "fixed": ["5.4.1"], "affected": ">= 5.0.0, < 5.4.1", "ecosystem": "go"}]
ecosystems: ["go"]
tags: ["cwe-444", "cwe-863", "echo", "go", "package", "reverse-proxy", "websocket"]
not_affected_if: ["no-proxy-middleware", "static-export", "upstream-enforces-own-auth"]
published_at: "2026-10-23T20:49:37+00:00"
first_seen_at: "2026-10-23T20:59:05+00:00"
updated_at: "2026-10-23T21:00:34+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-cxf3-9h37-7rr8", "first_seen_at": "2026-10-23T20:59:05+00:00"}]
---

# Echo: Rejected WebSocket upgrades can bypass Echo route-level access controls

Echo's Proxy middleware sends a WebSocket upgrade request straight into a raw tunnel before checking whether the upstream accepted it. If the upstream refuses the upgrade but keeps the connection open, later HTTP requests on that connection go straight to the upstream and skip Echo's route-level auth.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- go:github.com/labstack/echo/v4 affected >= 4.0.0, < 4.16.1 fixed 4.16.1
- go:github.com/labstack/echo/v5 affected >= 5.0.0, < 5.4.1 fixed 5.4.1

## How to check

Check whether the app imports github.com/labstack/echo/v4 below 4.16.1 or github.com/labstack/echo/v5 below 5.4.1 in go.mod (go list -m github.com/labstack/echo/v4).
Check whether any Echo route uses middleware.Proxy or ProxyWithConfig for a WebSocket-capable upstream that enforces auth only in Echo.

## Fix

Upgrade to github.com/labstack/echo/v4 v4.16.1 or github.com/labstack/echo/v5 v5.4.1.
Until then, reject WebSocket upgrade requests before they reach affected proxy routes, or enforce authorization on the upstream itself.

## Timeline

- 2026-10-23T20:59:05+00:00 ghsa https://github.com/advisories/GHSA-cxf3-9h37-7rr8

## From the sources

## Impact

Echo's Proxy middleware selected a raw tunnel when the client requested a WebSocket upgrade, before validating whether the configured upstream accepted it. If the upstream returned an ordinary HTTP response and kept the connection alive, subsequent HTTP requests on that connection were forwarded directly to the same upstream without passing through Echo's router or route-specific middleware.

This can bypass authentication or authorization enforced only at Echo's routes. Exploitation requires an accessible proxy route, an upstream that rejects the upgrade without closing the connection, and a target resource on that upstream without independent authorization. The issue does not provide arbitrary-host proxying or bypass the upstream's own authentication.

## Affected versions and patch

The raw proxy implementation is present throughout the v4 and v5 release lines up to v4.16.0 and v5.4.0. Runtime reproductions confirmed v4.15.0, v4.16.0, v5.0.0 and v5.4.0; source history also shows the missing upgrade-response validation in v4.0.0.

Upgrade to [v4.16.1](https://github.com/labstack/echo/releases/tag/v4.16.1) or [v5.4.1](https://github.com/labstack/echo/releases/tag/v5.4.1). The patch routes WebSocket upgrades through Go's HTTP reverse proxy and enters a tunnel only after a valid upstream upgrade response. Rejected upgrades remain ordinary HTTP requests.

Fix commits: [v4](https://github.com/labstack/echo/commit/3fb0ba7e17645bb65611e2a08875d0a2f65c421f), [v5](https://github.com/labstack/echo/commit/1855061e572ae9dab727c811d8382f266bfbaaec).

## Workarounds

Reject WebSocket upgrade requests before they reach affected Echo proxy routes, or enforce authorization independently at every upstream resource. Merely returning a non-101 response from the upstream does not prevent the vulnerable raw tunnel.

## Credits

Reported by @Duodum.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
