{"id":"EEF-CVE-2026-65621","summary":"Unvalidated object metadata in ex_aws_s3 enables HTTP header (CRLF) injection into S3 requests","details":"## Summary\n\nex_aws_s3 builds `x-amz-meta-*` request headers by interpolating user-supplied object metadata directly into header names and values without any validation. In `ExAws.S3.Utils.build_meta_headers/1` (`lib/ex_aws/s3/utils.ex`), each `:meta` entry is turned into a header as `{\"x-amz-meta-#{k}\", v}` with no check for carriage return (CR), line feed (LF), or other illegal header bytes.\n\nObject metadata is routinely derived from end-user input (for example an upload service that lets users attach a comment or label to an object). When such input reaches `ExAws.S3.put_object/4` or any other operation accepting the `:meta` option, a value containing CR/LF is carried unchanged into the outbound header list. If the configured HTTP adapter does not neutralize header values before writing them to the socket, the embedded CRLF starts a new header line, allowing an attacker to inject arbitrary headers into (or split) the HTTP request the library sends to the S3 endpoint. This is an HTTP header (CRLF) injection leading to HTTP request splitting. The practical impact depends on the HTTP adapter, and no authentication is required beyond the ability to influence object metadata.\n\nThis issue affects ex_aws_s3: from 2.0.0 before 2.6.0.\n\n## Details\n\n**1. Unvalidated header construction.** `ExAws.S3.Utils.build_meta_headers/1` in `lib/ex_aws/s3/utils.ex` turns each `:meta` entry into `{\"x-amz-meta-#{k}\", v}`. Neither the key nor the value is checked for CR, LF or other illegal header bytes.\n\n**2. Untrusted metadata.** Object metadata is routinely populated from end-user input, such as a comment or label attached to an upload. A value like `\"legit\\r\\nX-Injected-By-Attacker: pwned\"` reaches the header list unchanged through `ExAws.S3.put_object/4` or any operation taking `:meta`.\n\n**3. Header injection.** If the HTTP adapter does not validate header values before writing them to the socket, the embedded CRLF ends the `x-amz-meta-*` line and starts a new one, injecting arbitrary headers into, or splitting, the request sent to S3. The library delegates this safety to the adapter entirely.\n\n## Proof of concept\n\n1. An upload service forwards user-supplied metadata: `ExAws.S3.put_object(\"victim-bucket\", \"uploads/file.txt\", \"hello\", meta: [{\"comment\", value}])`.\n2. The attacker sets the value to `legit\\r\\nX-Injected-By-Attacker: pwned\\r\\nX-Smuggled: yes`.\n3. `build_meta_headers/1` copies it verbatim into the `x-amz-meta-comment` header.\n4. With an adapter that does not reject CR/LF, the bytes on the wire contain `X-Injected-By-Attacker: pwned` and `X-Smuggled: yes` as separate header lines.\n\n## Impact\n\nThis is an HTTP header (CRLF) injection / request-splitting issue. Anyone using `ex_aws_s3` to store objects whose metadata is derived from untrusted input (upload services, multi-tenant file stores, anything exposing object metadata over an HTTP boundary) is affected. The practical impact depends on the configured HTTP adapter: adapters that validate header values will reject or strip the injection, but the library offers no guarantee and performs no validation of its own, so the safety of the request is silently delegated to the HTTP client.\n\n## Workarounds\n\nReject or strip carriage return (CR) and line feed (LF) characters from object metadata keys and values before passing them to ex_aws_s3, or configure an HTTP adapter that neutralizes CR/LF in header values before writing them to the socket (for example hackney 4.x).\n\n## Configurations\n\nThe vulnerability is only exploitable when an application both populates object `:meta` entries from untrusted input and uses an HTTP adapter that does not neutralize CR/LF in header values before writing them to the socket. The default adapter (hackney 4.x) strips CR/LF from header values, which masks the issue; the library performs no validation of its own and silently delegates safety to the configured HTTP client.","aliases":["GHSA-5887-vcfr-5ff8","CVE-2026-65621"],"modified":"2026-11-24T14:15:04.253423848Z","published":"2026-11-24T14:13:06.909Z","database_specific":{"capec_ids":["CAPEC-105"],"cpe_ids":["cpe:2.3:a:ex-aws:ex_aws_s3:*:*:*:*:*:*:*:*"],"cwe_ids":["CWE-113"]},"references":[{"type":"ADVISORY","url":"https://github.com/ex-aws/ex_aws_s3/security/advisories/GHSA-5887-vcfr-5ff8"},{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-65621.html"},{"type":"WEB","url":"https://github.com/ex-aws/ex_aws_s3/commit/4ce4d72219c0cb8de9356278203d8ea780311b75"},{"type":"FIX","url":"https://github.com/ex-aws/ex_aws_s3/commit/fa941106c2e3b10de8e710d1a03eeb673b88096c"},{"type":"PACKAGE","url":"https://hex.pm/packages/ex_aws_s3"}],"affected":[{"package":{"name":"ex_aws_s3","ecosystem":"Hex","purl":"pkg:hex/ex_aws_s3"},"ranges":[{"type":"SEMVER","events":[{"introduced":"2.0.0"},{"fixed":"2.6.0"}]}],"versions":["2.0.0","2.0.1","2.0.2","2.1.0","2.2.0","2.3.0","2.3.1","2.3.2","2.3.3","2.4.0","2.5.0","2.5.1","2.5.2","2.5.3","2.5.4","2.5.5","2.5.6","2.5.7","2.5.8","2.5.9"],"database_specific":{"source":"https://cna.erlef.org/osv/EEF-CVE-2026-65621.json"}},{"ranges":[{"type":"GIT","repo":"https://github.com/ex-aws/ex_aws_s3","events":[{"introduced":"4ce4d72219c0cb8de9356278203d8ea780311b75"},{"fixed":"fa941106c2e3b10de8e710d1a03eeb673b88096c"}]}],"versions":["v2.5.9","v2.5.8","v2.5.7","v2.5.5","v2.5.4","v2.5.3","v2.5.2","v2.5.1","v2.5.0","v2.4.0","v2.3.3","v2.3.2","v2.3.1","v2.3.0","v2.1.0","v2.0.2","v2.0.1","v2.0.0"],"database_specific":{"source":"https://cna.erlef.org/osv/EEF-CVE-2026-65621.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N","source":"CNA"}],"credits":[{"name":"Peter Ullrich","type":"FINDER"},{"name":"Peter Ullrich","type":"REPORTER"},{"name":"Jonatan Männchen / EEF","type":"ANALYST"},{"name":"Peter Ullrich","type":"COORDINATOR"},{"name":"Bernard Duggan","type":"REMEDIATION_DEVELOPER"}]}