The vulnerability is a classic case of Cross-Site WebSocket Hijacking (CSWSH) due to improper validation of the Origin header in WebSocket upgrade requests. The root cause was the httphelpers.IsSameOrigin function, which incorrectly trusted attacker-controllable headers like X-Forwarded-Host and X-Forwarded-Proto. This allowed a malicious website to forge these headers and bypass the same-origin policy, enabling it to establish a WebSocket connection to the victim's Kubetail dashboard and exfiltrate sensitive log data.
The patch addresses this by removing the trust in these headers and relying solely on the r.Host and r.TLS fields of the request. Additionally, a new function, httphelpers.IsAllowedOrigin, was introduced to allow for a configurable list of trusted origins, which is necessary for deployments behind reverse proxies. The vulnerable functions identified are all those that were involved in handling WebSocket connections and used the flawed IsSameOrigin function for origin validation.