{"id":"EEF-CVE-2026-43966","summary":"HTTP Response Splitting via Non-VCHAR Bytes in cow_http_struct_hd:escape_string/2","details":"## Summary\n\nImproper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting') vulnerability in ninenines cowlib allows HTTP response splitting via non-VCHAR bytes in structured-fields string values.\n\n`cow_http_struct_hd:escape_string/2` in cowlib only escapes `\\` and `\"`, passing all other bytes through verbatim. This creates an encoder/decoder asymmetry: the matching parser accepts only printable ASCII (0x20–0x7E, excluding `\"` and `\\`), but the encoder emits any byte including CR and LF. An application that builds a structured HTTP header via `cow_http_struct_hd:item/1` (or a higher-level wrapper such as `cow_http_hd:wt_protocol/1`) from attacker-controlled input can have `\\r\\n` injected into the serialized header value. Once on the wire, the injected CRLF terminates the current header and any following bytes are interpreted as a new header, enabling HTTP response splitting.\n\nThis issue affects cowlib: from 2.9.0 before 2.22.0.\n\n## Workarounds\n\nValidate all values passed into structured-fields header builders (directly via `cow_http_struct_hd:item/1` or indirectly via higher-level wrappers) before calling the encoder. Reject any value that is not from a trusted, application-controlled source or that contains CR (`\\r`) or LF (`\\n`) bytes.\n\nApplications using cowboy 2.16.0 or later are protected on the server side by the `invalid_response_headers` option (defaults to `error_terminate`), which rejects any outgoing response header value containing CR or LF before it reaches the wire. Applications using gun 2.4.0 or later are protected on the client side by the `invalid_request_headers` request option (defaults to `raise`), which raises an exception when an outgoing request header value contains CR or LF.\n\n## Configurations\n\nThe application must pass attacker-controlled data as a string value into `cow_http_struct_hd:item/1` (or a wrapper that delegates to it). Applications that construct structured-fields header values exclusively from trusted, application-controlled values are not affected.","aliases":["CVE-2026-43966","GHSA-w4f7-4cxr-rv3c"],"modified":"2026-11-25T17:23:02.984738839Z","published":"2026-06-08T16:34:33.364Z","database_specific":{"capec_ids":["CAPEC-34"],"cpe_ids":["cpe:2.3:a:ninenines:cowlib:*:*:*:*:*:*:*:*"],"cwe_ids":["CWE-113"],"$schema":"https://cna.erlef.org/schemas/osv/record-0.1.0.json"},"references":[{"type":"WEB","url":"https://github.com/ninenines/cowboy/commit/f77cb9b5e730e300fffb551db1ba5d1c4ed878ef"},{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-43966.html"},{"type":"WEB","url":"https://github.com/ninenines/gun/commit/4f35609eb37109b106a863fc9ba83d7ee64e3e42"},{"type":"WEB","url":"https://github.com/ninenines/cowlib/commit/a8b793db3d6ffe91d62f81baf41b1dab4cd78fb6"},{"type":"FIX","url":"https://github.com/ninenines/cowlib/commit/4401b858f2229abb3ea115c60924f6c77e5f8aa3"},{"type":"PACKAGE","url":"https://hex.pm/packages/cowlib"}],"affected":[{"package":{"name":"cowlib","ecosystem":"Hex","purl":"pkg:hex/cowlib"},"ranges":[{"type":"SEMVER","events":[{"introduced":"2.9.0"},{"fixed":"2.22.0"}]}],"versions":["2.10.0","2.10.1","2.11.0","2.12.0","2.12.1","2.13.0","2.14.0","2.15.0","2.16.0","2.16.1","2.17.0","2.17.1","2.18.0","2.19.0","2.20.0","2.21.0","2.9.0","2.9.1"],"ecosystem_specific":{"program_files":["src/cow_http_struct_hd.erl"],"program_routines":["cow_http_struct_hd:escape_string/2","cow_http_struct_hd:bare_item/1"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json","modules":["cow_http_struct_hd"]},"database_specific":{"modules":["cow_http_struct_hd"],"program_files":["src/cow_http_struct_hd.erl"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-43966.json","program_routines":["cow_http_struct_hd:escape_string/2","cow_http_struct_hd:bare_item/1"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json"}},{"ranges":[{"type":"GIT","repo":"https://github.com/ninenines/cowlib","events":[{"introduced":"a8b793db3d6ffe91d62f81baf41b1dab4cd78fb6"},{"fixed":"4401b858f2229abb3ea115c60924f6c77e5f8aa3"}]}],"versions":["2.21.0","2.20.0","2.19.0","2.18.0","2.17.1","2.17.0","2.16.1","2.16.0","2.15.0","2.14.0","2.13.0","2.12.1","2.12.0","2.11.0","2.10.1","2.10.0","2.9.1","2.9.0"],"database_specific":{"program_files":["src/cow_http_struct_hd.erl"],"program_routines":["cow_http_struct_hd:escape_string/2","cow_http_struct_hd:bare_item/1"],"$schema":"https://cna.erlef.org/schemas/osv/affected-0.1.0.json","modules":["cow_http_struct_hd"],"source":"https://cna.erlef.org/osv/EEF-CVE-2026-43966.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N","source":"CNA"}],"credits":[{"name":"Peter Ullrich","type":"FINDER"},{"name":"Jonatan Männchen / EEF","type":"COORDINATOR"},{"name":"Loïc Hoguin","type":"REMEDIATION_DEVELOPER"}]}