SEVERITY NOT PROVIDED · CVSS 4.0 EPSS 0.3% · 16th percentile CWE-918

CVE-2026-59697: IMDSv2 metadata token request follows HTTP redirects in ex_aws

Published 2026-11-24 · Updated 2026-11-26 · Also known as EEF-CVE-2026-59697, GHSA-mww9-g5mj-j664

Summary

A Server-Side Request Forgery vulnerability in the ex_aws library allows IMDSv2 token requests to follow arbitrary HTTP redirects. Engineering teams using ex_aws version 2.3.0 up to 2.8.0 on AWS EC2 should update their dependencies.

Who is affected

Affected deployments are those running on AWS EC2 where applications fetch AWS credentials via the ex_aws instance metadata token provider. An attacker positioned on-segment who can spoof the link-local address can reply with a 3xx redirect to an arbitrary host, causing the application to cache and use an attacker-controlled token on subsequent requests.

Exploitability

The CVSS vector indicates an adjacent network attack vector with high attack complexity and no privileges or user interaction required, resulting in high confidentiality and integrity impact. The current EPSS score is 0.003, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-26. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Hex ex_aws >= 2.3.0, < 2.8.0 2.8.0 mix deps.update ex_aws

CVSS 4.0 vector

CVSS:4.0/AV:A/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N

Attack vectorAdjacent
Attack complexityHigh
Attack requirementsPresent
Privileges requiredNone
User interactionNone
Confidentiality (vulnerable system)High
Integrity (vulnerable system)High
Availability (vulnerable system)None
Confidentiality (subsequent systems)None
Integrity (subsequent systems)None
Availability (subsequent systems)None

Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.

FAQ

Which program files and routines are affected?

The vulnerability involves `lib/ex_aws/instance_meta_token_provider.ex` and routines `ExAws.InstanceMetaTokenProvider.request_token/1` and `ExAws.InstanceMetaTokenProvider.get/1`.

Do applications that source credentials via environment variables need to worry?

No. Applications that source credentials by other means, such as environment variables or explicit configuration, do not reach the vulnerable code path.

Is there active exploitation documented for this vulnerability?

No, CISA Known Exploited Vulnerabilities indicates this vulnerability is not currently tracked as actively exploited.

Original advisory description
## Summary Server-Side Request Forgery (SSRF) vulnerability in ex_aws (instance metadata token provider). This vulnerability is associated with program files `lib/ex_aws/instance_meta_token_provider.ex` and program routines `ExAws.InstanceMetaTokenProvider.request_token/1` and `ExAws.InstanceMetaTokenProvider.get/1`. ex_aws 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 ex_aws: from 2.3.0 before 2.8.0. ## Details **1. Token request.** `ExAws.InstanceMetaTokenProvider.request_token/1` sends the IMDSv2 `PUT` to the hard-coded link-local endpoint `http://169.254.169.254/latest/api/token` with `follow_redirect: true` in its HTTP options. AWS advises against following redirects on metadata requests, and IMDSv2's "PUT plus required header" design is itself an SSRF mitigation. **2. Redirect following.** Any `3xx` reply to the token request is followed by the HTTP client to whatever host its `Location` header names. Nothing restricts the redirect target to the link-local range, so the request can leave `169.254.169.254`. **3. Token acceptance.** The body returned by the final URL is accepted verbatim as the session token, cached in ETS, and sent as the `x-aws-ec2-metadata-token` header on every later metadata and credential request the library makes. Whoever answers the redirect therefore chooses both where the token request ends up and which value is used as the token. ## Proof of concept 1. The attacker is positioned to answer requests the instance sends to `169.254.169.254`, for example as an on-segment neighbor spoofing the link-local address. 2. The application obtains a metadata token through `ExAws.InstanceMetaTokenProvider.get/1`, which calls `request_token/1` and sends `PUT /latest/api/token` to the link-local endpoint. 3. The attacker answers the `PUT` with `302` and a `Location` header pointing at a host they control. 4. The HTTP client follows the redirect because ex_aws passed `follow_redirect: true`, and the attacker's host replies `200` with a chosen body such as `ATTACKER-CONTROLLED-SESSION-TOKEN`. 5. `get/1` returns that body as the IMDSv2 session token, and ex_aws caches it and sends it as `x-aws-ec2-metadata-token` on later metadata and credential requests. ## Configurations The application must obtain its AWS credentials from the EC2 Instance Metadata Service (IMDSv2) through the ex_aws instance metadata token provider. Applications that source credentials by other means (for example environment variables or explicit configuration) do not reach the vulnerable code path.

References

Source records: EEF-CVE-2026-59697 (OSV.dev) · EPSS by FIRST, 2026-11-26.