CVE-2026-47072: CRLF injection in WebSocket upgrade request in hackney

Published May 25, 2026
·
Updated

Summary

CRLF injection in hackney's WebSocket upgrade request builder (src/hackneyws.erl). init/1 copies the host, path, headers, and protocols options from the caller-supplied opts map verbatim into #wsdata{}, and dohandshake/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

dohandshake/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 as Name: Value\r\n with no sanitization of either component. - Request path (line 611): the path is interpolated into the GET <path> HTTP/1.1\r\n request 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

1. Call :hackneyws.startlink/1 with headers: [{"X-User", "v\r\nAuthorization: Bearer attacker"}]. 2. Connect to a raw TCP listener and capture the bytes hackney writes. 3. The request contains a standalone Authorization: Bearer attacker line 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

Introduction commit: https://github.com/benoitc/hackney/commit/690cecaf236fba49526da404a5bc889a24367a3e Patch commit: https://github.com/benoitc/hackney/commit/52310ca807e7b48441ba0e9129171f535313fdd1

Other sources

Improper Neutralization of CRLF Sequences ('CRLF Injection') vulnerability in benoitc hackney allows HTTP Request/Response Splitting. The WebSocket upgrade code in src/hackneyws.erl copies the host, path, headers (ExtraHeaders), and protocols options from the caller-supplied opts map into the internal #wsdata{} record in init/1 and then splices them verbatim into the raw HTTP/1.1 upgrade request by binary concatenation in dohandshake/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 hackneyws:startlink/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 before 4.0.1.

— MITRE

Affected Software

3 affected componentsFixes available
hexpm/hackney>=2.0.0<4.0.1
benoitc hackney>=2.0.0<4.0.1
erlang/hackney>=2.0.0<4.0.1
4.0.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade erlang/hackney to a version that resolves this vulnerability.

    Fixed in 4.0.1
  2. Upgrade

    Upgrade hackney to a version that resolves this vulnerability.

    Fixed in 4.0.1
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 690cecaf236fba49526da404a5bc889a24367a3e
  4. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch 52310ca807e7b48441ba0e9129171f535313fdd1

Event History

May 25, 2026
CVE Published
via MITRE·02:00 PM
Data Sourced
via MITRE·02:00 PM
DescriptionWeakness
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jun 26, 2026
Advisory Published
via GitHub·09:59 PM
Data Sourced
via GitHub·09:59 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-47072?

CVE-2026-47072 has a risk score of 65, indicating a medium level of severity.

2

How do I fix CVE-2026-47072?

To fix CVE-2026-47072, ensure proper neutralization of CRLF sequences in the WebSocket upgrade request parameters.

3

What software is affected by CVE-2026-47072?

CVE-2026-47072 affects the hackney library used in multiple applications for HTTP requests.

4

What type of vulnerability is CVE-2026-47072?

CVE-2026-47072 is a CRLF injection vulnerability, which allows for HTTP Request/Response Splitting.

5

When was CVE-2026-47072 published?

CVE-2026-47072 was published on May 25, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203