{"id":"CVE-2026-47066","aliases":["CVE-2026-47066","GHSA-6cp8-v795-jr2j","EEF-CVE-2026-47066"],"related":[],"kind":"vulnerability","state":"published","title":"Infinite loop in Alt-Svc header parser in hackney","summary":"Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in benoitc hackney allows Excessive Allocation.\n\nThe 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.\n\nThe 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.\n\nThis issue affects hackney: from 2.0.0-beta.1 before 4.0.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in benoitc hackney allows Excessive Allocation.\n\nThe 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.\n\nThe 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.\n\nThis issue affects hackney: from 2.0.0-beta.1 before 4.0.1.","source":"cvelist"},{"lang":"en","text":"### Summary\n\n[CVE-2026-47066](https://nvd.nist.gov/vuln/detail/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.\n\n### Details\n\n**1. Parser dispatch**\n\n`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, [])`.\n\n**2. Failed token consumption**\n\n`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:\n\n```erlang\nparse_token(Rest, <<>>) -> {undefined, Rest}.\n```\n\nThis returns the *input unchanged* — no byte is consumed.\n\n**3. No-progress loop**\n\n`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:\n\n```erlang\nparse_entries(Data, Acc)  % Data identical to previous iteration\n```\n\nErlang tail recursion never preempts on a pure CPU loop, so the scheduler is pinned and the process never yields or returns.\n\n**4. Root cause**\n\n`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.\n\n### PoC\n\n1. Start an HTTP server that responds with the header `Alt-Svc: !` (any single non-token byte suffices).\n2. Issue any HTTP GET request via hackney to that server:\n   ```erlang\n   hackney:request(get, \"http://attacker.example/\", [], <<>>, [])\n   ```\n3. Observe that the call never returns; the Erlang scheduler hosting the connection process is pinned at 100% CPU indefinitely.\n\nAlternatively, call the parser directly: `hackney_altsvc:parse(<<\"!\">>)` — the process hangs immediately.\n\n### Impact\n\nDenial 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)**.\n\n## Resources\n\n* Introduction commit: https://github.com/benoitc/hackney/commit/408e5fe20302226ea8c74dde2bcbd452d712b5b2\n* Patch commit: https://github.com/benoitc/hackney/commit/e548aba1f97ffa3f4750da7b772998fb78c01894","format":"markdown","source":"ghsa"},{"lang":"en","text":"## Summary\n\nLoop with Unreachable Exit Condition ('Infinite Loop') vulnerability in benoitc hackney allows Excessive Allocation.\n\nThe 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.\n\nThe 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.\n\nThis issue affects hackney: from 2.0.0-beta.1 before 4.0.1.","format":"markdown","source":"eef"},{"lang":"es","text":"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.\n\nEl 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.\n\nEste problema afecta a hackney: desde 2.0.0-beta.1 antes de 4.0.1.","source":"nvd"}],"published":"2026-05-25T14:00:39.707Z","modified":"2026-11-25T17:23:07.622Z","severity":{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"EEF","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"Erlang Ecosystem Foundation","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-835"],"affected":[{"ranges":[{"type":"semver","introduced":"2.0.0-beta.1","fixed":"4.0.1","status":"affected"}],"vendor":"benoitc","product":"hackney","package":"hackney","cpe":"cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*","repo":"https://github.com/benoitc/hackney","source":"cvelist"},{"ranges":[{"type":"git","introduced":"408e5fe20302226ea8c74dde2bcbd452d712b5b2","fixed":"e548aba1f97ffa3f4750da7b772998fb78c01894","status":"affected"}],"vendor":"benoitc","product":"hackney","package":"benoitc/hackney","cpe":"cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*","repo":"https://github.com/benoitc/hackney","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.0.0","status":"affected","fixed":"4.0.1"}],"ecosystem":"Hex","package":"hackney","purl":"pkg:hex/hackney","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.0.0-beta.1","status":"affected","fixed":"4.0.1"}],"ecosystem":"Hex","package":"hackney","purl":"pkg:hex/hackney","source":"eef"},{"ranges":[{"type":"git","introduced":"408e5fe20302226ea8c74dde2bcbd452d712b5b2","status":"affected","fixed":"e548aba1f97ffa3f4750da7b772998fb78c01894"}],"repo":"https://github.com/benoitc/hackney","source":"eef"},{"ranges":[{"status":"affected","introduced":"2.0.0","fixed":"4.0.1"}],"vendor":"benoitc","product":"hackney","cpe":"cpe:2.3:a:benoitc:hackney:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/benoitc/hackney/security/advisories/GHSA-6cp8-v795-jr2j","tags":["advisory","exploit","patch","related","vendor-advisory","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://cna.erlef.org/cves/CVE-2026-47066.html","tags":["patch","related","third-party-advisory","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://osv.dev/vulnerability/EEF-CVE-2026-47066","tags":["patch","related","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/benoitc/hackney/commit/408e5fe20302226ea8c74dde2bcbd452d712b5b2","tags":["related","web"],"sources":["cvelist","eef","nvd"]},{"url":"https://github.com/benoitc/hackney/commit/e548aba1f97ffa3f4750da7b772998fb78c01894","tags":["fix","patch","web"],"sources":["cvelist","ghsa","eef","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47066","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/benoitc/hackney","tags":["package"],"sources":["ghsa"]},{"url":"https://hex.pm/packages/hackney","tags":["package"],"sources":["eef"]}],"credits":["Peter Ullrich","Jonatan Männchen / EEF","Benoit Chesneau"],"assigner":"EEF","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-26T15:50:47.725Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-47066","url":"https://www.cve.org/CVERecord?id=CVE-2026-47066","licence":"CVE Terms of Use","modified":"2026-11-20T06:48:50.309Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6cp8-v795-jr2j","url":"https://github.com/advisories/GHSA-6cp8-v795-jr2j","licence":"CC-BY-4.0","modified":"2026-06-26T22:00:09.483Z"},{"source":"eef","name":"Erlang Ecosystem Foundation","id":"EEF-CVE-2026-47066","url":"https://osv.dev/vulnerability/EEF-CVE-2026-47066","licence":"CC-BY-4.0","modified":"2026-11-25T17:23:07.622Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-47066","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47066","licence":"Public domain","modified":"2026-11-20T07:17:16.833Z"}],"updatedAt":"2026-11-25T22:59:22.272Z","epss":{"score":0.00753,"percentile":0.56282,"date":"2026-12-01T12:00:22.000Z"}}