6.9medium
CRLF injection in WebSocket upgrade request in hackney
- Severity
- 6.9medium CVSS:4.0 by EEF
- Exploit likelihood
- 0.52% (higher than 37% of CVEs)
- Published
- Last changed
- Assigned by
- EEF
- Also known as
- GHSA-f9vr-g2g2-x9fgEEF-CVE-2026-47072
Description
Improper Neutralization of CRLF Sequences ('CRLF Injection') vulnerability in benoitc hackney allows HTTP Request/Response Splitting. The WebSocket upgrade code in src/hackney_ws.erl copies the host, path, headers (ExtraHeaders), and protocols options from the caller-supplied opts map into the internal #ws_data{} record in init/1 and then splices them verbatim into the raw HTTP/1.1 upgrade request by binary concatenation in do_handshake/1. No CRLF or NUL stripping is performed at any of these four injection sites. An attacker who controls any of these options — for example by forwarding URL components or header values from untrusted input into hackney_ws:start_link/1 — can inject arbitrary HTTP headers into the outbound WebSocket upgrade request, leading to header injection, credential spoofing toward the upstream server, log and cache poisoning, or request smuggling via intermediary proxies. This issue affects hackney: from 2.0.0-beta.1 before 4.0.1.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| hackney | from 2.0.0-beta.1 before 4.0.1 | CVE List |
| benoitc/hackney | from 690cecaf236fba49526da404a5bc889a24367a3e before 52310ca807e7b48441ba0e9129171f535313fdd1 | CVE List |
| hackney (Hex) | from 2.0.0 before 4.0.1, from 2.0.0-beta.1 before 4.0.1 | GitHub Advisory Database, Erlang Ecosystem Foundation |
| https://github.com/benoitc/hackney | from 690cecaf236fba49526da404a5bc889a24367a3e before 52310ca807e7b48441ba0e9129171f535313fdd1 | Erlang Ecosystem Foundation |
| benoitc hackney | from 2.0.0 before 4.0.1 | NVD |
All scores
| EEF | 6.9medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:H/SA:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:H/SA:N |
| Erlang Ecosystem Foundation | Not scored CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:H/SA:N |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
Improper Neutralization of CRLF Sequences ('CRLF Injection') vulnerability in benoitc hackney allows HTTP Request/Response Splitting. The WebSocket upgrade code in src/hackney_ws.erl copies the host, path, headers (ExtraHeaders), and protocols options from the caller-supplied opts map into the internal #ws_data{} record in init/1 and then splices them verbatim into the raw HTTP/1.1 upgrade request by binary concatenation in do_handshake/1. No CRLF or NUL stripping is performed at any of these four injection sites. An attacker who controls any of these options — for example by forwarding URL components or header values from untrusted input into hackney_ws:start_link/1 — can inject arbitrary HTTP headers into the outbound WebSocket upgrade request, leading to header injection, credential spoofing toward the upstream server, log and cache poisoning, or request smuggling via intermediary proxies. This issue affects hackney: from 2.0.0-beta.1 before 4.0.1.
GitHub Advisory Database
Summary
CRLF injection in hackney's WebSocket upgrade request builder (src/hackney_ws.erl). init/1 copies the host, path, headers, and protocols options from the caller-supplied opts map verbatim into #ws_data{}, and do_handshake/1 splices them directly into the raw HTTP/1.1 upgrade request by binary concatenation with no \r\n or \0 stripping. A caller that passes any of these fields from untrusted input can inject arbitrary header lines into the outbound upgrade request.
Details
do_handshake/1 builds the upgrade request at several concatenation sites:
- Host header (lines 583–590): the host binary is written straight into
Host: <host>:<port>\r\n. - Sec-WebSocket-Protocol (lines 601–602): protocol tokens are joined with
,and appended as a header line. - Extra headers (line 606): caller-supplied
{Name, Value}tuples are concatenated asName: Value\r\nwith no sanitization of either component. - Request path (line 611): the path is interpolated into the
GET <path> HTTP/1.1\r\nrequest line.
None of these sites reject \r, \n, or \0. A header value like <<"benign\r\nAuthorization: Bearer token">> produces two distinct header lines on the wire. A path with an embedded \r\n rewrites the request line itself.
PoC
- Call
:hackney_ws.start_link/1withheaders: [{"X-User", "v\r\nAuthorization: Bearer attacker"}]. - Connect to a raw TCP listener and capture the bytes hackney writes.
- The request contains a standalone
Authorization: Bearer attackerline that the upstream WebSocket server parses as a legitimate header.
Impact
Header injection / request smuggling in outbound WebSocket upgrades. Affects hackney 2.0.0 through 4.0.0 wherever host, path, headers, or protocols options are populated from network or user input. Consequences include forging authentication headers toward the upstream server, log and cache poisoning, and request smuggling through intermediary proxies. CVSS v4.0: 6.9 (MEDIUM).
Resources
Erlang Ecosystem Foundation
Summary
Improper Neutralization of CRLF Sequences ('CRLF Injection') vulnerability in benoitc hackney allows HTTP Request/Response Splitting.
The WebSocket upgrade code in src/hackney_ws.erl copies the host, path, headers (ExtraHeaders), and protocols options from the caller-supplied opts map into the internal #ws_data{} record in init/1 and then splices them verbatim into the raw HTTP/1.1 upgrade request by binary concatenation in do_handshake/1. No CRLF or NUL stripping is performed at any of these four injection sites. An attacker who controls any of these options — for example by forwarding URL components or header values from untrusted input into hackney_ws:start_link/1 — can inject arbitrary HTTP headers into the outbound WebSocket upgrade request, leading to header injection, credential spoofing toward the upstream server, log and cache poisoning, or request smuggling via intermediary proxies.
This issue affects hackney: from 2.0.0-beta.1 before 4.0.1.
NVD (es)
La vulnerabilidad de Neutralización Inadecuada de Secuencias CRLF ('Inyección CRLF') en benoitc hackney permite la División de Solicitudes/Respuestas HTTP. El código de actualización de WebSocket en src/hackney_ws.erl copia las opciones de host, ruta, encabezados (ExtraHeaders) y protocolos del mapa de opciones (opts map) proporcionado por el llamador en el registro interno #ws_data{} en init/1 y luego los empalma textualmente en la solicitud de actualización HTTP/1.1 sin procesar mediante concatenación binaria en do_handshake/1. No se realiza ninguna eliminación de CRLF o NUL en ninguno de estos cuatro sitios de inyección. Un atacante que controla cualquiera de estas opciones - por ejemplo, reenviando componentes de URL o valores de encabezado de entrada no confiable a hackney_ws:start_link/1 - puede inyectar encabezados HTTP arbitrarios en la solicitud de actualización de WebSocket saliente, lo que lleva a la inyección de encabezados, suplantación de credenciales hacia el servidor ascendente, envenenamiento de registros y caché, o contrabando de solicitudes a través de proxies intermediarios. Este problema afecta a hackney: desde 2.0.0 antes de 4.0.1.
References
| https://github.com/benoitc/hackney/security/advisories/GHSA-f9vr-g2g2-x9fg | advisory, exploit, patch, related, vendor-advisory, web | |
| https://cna.erlef.org/cves/CVE-2026-47072.html | patch, related, third-party-advisory, web | |
| https://osv.dev/vulnerability/EEF-CVE-2026-47072 | patch, related, third-party-advisory, web | |
| https://github.com/benoitc/hackney/commit/690cecaf236fba49526da404a5bc889a24367a3e | related, web | |
| https://github.com/benoitc/hackney/commit/52310ca807e7b48441ba0e9129171f535313fdd1 | fix, patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-47072 | advisory | |
| https://github.com/benoitc/hackney | package | |
| https://hex.pm/packages/hackney | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-47072 changed 2026-11-20 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-f9vr-g2g2-x9fg changed 2026-06-26 | CC-BY-4.0 |
| Erlang Ecosystem Foundation | EEF-CVE-2026-47072 changed 2026-11-26 | CC-BY-4.0 |
| NVD | CVE-2026-47072 changed 2026-11-20 | Public domain |