CVE-2026-43966

HTTP Response Splitting via Non-VCHAR Bytes in cow_http_struct_hd:escape_string/2

Published Jun 8, 2026 CVSS 4.0 · 6.3 Medium EPSS < 1% KEV · Not listed
Description
Improper 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.

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.

This issue affects cowlib: from 2.9.0 before 2.22.0.

Analysis

AI-generated

Technical impact

Improper Neutralization of CRLF Sequences in HTTP Headers, known as HTTP Request/Response Splitting, allows attackers to cause HTTP response splitting via non‑VCHAR bytes in structured‑fields string values. In cowlib, the function cow_http_struct_hd:escape_string/2 only escapes backslash and double‑quote characters, passing all other bytes through unchanged. This creates an encoder/decoder asymmetry: the parser accepts only printable ASCII characters, whereas the encoder can emit any byte, including carriage return and line feed. An attacker that supplies attacker‑controlled input to a header builder such as cow_http_struct_hd:item/1 or higher‑level wrappers like cow_http_hd:wt_protocol/1 can inject CRLF sequences into the serialized header value. When transmitted, the injected CRLF terminates the current header and turns any following bytes into a new header, enabling response‑splitting attacks that could lead to header injection, cache poisoning, or cross‑site scripting. This weakness is classified as CWE‑113.

Affected Systems

The vulnerability affects cowlib versions from 2.9.0 up to, but not including, 2.22.0. Applications that depend on cowlib directly, or through higher‑level frameworks such as cowboy 2.16.0+ and gun 2.4.0+, are potentially exposed. Practical mitigation is available through framework configuration: cowboy can use the invalid_response_headers option set to error_terminate, while gun can use invalid_request_headers set to raise. When these options are enabled they prevent the injection of CR or LF bytes; otherwise untrusted header values remain vulnerable.

Risk and Exploitability

With a CVSS score of 6.3 the vulnerability is considered moderate severity. The EPSS score is below 1%, indicating a very low probability of exploitation at present. It is not listed in the CISA KEV catalog, so no active exploitation has been reported. The attack requires an attacker to supply or influence header values constructed by the application – for example, by sending crafted requests that include untrusted input to be encoded into structured HTTP headers, which can then inject CRLF sequences and cause response splitting.

Remediation

Vendor Workaround

Validate 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. Applications 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.


OpenCVE Recommended Actions

  • Upgrade cowlib to the latest release that contains the fix for this splitting issue.
  • Validate all header values that pass through cow_http_struct_hd:item or higher‑level wrappers; reject or sanitize any value that is not from a trusted source or that contains CR or LF characters.
  • If using cowboy, set the invalid_response_headers option to error_terminate to reject untrusted header values before they are sent to the network. If using gun, configure the invalid_request_headers option to raise an exception whenever a request header contains CR or LF.

Generated by OpenCVE AI on November 9, 2026 at 17:05 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-w4f7-4cxr-rv3c cowboy and gun affected by an HTTP Request/Response Splitting vulnerability
History
Type Values Removed Values Added
Description Improper 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. 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. This issue affects cowlib: from 2.9.0 onward. Improper 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. 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. This issue affects cowlib: from 2.9.0 before 2.22.0.
Type Values Removed Values Added
Description Improper 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. 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. This issue affects cowlib from 2.9.0. Improper 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. 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. This issue affects cowlib: from 2.9.0 onward.
References
Type Values Removed Values Added
Metrics cvssV3_1

{'score': 5.3, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N'}

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description Improper 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. 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. This issue affects cowlib from 2.9.0.
Title HTTP Response Splitting via Non-VCHAR Bytes in cow_http_struct_hd:escape_string/2
First Time appeared Ninenines
Ninenines cowlib
Weaknesses CWE-113
CPEs cpe:2.3:a:ninenines:cowlib:*:*:*:*:*:*:*:*
Vendors & Products Ninenines
Ninenines cowlib
References
Metrics cvssV4_0

{'score': 6.3, 'vector': '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'}

Weaknesses
  • CWE-113

    Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting')

Sources

Status
PUBLISHED
Assigner
EEF
Published
Updated
Nov 9, 2026, 3:27 PM
Reserved
May 4, 2026, 6:23 PM
Status
Modified
Published
Jun 8, 2026, 5:16 PM
Modified
Nov 9, 2026, 4:17 PM