CVE-2026-63582: S3 bucket name controls the host of presigned URLs in ex_aws_s3
Summary
Externally Controlled Reference to a Resource in Another Sphere vulnerability in ex-aws exawss3 allows an attacker who controls an S3 bucket name to make presigned URLs and presigned POST forms point at a host of their choice.
With virtualhost: true, s3accelerate: true or bucketashost: true, ExAws.S3.presignedurl/5 and ExAws.S3.presignedpost/4 build the URL from the bucket name without checking it. A bucket such as attacker.example/x? turns the URL into https://attacker.example/x?.s3.amazonaws.com..., and the signature is computed for that host. Clients given the URL upload their files to, or download content from, the attacker's host, and every such URL discloses the access key id. With bucketashost: true any valid hostname works as the bucket name.
This issue affects exawss3: from 2.0.0 before 2.6.0.
Details
1. URL construction. The private urltosign/5 in lib/exaws/s3.ex builds the URL for presignedurl/5 and presignedpost/4 as "#{scheme}#{bucket}.#{host}#{port}#{object}" when virtualhost is set, or "#{scheme}#{bucket}#{port}#{object}" with bucketashost. s3accelerate: true sets virtualhost and takes the same branch. The bucket name is not checked.
2. Signing for the attacker's host. The string goes to ExAws.Auth.presignedurl/9, which signs URI.parse(url).authority. For the bucket attacker.example/x? the signed host is attacker.example, and the ? pushes the object key into the query string.
3. Effect. Presigned URLs are built locally and never pass through ExAws.Operation.S3.addbuckettopath/2, so the fix in exaws for the request path does not cover them. A browser submitting the presigned POST sends its upload to the attacker, a client following a presigned GET receives attacker content, and X-Amz-Credential discloses the access key id. The secret key is not disclosed and the signature cannot be replayed against AWS.
Proof of concept
1. An application presigns uploads for per-tenant buckets with virtualhost: true. 2. A tenant sets its bucket name to attacker.example/x?. 3. ExAws.S3.presignedurl(config, :put, bucket, "key", virtualhost: true) returns https://attacker.example/x?.s3.amazonaws.com%2Fkey=&X-Amz-Credential=..., and presignedpost/4 returns the form action https://attacker.example/x?.s3.amazonaws.com. 4. URI.parse/1 on either yields the host attacker.example, so any client given the URL or form connects there.
Impact
An attacker who can choose the bucket name makes the application hand out presigned URLs and POST forms that point at the attacker's host. Files other users upload through those forms go to the attacker, presigned downloads serve attacker-controlled content under the application's name, and every such URL discloses the access key id. Applications that presign for per-tenant or user-supplied buckets with virtual-host addressing are affected.
Configurations
Reachable only when presigned URLs or POST forms are generated with virtualhost: true, s3accelerate: true or bucketashost: true and the application passes a bucket name an attacker can influence, for example per-tenant or user-supplied buckets. Path-style presigning, the default, places the bucket in the path and is not affected.
Solutions
Upgrading rejects bucket names containing characters that can change the host of a presigned URL. With bucketashost: true, a syntactically valid hostname is still used as the host after upgrading: applications that presign with bucketashost: true and bucket names they do not fully control must also pass the bucketashostallowlist option, or set it in the S3 config, with the list of trusted hostnames.
Other sources
Externally Controlled Reference to a Resource in Another Sphere vulnerability in ex-aws exawss3 allows an attacker who controls an S3 bucket name to make presigned URLs and presigned POST forms point at a host of their choice.
With virtualhost: true, s3accelerate: true or bucketashost: true, ExAws.S3.presignedurl/5 and ExAws.S3.presignedpost/4 build the URL from the bucket name without checking it. A bucket such as attacker.example/x? turns the URL into https://attacker.example/x?.s3.amazonaws.com..., and the signature is computed for that host. Clients given the URL upload their files to, or download content from, the attacker's host, and every such URL discloses the access key id. With bucketashost: true any valid hostname works as the bucket name.
This issue affects exawss3: from 2.0.0 before 2.6.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
erlang/ex_aws_s3to a version that resolves this vulnerability.Fixed in 2.6.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.6.0 - Configuration
When presigning with bucket_as_host: true and bucket names you do not fully control, pass bucket_as_host_allowlist or set it in the S3 config to allow only trusted hostnames.
ex_aws_s3 bucket_as_host_allowlist = list of trusted hostnames
Event History
Frequently Asked Questions
Which applications are exposed?
Applications using ex_aws_s3 versions 2.0.0 through before 2.6.0 are exposed when they generate presigned URLs or presigned POST forms with virtual_host: true, s3_accelerate: true, or bucket_as_host: true and an attacker can control the bucket name. With bucket_as_host: true, any valid hostname can be used as the bucket name.
What does an attacker need to exploit this?
The attacker needs control over a bucket-name value used when calling ExAws.S3.presigned_url/5 or ExAws.S3.presigned_post/4 under an affected host-building option. They can craft a bucket value that causes the generated URL to target a host they control.
What is exposed when a malicious presigned URL is generated?
Clients receiving the URL may upload files to, or download content from, the attacker-controlled host rather than the intended S3 destination. Each generated URL also discloses the access key ID.
How can exposure be reduced before upgrading?
Do not allow untrusted input to control bucket names used for presigned URL or presigned POST generation. Avoid the affected virtual_host, s3_accelerate, and bucket_as_host settings where they are used with attacker-influenced bucket names.