CVE-2026-47066
JSON

8.7high

Infinite loop in Alt-Svc header parser in hackney

Severity
8.7high CVSS:4.0 by EEF
Exploit likelihood
0.75% (higher than 56% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
EEF
Also known as
GHSA-6cp8-v795-jr2jEEF-CVE-2026-47066

Description

Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in benoitc hackney allows Excessive Allocation. The Alt-Svc response header parser in src/hackney_altsvc.erl does not guarantee forward progress. When parse_token/2 receives a non-token, non-whitespace, non-comma byte (e.g. !, @, =, ;), it returns the input unchanged. skip_comma/1 also returns the buffer unchanged when the first byte is not a comma. parse_entries/2 then recurses with identical data, creating a tight infinite tail-recursive loop that pins a scheduler at 100% CPU. The calling process never returns. The entry point parse_and_cache/3 is called synchronously in the connection process on every HTTP response. A single-byte Alt-Svc: ! response header is sufficient to trigger the hang; the header is fully controlled by any HTTP origin the client connects to. This issue affects hackney: from 2.0.0-beta.1 before 4.0.1.

Affected

Product or packageVersionsReported by
hackneyfrom 2.0.0-beta.1 before 4.0.1CVE List
benoitc/hackneyfrom 408e5fe20302226ea8c74dde2bcbd452d712b5b2 before e548aba1f97ffa3f4750da7b772998fb78c01894CVE List
hackney (Hex)from 2.0.0 before 4.0.1, from 2.0.0-beta.1 before 4.0.1GitHub Advisory Database, Erlang Ecosystem Foundation
https://github.com/benoitc/hackneyfrom 408e5fe20302226ea8c74dde2bcbd452d712b5b2 before e548aba1f97ffa3f4750da7b772998fb78c01894Erlang Ecosystem Foundation
benoitc hackneyfrom 2.0.0 before 4.0.1NVD

All scores

EEF8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Erlang Ecosystem FoundationNot scored CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-835

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in benoitc hackney allows Excessive Allocation. The Alt-Svc response header parser in src/hackney_altsvc.erl does not guarantee forward progress. When parse_token/2 receives a non-token, non-whitespace, non-comma byte (e.g. !, @, =, ;), it returns the input unchanged. skip_comma/1 also returns the buffer unchanged when the first byte is not a comma. parse_entries/2 then recurses with identical data, creating a tight infinite tail-recursive loop that pins a scheduler at 100% CPU. The calling process never returns. The entry point parse_and_cache/3 is called synchronously in the connection process on every HTTP response. A single-byte Alt-Svc: ! response header is sufficient to trigger the hang; the header is fully controlled by any HTTP origin the client connects to. This issue affects hackney: from 2.0.0-beta.1 before 4.0.1.

GitHub Advisory Database
Summary

CVE-2026-47066 is an infinite loop (CWE-835) in hackney's Alt-Svc response header parser (src/hackney_altsvc.erl). When an HTTP server returns an Alt-Svc header whose value begins with a non-token byte (e.g. !, @, =, ;), the parser enters a tight tail-recursive loop that pins an Erlang scheduler at 100% CPU and permanently hangs the calling connection process. Because the parser is invoked synchronously on every HTTP response, any attacker-controlled origin can trigger the hang with a single-byte header value.

Details

1. Parser dispatch

parse_and_cache/3 is called inside the hackney connection process on each HTTP response. It collects all Alt-Svc header values via collect_altsvc_headers/1, concatenates them, and passes the result to parse/1, which calls parse_entries(Header, []).

2. Failed token consumption

parse_entries/2 → parse_entry/1 → parse_protocol/1 → parse_token(Data, <<>>). The function parse_token/2 pattern-matches leading bytes: alphanumeric, -, _, whitespace, and comma all have explicit clauses. Any other byte (e.g. !) falls through to the catch-all:

parse_token(Rest, <<>>) -> {undefined, Rest}.

This returns the input unchanged — no byte is consumed.

3. No-progress loop

parse_entry propagates {undefined, Rest} back to parse_entries/2, which calls skip_comma(Rest). Because the first byte is not ,, skip_comma also returns Rest unchanged. parse_entries then recurses with the identical buffer:

parse_entries(Data, Acc)  % Data identical to previous iteration

Erlang tail recursion never preempts on a pure CPU loop, so the scheduler is pinned and the process never yields or returns.

4. Root cause

parse_entries/2 has no guard that detects zero-byte progress after a failed parse_entry call and no fallback to advance past the offending byte.

PoC
  1. Start an HTTP server that responds with the header Alt-Svc: ! (any single non-token byte suffices).
  2. Issue any HTTP GET request via hackney to that server:
    hackney:request(get, "http://attacker.example/", [], <<>>, [])
    
  3. Observe that the call never returns; the Erlang scheduler hosting the connection process is pinned at 100% CPU indefinitely.

Alternatively, call the parser directly: hackney_altsvc:parse(<<"!">>) — the process hangs immediately.

Impact

Denial of service via unbounded CPU consumption. Any application using hackney 2.0.0-beta.1 through 4.0.0 that connects to attacker-controlled HTTP endpoints is affected. No authentication is required; a single response header byte is sufficient to hang the connection process. Fixed in hackney 4.0.1. CVSS v4.0 score: 8.7 (HIGH).

Resources

Erlang Ecosystem Foundation

Summary

Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in benoitc hackney allows Excessive Allocation.

The Alt-Svc response header parser in src/hackney_altsvc.erl does not guarantee forward progress. When parse_token/2 receives a non-token, non-whitespace, non-comma byte (e.g. !, @, =, ;), it returns the input unchanged. skip_comma/1 also returns the buffer unchanged when the first byte is not a comma. parse_entries/2 then recurses with identical data, creating a tight infinite tail-recursive loop that pins a scheduler at 100% CPU. The calling process never returns.

The entry point parse_and_cache/3 is called synchronously in the connection process on every HTTP response. A single-byte Alt-Svc: ! response header is sufficient to trigger the hang; the header is fully controlled by any HTTP origin the client connects to.

This issue affects hackney: from 2.0.0-beta.1 before 4.0.1.

NVD (es)

Vulnerabilidad de bucle con condición de salida inalcanzable ('Bucle Infinito') en benoitc hackney permite asignación excesiva. El analizador de encabezados de respuesta Alt-Svc en src/hackney_altsvc.erl no garantiza el progreso hacia adelante. Cuando parse_token/2 recibe un byte que no es un token, no es un espacio en blanco, no es una coma (p. ej. '!', '@', '=', ';'), devuelve la entrada sin cambios. skip_comma/1 también devuelve el búfer sin cambios cuando el primer byte no es una coma. parse_entries/2 luego recurre con datos idénticos, creando un bucle recursivo de cola infinito y ajustado que fija un planificador al 100% de CPU. El proceso de llamada nunca regresa. El punto de entrada parse_and_cache/3 se llama sincrónicamente en el proceso de conexión en cada respuesta HTTP. Un encabezado de respuesta Alt-Svc: '!' de un solo byte es suficiente para activar el bloqueo; el encabezado está totalmente controlado por cualquier origen HTTP al que se conecta el cliente. Este problema afecta a hackney: desde 2.0.0-beta.1 antes de 4.0.1.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-47066 changed 2026-11-20CVE Terms of Use
GitHub Advisory DatabaseGHSA-6cp8-v795-jr2j changed 2026-06-26CC-BY-4.0
Erlang Ecosystem FoundationEEF-CVE-2026-47066 changed 2026-11-25CC-BY-4.0
NVDCVE-2026-47066 changed 2026-11-20Public domain