CVE-2026-59697: IMDSv2 metadata token request follows HTTP redirects in ex_aws
Server-Side Request Forgery (SSRF) vulnerability in exaws (instance metadata token provider).
This vulnerability is associated with program files lib/exaws/instancemetatokenprovider.ex and program routines ExAws.InstanceMetaTokenProvider.requesttoken/1 and ExAws.InstanceMetaTokenProvider.get/1.
exaws requests its IMDSv2 session token from the link-local metadata endpoint (http://169.254.169.254/latest/api/token) with HTTP redirect following enabled. Because the token request follows 3xx redirects and does not restrict the redirect target to the link-local range, an attacker who can influence the response to the metadata request (for example an on-segment neighbor spoofing the link-local address) can answer with a redirect to an arbitrary host. The library follows the redirect and accepts the arbitrary host's response body as the IMDSv2 session token, caching it and sending it as the x-aws-ec2-metadata-token header on every subsequent metadata and credential request.
This issue affects exaws: from 2.3.0 before 2.8.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
ex_awsto a version that resolves this vulnerability.Fixed in 2.8.0
Event History
Frequently Asked Questions
Which deployments are realistically exposed to this issue?
Deployments using ex_aws versions 2.3.0 through versions before 2.8.0 are affected when they obtain IMDSv2 tokens through the instance metadata token provider. Exploitation additionally requires an attacker to influence responses from the link-local metadata endpoint, such as an on-segment neighbor able to spoof that address.
What does an attacker gain by exploiting the redirect behavior?
An attacker can redirect the token request to an arbitrary host and cause its response body to be cached as the IMDSv2 session token. That attacker-controlled value is then sent in the x-aws-ec2-metadata-token header on subsequent metadata and credential requests.
Is there a configuration detail that makes this behavior possible?
The vulnerable token request has HTTP redirect following enabled and does not limit redirect destinations to the link-local metadata range. The issue occurs during requests to http://169.254.169.254/latest/api/token.
How can I determine whether my application is affected?
Check whether the application uses the hex/ex_aws package and its version is at least 2.3.0 but earlier than 2.8.0. Also determine whether the application uses ExAws.InstanceMetaTokenProvider to retrieve instance metadata tokens.