AWS Lambda Sandbox Escape Stealing Cloud Keys with a File Read
A SaaS platform let users run custom Node.js code in shared AWS Lambda containers and tried to hide the Lambda's temporary AWS credentials by deleting them from the Node.js environment object. Because the native filesystem module was still available, a user could read the raw Linux process environment file and send the original AWS keys to an external server.
Hey everyone, I recently found a critical sandbox escape on a major SaaS platform during a bug bounty hunt. I want to share a quick write-up on how I bypassed their environment variable scrubbing to steal their backend AWS IAM credentials.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the platform scrubbed credentials only at the Node.js application layer while leaving the native filesystem module available, so the original environment variables remained readable from the Linux process environment file.
Impact
Depending on the Lambda role's permissions, an attacker could read other customers' data from S3, query DynamoDB tables, or move laterally within the cloud environment, which the author calls a complete multi-tenant isolation failure.
What the attacker needed
Ability to write custom Node.js code; ability to deploy and trigger the function; an external server to receive data
The fix
The text does not say it was fixed; it advises blocking native modules such as the filesystem module and using dedicated, hardware-isolated microVMs with heavily restricted IAM roles per customer instead of shared Lambda containers.
How it was found
- Write a custom Node.js handler on the platform.
- Use the filesystem module to read the raw Linux process environment file.
- Format the null-byte separated contents into readable lines.
- Send the formatted environment contents to an external webhook.
- Deploy and trigger the function, then inspect the received request body.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When code runs in the cloud, the cloud provider often gives it temporary keys so it can use other services. The platform tried to hide those keys by removing them from the list of settings the code can normally see. But the keys were still stored in a lower-level place on the machine, and the code was allowed to read that place directly.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.