AWS IAM Credential Exposure via a CRM Platform’s Custom Automation Feature
A CRM platform's custom code automation feature ran user-supplied code inside an AWS Lambda environment, exposing live temporary AWS IAM credentials for the execution role. Any authenticated user with the relevant permission could extract these credentials, potentially reaching other AWS resources depending on the role's policy.
Published on medium.com
Cybersecurity
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.
Context
The target is a CRM platform with an Enterprise-tier automation feature called "Custom Code Functions". It lets users build workflow automation by uploading code that runs as an AWS Lambda function: for example, "when a new record is created, run this code". The feature supports several runtimes (Python, Node.js, .NET, Ruby, Go), lets the user specify a handler name, and links the function to a workflow trigger.
The researcher found that any authenticated user holding the relevant permission could upload code that executes inside a real AWS Lambda environment belonging to the company, and that this environment exposes live AWS IAM temporary credentials for the execution role. The finding was reported through the vendor's responsible disclosure programme and resolved as a Duplicate: another researcher had already reported the underlying issue.
Setup
The preconditions are modest. The attacker needs an authenticated account on the CRM platform and the permission that allows creating custom code functions. The report does not say whether that permission is granted by default to ordinary users or only to some roles; it only notes that an administrator is not necessarily required. No special tooling is needed beyond the platform's own upload interface and a workflow trigger. The proof of concept used the Python 3.10 runtime, and the second test relied on boto3, which the report notes is available by default in the AWS Python Lambda runtime.
Finding it
Any feature that lets a user upload and run code is an interesting attack surface. The question the researcher asked was simple: where does this code actually execute, and what is reachable from inside it? Rather than starting with anything complex, the first test was whether user code has visibility into sensitive environment variables.
Exploitation
Step 1: A minimal payload that dumps the environment
The first payload returns the whole process environment as the function's response body:
import jsondef test_function(event, context): return { "statusCode": 200, "body": json.dumps(dict(__import__("os").environ)) }
The handler is named test_function, matching the handler name configured for the function. It imports os inline, converts os.environ to a plain dictionary and serialises it with json.dumps, returning a standard Lambda-style response object with statusCode and body. The researcher uploaded this as a Lambda function with Runtime Python 3.10, linked it to a simple workflow trigger (on record creation), and fired the trigger.
Step 2: The response
The response contained all environment variables from the AWS Lambda execution context, including:
The ASIA prefix on the access key ID is the marker of temporary STS credentials rather than long-lived IAM user keys. The researcher states these were live, valid AWS STS temporary credentials, not placeholder or test values.
Step 3: Confirming the credentials are real
To rule out noise, the next payload asks AWS itself who the credentials belong to, using boto3:
import boto3import jsondef test_function(event, context): sts = boto3.client('sts') identity = sts.get_caller_identity() return { "statusCode": 200, "body": json.dumps(identity) }
This creates an STS client with the ambient credentials and calls get_caller_identity(), which returns the identity associated with the credentials in use. The result confirmed it:
{ "UserId": "[REDACTED]", "Account": "[REDACTED]", "Arn": "arn:aws:sts::[REDACTED]:assumed-role/LambdaExecutionRole/[REDACTED]"}
The ARN shows the credentials belong to an assumed role named LambdaExecutionRole. The researcher notes that the generic role name, not scoped per function or per tenant, suggests it may be a shared role used across multiple Lambda functions.
Where the testing stopped
After confirming the credential exposure and the role's identity, the researcher deliberately stopped. There was no enumeration of the role's actual permissions (for example via iam:ListAttachedRolePolicies), no attempt to access other AWS resources, and no test of IMDS access. The stated reason is the boundary between proving the vulnerability, which is read-only and stays within the context the code was already executing in, and actively exploiting it, which uses the credentials to reach things outside that context. The researcher documented the first sufficient evidence and asked the triage team to confirm the role's permission scope internally instead.
Root cause
The core issue is not that credentials exist: every Lambda function has them by AWS design. The issue is that the execution role's credentials were fully accessible to arbitrary user-supplied code. The platform ran customer-uploaded code in a real Lambda environment, and the AWS-internal environment variables, including the execution role's credentials, were readable from that code. The report does not describe any sandboxing control that would have blocked reading the environment.
Impact
Any authenticated user with the relevant permission, not necessarily an administrator, could extract live AWS STS temporary credentials for the execution role. What those credentials unlock depends on the role's actual IAM policy scope: the researcher lists S3, DynamoDB and other Lambda functions as possibilities, but explicitly marks any path to other AWS resources within the company's account as untested and therefore unconfirmed. The researcher rated the issue High rather than Critical, because exploitation requires an authenticated user with a specific permission rather than unauthenticated access, and because the downstream impact was not directly tested.
The assessment given in the report is CWE-522 (Insufficiently Protected Credentials) with CVSS 3.0 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N, roughly 7.5, High.
Fix
The recommendations given are:
- Strip AWS-internal environment variables from the execution context exposed to user-supplied code.
- Run user-uploaded code under a tightly scoped, least-privilege role with minimal necessary permissions.
- Review and verify least-privilege IAM policy on the shared execution role.
- Block IMDS access and unnecessary outbound network access from within the user-code sandbox.
Variants to test
- Other runtimes in the same feature. Upload the equivalent of the environment dump in Node.js, .NET, Ruby or Go, since the feature supports all of them. A positive result is the same set of
AWS_*variables in the function's output. - Other serverless code-execution features. Look for any product feature that runs customer code on managed infrastructure (workflow steps, webhook transformers, custom connectors, scheduled jobs). A positive result is a response containing
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_SESSION_TOKEN, or the equivalent variables for another cloud provider. - Identity confirmation with the cloud's own API. Where the runtime ships an SDK by default, call the identity endpoint as in the report. A positive result is an ARN for an assumed role with a generic, non-tenant-specific name, which hints at a shared role.
- Metadata service reachability. From inside the sandbox, attempt to reach the instance metadata endpoint. A positive result is a response from the metadata service, which would indicate a second credential path; the report did not test this.
- Scope probing, only with programme authorisation. If the programme permits it, check what the role can actually do rather than assuming. A positive result is any permission beyond what the function needs, which turns a credential disclosure into a wider cloud access issue.
Closing thoughts
The most important lesson in the report is not technical: knowing when to stop is part of the job, not a limitation. Anyone can extract credentials once they find them; what separates a professional researcher from someone exploiting a vulnerability is that judgement call. The disclosure was made through the vendor's bug bounty programme, and public disclosure approval was obtained before the write-up was published.
What happened, in plain words
A security researcher found a way to make a customer relationship management (CRM) platform hand over secret cloud credentials to anyone who could use one of its automation features. The platform lets paying customers upload small pieces of code that run automatically as part of their workflows. That code runs on Amazon Web Services (AWS), and the environment it runs in contained live keys to the company's own AWS account. The researcher proved the keys were real, then stopped and reported the issue. The vendor closed it as a duplicate, meaning someone else had already reported the same underlying problem.
This article walks through the whole thing slowly, assuming you have never done security work before. Every technical word is explained the first time it appears, and there is a glossary at the end.
Background: what the product is and what the feature does
A CRM platform is software that companies use to keep track of their customers: names, deals, support tickets, emails and so on. Most modern CRM platforms include automation: rules that say "when something happens, do something else". A simple example is "when a new customer record is created, send a welcome email".
The feature at the centre of this report is called "Custom Code Functions", and it is only available on the Enterprise tier, the more expensive plan aimed at large organisations. Instead of picking from a list of ready-made actions, a user can upload their own code and have the platform run it as part of a workflow. The report gives the example "when a new record is created, run this code".
The feature supports several programming languages, called runtimes: Python, Node.js, .NET, Ruby and Go. A runtime is the software that actually executes code written in a particular language. The user also specifies a handler name, which is simply the name of the function inside the uploaded code that the platform should call when the workflow fires. The function is then linked to a workflow trigger, the event that starts it.
AWS Lambda, in one paragraph
AWS is Amazon's cloud computing service: instead of owning servers, companies rent computing power from Amazon. Lambda is one of those rented services. With Lambda you do not manage a server at all; you upload a function (a small piece of code) and AWS runs it whenever it is needed, then shuts it down. This is often called serverless computing, because you never see or touch the server. Each time a Lambda function runs, AWS gives it a temporary identity so the code can talk to other AWS services, such as storage or databases. That identity comes in the form of credentials, which are essentially a username and password pair for machines.
The vulnerability: what was wrong
Any feature that lets a user upload and run code is an interesting attack surface. Attack surface is a security term for all the places where someone could potentially interact with a system in an unintended way: every input, every feature, every door. A feature that runs arbitrary code is a very large door, because code can do almost anything the environment allows.
The researcher's core question was simple: where does this code actually execute, and what is reachable from inside it? In other words, when my uploaded code runs, what can it see and touch? That question is the whole investigation.
Step 1: Understanding the attack surface
Before writing anything complicated, the researcher thought about what to test. The reasoning was: if the platform runs my code inside its own AWS environment, then my code might be able to read things that belong to the platform rather than to me. The most obvious thing to check first is environment variables.
Environment variables are named values that the operating system or the runtime makes available to a running program. They are a bit like sticky notes attached to a process: the program can read them at any time. They are commonly used to pass configuration, such as a database address or, unfortunately, secrets. If a program can read its environment, it can read every sticky note attached to it.
Step 2: A simple proof of concept
A proof of concept (PoC) is a minimal demonstration that a suspected problem is real. The goal is not to build a full attack; it is to produce the smallest piece of evidence that settles the question. Here the question was: does my code have visibility into sensitive environment variables?
The researcher uploaded this code:
import jsondef test_function(event, context): return { "statusCode": 200, "body": json.dumps(dict(__import__("os").environ)) }
Line by line, in plain words:
import jsonloads Python's built-in JSON library. JSON is a text format for structured data, the same format used by most web APIs, so it is a convenient way to send data back.def test_function(event, context):defines a function namedtest_function. The name matters: it must match the handler name configured for the Lambda function, otherwise the platform would not know which piece of code to call.eventis the input data (for example, the record that triggered the workflow) andcontextis information about the current run.return { ... }sends back a response in the shape AWS Lambda expects: astatusCode(here 200, the standard code for success) and abodycontaining the actual data.json.dumps(...)converts a Python value into JSON text.dict(__import__("os").environ)is the interesting part.osis Python's module for talking to the operating system.os.environis the collection of all environment variables.__import__("os")imports that module inline, without a separateimport osline at the top.dict(...)turns the collection into a plain dictionary, a simple key-and-value structure thatjson.dumpscan convert to text.
So the whole payload does one thing: it takes every environment variable the running code can see and sends it back as the function's output.
The researcher uploaded this as a Lambda function with Runtime Python 3.10, linked it to a simple workflow trigger (on record creation), and fired the trigger. Firing the trigger just means causing the event that starts the workflow, for example by creating a record in the CRM.
Step 3: The result
The response contained all environment variables from the AWS Lambda execution context, including:
What these names mean:
AWS_ACCESS_KEY_IDis the identifier part of an AWS credential, a bit like a username.AWS_SECRET_ACCESS_KEYis the secret part, like a password. It must never be shown to anyone.AWS_SESSION_TOKENis an extra value used with temporary credentials. Temporary credentials are issued for a limited time and come as a set of all three values.AWS_LAMBDA_FUNCTION_NAMEis simply the name of the function that is running.
The ASIA prefix on the access key ID is the marker of temporary STS credentials rather than long-lived IAM user keys. STS stands for Security Token Service: the part of AWS that hands out short-lived credentials. IAM stands for Identity and Access Management: the part of AWS that decides who is allowed to do what. Long-lived keys, the kind a person might create once and keep for years, start with AKIA; temporary ones start with ASIA. The researcher states these were live, valid AWS STS temporary credentials, not placeholder or test values.
Confirming the credentials were real
Seeing something that looks like a key is not proof that it works. It could be a dummy value, a leftover from a test, or something the platform deliberately puts there. So the next step was to ask AWS itself who the credentials belong to. This is the equivalent of asking the lock who made the key: it confirms the key is genuine without opening anything.
The researcher used boto3, which the report notes is available by default in the AWS Python Lambda runtime. boto3 is the official Python library for talking to AWS services; it is pre-installed in Lambda's Python environment, so no extra setup was needed.
import boto3import jsondef test_function(event, context): sts = boto3.client('sts') identity = sts.get_caller_identity() return { "statusCode": 200, "body": json.dumps(identity) }
Line by line:
import boto3loads the AWS library.import jsonloads the JSON library, as before.def test_function(event, context):defines the handler, again matching the configured handler name.sts = boto3.client('sts')creates a client for the STS service. A client is an object that lets your code send requests to a service. Crucially, it automatically picks up the credentials from the environment, the same ones the previous test had exposed.identity = sts.get_caller_identity()asks AWS: "who am I with these credentials?" This is a read-only question; it does not change anything.return { ... }sends the answer back as JSON, in the same Lambda response shape as before.
The result confirmed it:
{ "UserId": "[REDACTED]", "Account": "[REDACTED]", "Arn": "arn:aws:sts::[REDACTED]:assumed-role/LambdaExecutionRole/[REDACTED]"}
UserIdis the unique identifier of the identity in use.Accountis the AWS account number the identity belongs to.Arnstands for Amazon Resource Name: a unique name for a resource in AWS. This one shows the credentials belong to an assumed role namedLambdaExecutionRole. A role is an identity that can be taken on temporarily, and an execution role is the role a Lambda function runs under, which determines what the function is allowed to do.
The researcher notes that the generic role name, not scoped per function or per tenant, suggests it may be a shared role used across multiple Lambda functions. In plain terms: if the role is shared across functions, then whatever that identity is allowed to do, each function running under it is allowed to do too.
Why this matters (impact)
The core issue is not that credentials exist: every Lambda function has them by AWS design, because the code needs them to talk to other AWS services. The issue is that the execution role's credentials were fully accessible to arbitrary user-supplied code. The platform ran customer-uploaded code in a real Lambda environment, and the AWS-internal environment variables, including the execution role's credentials, were readable from that code. A tenant is one customer organisation using the platform.
Any authenticated user with the relevant permission, not necessarily an administrator, could extract live AWS STS temporary credentials for the execution role. What those credentials unlock depends on the role's actual IAM policy scope: the researcher lists S3 (AWS's file storage service), DynamoDB (AWS's database service) and other Lambda functions as possibilities, but explicitly marks any path to other AWS resources within the company's account as untested and therefore unconfirmed.
The researcher rated the issue High rather than Critical, because exploitation requires an authenticated user with a specific permission rather than unauthenticated access, and because the downstream impact was not directly tested.
Where the testing stopped, and why
After confirming the credential exposure and the role's identity, the researcher deliberately stopped. There was no enumeration of the role's actual permissions (for example via iam:ListAttachedRolePolicies), no attempt to access other AWS resources, and no test of IMDS access. IMDS is the Instance Metadata Service, an internal address that cloud servers can use to obtain information about themselves, including credentials; reaching it from inside a sandbox would be a second way to get keys.
The stated reason is the boundary between proving the vulnerability, which is read-only and stays within the context the code was already executing in, and actively exploiting it, which uses the credentials to reach things outside that context. In everyday terms: it is one thing to show that a door is unlocked, and another to walk through it into rooms you were never invited into. The researcher documented the first sufficient evidence and asked the triage team to confirm the role's permission scope internally instead. Triage is the process a vendor uses to review and prioritise incoming reports.
Severity assessment
The assessment given in the report is CWE-522 (Insufficiently Protected Credentials) with CVSS 3.0 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N, roughly 7.5, High.
Two scoring systems appear here:
- CWE is a catalogue of weakness types. CWE-522 means credentials were not protected well enough.
- CVSS is a standard way of scoring how severe a vulnerability is, on a scale from 0 to 10. Each part of the string describes one aspect:
| Part | Meaning |
|---|---|
AV:N |
Attack Vector: Network. The attacker reaches the target over the internet. |
AC:L |
Attack Complexity: Low. No special conditions are needed. |
PR:L |
Privileges Required: Low. The attacker needs an account with some permission, not administrator rights. |
UI:N |
User Interaction: None. No victim has to click anything. |
S:U |
Scope: Unchanged. The impact stays within the same security boundary. |
C:H |
Confidentiality: High. Secrets can be read. |
I:N |
Integrity: None. Data cannot be changed. |
A:N |
Availability: None. The service cannot be knocked offline. |
The researcher rated this High rather than Critical, since exploitation requires an authenticated user with a specific permission (not unauthenticated access), and the actual downstream impact (the role's permission scope) was not directly tested.
Remediation recommendations
Remediation means fixing the problem. The report does not say what the vendor changed; it was closed as a duplicate of an earlier report. The recommendations given are:
- Strip AWS-internal environment variables from the execution context exposed to user-supplied code.
- Run user-uploaded code under a tightly scoped, least-privilege role with minimal necessary permissions. Least privilege is the principle of giving an identity only the permissions it actually needs, nothing more.
- Review and verify least-privilege IAM policy on the shared execution role.
- Block IMDS access and unnecessary outbound network access from within the user-code sandbox. A sandbox is an isolated environment where code can run without affecting the rest of the system.
Variants to test
If you wanted to look for the same kind of problem elsewhere, these are the directions the report suggests:
- Other runtimes in the same feature. Upload the equivalent of the environment dump in Node.js, .NET, Ruby or Go, since the feature supports all of them. A positive result is the same set of
AWS_*variables in the function's output. - Other serverless code-execution features. Look for any product feature that runs customer code on managed infrastructure (workflow steps, webhook transformers, custom connectors, scheduled jobs). A positive result is a response containing
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_SESSION_TOKEN, or the equivalent variables for another cloud provider. - Identity confirmation with the cloud's own API. Where the runtime ships an SDK by default, call the identity endpoint as in the report. An SDK is a software development kit, a set of ready-made tools for talking to a service. A positive result is an ARN for an assumed role with a generic, non-tenant-specific name, which hints at a shared role.
- Metadata service reachability. From inside the sandbox, attempt to reach the instance metadata endpoint. A positive result is a response from the metadata service, which would indicate a second credential path; the report did not test this.
- Scope probing, only with programme authorisation. If the programme permits it, check what the role can actually do rather than assuming. A positive result is any permission beyond what the function needs, which turns a credential disclosure into a wider cloud access issue.
Timeline
- Discovery and report submission: September 2026.
- Status: resolved as Duplicate, meaning a prior researcher had already reported the underlying issue.
Closing thoughts
The most important lesson in the report is not technical: knowing when to stop is part of the job, not a limitation. Anyone can extract credentials once they find them; what separates a professional researcher from someone exploiting a vulnerability is that judgement call. The disclosure was made through the vendor's bug bounty programme, and public disclosure approval was obtained before the write-up was published.
Glossary
- API: a defined way for one piece of software to ask another to do something, like a menu of requests a service accepts.
- ARN (Amazon Resource Name): a unique name that identifies a resource in AWS.
- Attack surface: all the places where someone could interact with a system in an unintended way.
- Authenticated user: someone who has logged in and proved who they are.
- AWS (Amazon Web Services): Amazon's cloud computing platform, where companies rent servers and services.
- AWS Lambda: an AWS service that runs small pieces of code on demand without you managing a server.
- boto3: the official Python library for talking to AWS services.
- CRM (customer relationship management): software for tracking customers, deals and interactions.
- CWE: a catalogue of weakness types used to label security bugs.
- CWE-522: the weakness "Insufficiently Protected Credentials".
- CVSS: a standard scoring system for the severity of a vulnerability, from 0 to 10.
- Credentials: the values that prove an identity, roughly a username and password for a machine.
- Duplicate: a report describing a problem that has already been reported.
- Environment variables: named values made available to a running program, often used for configuration and sometimes for secrets.
- Execution context: the environment in which a piece of code runs, including its variables and identity.
- Execution role: the AWS identity a Lambda function runs under, which determines what it may do.
- Handler: the name of the function inside uploaded code that the platform calls.
- IAM (Identity and Access Management): the AWS system that decides who may do what.
- IMDS (Instance Metadata Service): an internal cloud address that servers can query for information about themselves, including credentials.
- JSON: a text format for structured data, widely used by web services.
- Least privilege: giving an identity only the permissions it actually needs.
- Payload: the piece of code or data sent to a target to test or exploit it.
- Proof of concept (PoC): a minimal demonstration that a suspected problem is real.
- Remediation: the fix for a vulnerability.
- Role: an AWS identity that can be taken on temporarily.
- Runtime: the software that executes code written in a particular language.
- Sandbox: an isolated environment where code can run without affecting the rest of the system.
- SDK (software development kit): a set of ready-made tools for talking to a service.
- Serverless: a way of running code where the provider manages the servers and you only supply the code.
- STS (Security Token Service): the AWS service that issues short-lived credentials.
- Temporary credentials: credentials valid only for a limited time, issued as an access key ID, secret key and session token.
- Tenant: one customer organisation using a shared platform.
- Triage: the process a vendor uses to review and prioritise incoming security reports.
- Trigger: the event that starts a workflow or function.
- Workflow: an automated sequence of steps in a product, started by a trigger.