Executive brief
Gun is an HTTP client library for Erlang/Elixir applications. A vulnerability in its HTTP/2 implementation allows a malicious server to inject cookies for unrelated third-party websites into the client's cookie store. This could allow an attacker to hijack user accounts or perform session fixation attacks on other services the application interacts with.
Technical details
The vulnerability exists in the gun_http2:push_promise_frame/7 function, where the :authority pseudo-header from an incoming PUSH_PROMISE frame is stored without verifying it matches the connection's origin. When gun_http2:headers_frame/9 subsequently processes response headers, it calls gun_cookies:set_cookie_header/7 using this unvalidated authority. This behavior violates RFC 9113 §8.4, which requires clients to reject pushes for resources the server is not authoritative for. An attacker-controlled HTTP/2 server can exploit this to plant cookies for arbitrary domains in the client's shared cookie store, facilitating session fixation or account takeover. The issue is fixed in version 2.4.0.
Affected products
- ninenines gun >= 2.0.0, < 2.4.0
Timeline
- 2026-06-08: disclosed
- 2026-06-08: advisory
- 2026-07-29: patched: GitHub advisory updated with patch details