How the attack works
Every Lambda function has a resource-based policy that says who, apart from the identities of its own account, may use it. AddPermission adds a statement to that policy. The principal can be an AWS service (the normal case, for triggers), another AWS account, an IAM role or user, or a wildcard. A function URL is a second door: a dedicated HTTPS endpoint for the function, created with CreateFunctionUrlConfig, whose AuthType is either AWS_IAM or NONE. With NONE Lambda performs no authentication, and once the resource-based policy grants public access, anyone who has the URL can invoke the function. Layers have a policy of their own: AddLayerVersionPermission shares a layer version with one account, with an organization or with all AWS accounts.
An attacker who has reached an account uses this to keep a way back that does not depend on the compromised identity. The function keeps running with its execution role, so whatever it does for its callers it now does for the attacker: a function that changes IAM, reads secrets or returns data on request is a useful one to open. A shared layer exposes the code and whatever else was packed into it.
Lambda logs these calls as CloudTrail management events. AddPermission appears with the versioned name AddPermission20150331v2, so a rule on the plain API name finds nothing. CreateFunctionUrlConfig, UpdateFunctionUrlConfig and AddLayerVersionPermission are listed without a version suffix. Invocations are data events (Invoke, InvokeFunctionUrl), which CloudTrail does not log by default. AWS publishes no example record for these events: the rules read request fields that the Lambda API reference names, and say so. No public incident report was used for this page.
What an attacker needs
- Credentials for a principal allowed lambda:AddPermission on the function, or lambda:CreateFunctionUrlConfig or lambda:UpdateFunctionUrlConfig on it.
- For a layer, lambda:AddLayerVersionPermission on the layer version.
- A function worth calling from outside, which means one whose execution role or whose output is useful to the attacker.
Impact
An outside account, or anyone with the function URL, can run the function with its execution role for as long as the statement or the URL exists. What that is worth depends on the function: data it returns, actions it performs on input, or simply compute paid for by the owner. The access survives the cleanup of the compromised identity. A shared layer discloses its content to the accounts it was shared with.
Detection rules
Lambda Function Permission Granted to an AWS Account or IAM Principal
Detects Lambda AddPermission calls (logged as AddPermission20150331v2) whose principal is an AWS account ID or an ARN. Most AddPermission calls name an AWS service, because that is how triggers are wired, and those are not matched. A statement for an account, a role or a user gives that identity the right to use the function, and the Lambda API reference says this is how permission is granted to another account. The rule cannot tell whether the account is yours: compare the account ID with your own accounts, and read the Action of the request. The principal is read from requestParameters.principal, which follows the Principal parameter of the Lambda API reference: AWS publishes no example record for this event, so confirm the field in your own events. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Lambda Function Permission Granted to an AWS Account or IAM Principal
id: 0a42ab92-6d61-47bf-81f9-52746904ac1a
status: experimental
description: >-
Detects Lambda AddPermission calls (logged as AddPermission20150331v2)
whose principal is an AWS account ID or an ARN. Most AddPermission calls
name an AWS service, because that is how triggers are wired, and those are
not matched. A statement for an account, a role or a user gives that
identity the right to use the function, and the Lambda API reference says
this is how permission is granted to another account. The rule cannot tell
whether the account is yours: compare the account ID with your own
accounts, and read the Action of the request. The principal is read from
requestParameters.principal, which follows the Principal parameter of the
Lambda API reference: AWS publishes no example record for this event, so
confirm the field in your own events.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
- https://docs.aws.amazon.com/lambda/latest/api/API_AddPermission.html
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: aws
service: cloudtrail
detection:
selection_event:
eventSource: lambda.amazonaws.com
eventName|startswith: AddPermission20150331
selection_principal:
requestParameters.principal|re: '^([0-9]{12}|arn:.+)$'
condition: selection_event and selection_principal
falsepositives:
- Cross-account integrations inside your own organization, such as a central account that invokes functions in workload accounts, usually deployed by infrastructure-as-code. Add the deployment roles to a filter_* selection on userIdentity.arn.
- Statements for a role in the same account as the function.
level: medium
False positives
- Cross-account integrations inside your own organization, such as a central account that invokes functions in workload accounts, usually deployed by infrastructure-as-code. Add the deployment roles to a filter_* selection on userIdentity.arn.
- Statements for a role in the same account as the function.
Lambda Function Permission Granted to a Wildcard Principal
Detects Lambda AddPermission calls (logged as AddPermission20150331v2) whose principal is the wildcard. Such a statement lets every AWS principal use the function for the action it names, and together with a function URL whose auth type is NONE it lets anyone on the internet invoke the function. AWS's own example of a public function URL policy uses this principal. The rule does not read the conditions of the statement: a wildcard that is limited to one organization with PrincipalOrgID also matches. The principal is read from requestParameters.principal, which follows the Principal parameter of the Lambda API reference: AWS publishes no example record for this event, so confirm the field in your own events. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Lambda Function Permission Granted to a Wildcard Principal
id: a4b75788-5643-4559-8f38-21cb5138aafe
status: experimental
description: >-
Detects Lambda AddPermission calls (logged as AddPermission20150331v2)
whose principal is the wildcard. Such a statement lets every AWS principal
use the function for the action it names, and together with a function URL
whose auth type is NONE it lets anyone on the internet invoke the function.
AWS's own example of a public function URL policy uses this principal. The
rule does not read the conditions of the statement: a wildcard that is
limited to one organization with PrincipalOrgID also matches. The
principal is read from requestParameters.principal, which follows the
Principal parameter of the Lambda API reference: AWS publishes no example
record for this event, so confirm the field in your own events.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
- https://docs.aws.amazon.com/lambda/latest/api/API_AddPermission.html
- https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: aws
service: cloudtrail
detection:
selection_event:
eventSource: lambda.amazonaws.com
eventName|startswith: AddPermission20150331
selection_wildcard:
requestParameters.principal|re: '^\*$'
condition: selection_event and selection_wildcard
falsepositives:
- Deployments of public web endpoints on function URLs, which need exactly this statement. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on statements added by people or unknown roles.
- Statements that limit the wildcard to one organization with PrincipalOrgID. Read the request before closing the alert.
level: high
False positives
- Deployments of public web endpoints on function URLs, which need exactly this statement. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on statements added by people or unknown roles.
- Statements that limit the wildcard to one organization with PrincipalOrgID. Read the request before closing the alert.
Lambda Function URL Created or Changed Without Authentication
Detects CreateFunctionUrlConfig and UpdateFunctionUrlConfig calls that set the auth type of a function URL to NONE. A function URL is a dedicated HTTPS endpoint for a function, and with NONE Lambda performs no authentication before it invokes the function. The URL can receive requests once the resource-based policy of the function grants public access, which the console adds automatically and which is a separate AddPermission call elsewhere. AWS lists both calls among the events logged for function URLs. The auth type is read from requestParameters.authType, which follows the AuthType parameter of the Lambda API reference: AWS publishes no example record for these events, so confirm the field in your own events. The event names are matched by their start in case a version suffix is present. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Lambda Function URL Created or Changed Without Authentication
id: 15a8d803-059e-4ff7-b275-56e1f7e59575
status: experimental
description: >-
Detects CreateFunctionUrlConfig and UpdateFunctionUrlConfig calls that set
the auth type of a function URL to NONE. A function URL is a dedicated
HTTPS endpoint for a function, and with NONE Lambda performs no
authentication before it invokes the function. The URL can receive requests
once the resource-based policy of the function grants public access, which
the console adds automatically and which is a separate AddPermission call
elsewhere. AWS lists both calls among the events logged for function URLs.
The auth type is read from requestParameters.authType, which follows the
AuthType parameter of the Lambda API reference: AWS publishes no example
record for these events, so confirm the field in your own events. The
event names are matched by their start in case a version suffix is
present.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/lambda/latest/dg/urls-monitoring.html
- https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunctionUrlConfig.html
- https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: lambda.amazonaws.com
eventName|startswith:
- CreateFunctionUrlConfig
- UpdateFunctionUrlConfig
requestParameters.authType: NONE
condition: selection
falsepositives:
- Public web endpoints and webhooks that are built on function URLs on purpose. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on URLs created by people or unknown roles.
level: medium
False positives
- Public web endpoints and webhooks that are built on function URLs on purpose. Add the deployment roles to a filter_* selection on userIdentity.arn and keep alerting on URLs created by people or unknown roles.
Lambda Layer Version Shared with Other Accounts
Detects AddLayerVersionPermission calls, which add a statement to the resource-based policy of a Lambda layer version. AWS describes the call as the way to grant layer usage permission to other accounts: to one account, to all accounts of an organization, or to all AWS accounts. Every call is therefore a share. Whoever is admitted can download the layer, including code and anything else that was packed into it. Read the Principal and the OrganizationId of the request: a wildcard principal without an organization ID means all AWS accounts. AWS lists the call among the Lambda management events. The event name is matched by its start in case a version suffix is present. It also matches attempts that failed (errorCode present): check errorCode, because an unauthorized attempt is worth seeing.
title: Lambda Layer Version Shared with Other Accounts
id: 3024e666-b6c6-43e3-b3a5-4bffbab98c49
status: experimental
description: >-
Detects AddLayerVersionPermission calls, which add a statement to the
resource-based policy of a Lambda layer version. AWS describes the call as
the way to grant layer usage permission to other accounts: to one account,
to all accounts of an organization, or to all AWS accounts. Every call is
therefore a share. Whoever is admitted can download the layer, including
code and anything else that was packed into it. Read the Principal and the
OrganizationId of the request: a wildcard principal without an
organization ID means all AWS accounts. AWS lists the call among the Lambda
management events. The event name is matched by its start in case a
version suffix is present.
It also matches attempts that failed (errorCode present): check errorCode,
because an unauthorized attempt is worth seeing.
references:
- https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
- https://docs.aws.amazon.com/lambda/latest/api/API_AddLayerVersionPermission.html
- https://attack.mitre.org/techniques/T1098/003/
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: aws
service: cloudtrail
detection:
selection:
eventSource: lambda.amazonaws.com
eventName|startswith: AddLayerVersionPermission
condition: selection
falsepositives:
- Teams that publish shared layers for the accounts of their organization, or vendors that publish public layers on purpose. Add those roles to a filter_* selection on userIdentity.arn.
level: low
False positives
- Teams that publish shared layers for the accounts of their organization, or vendors that publish public layers on purpose. Add those roles to a filter_* selection on userIdentity.arn.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Function URL without authentication followed by a public invoke permission
A function URL with auth type NONE cannot be called until the resource-based policy grants public access. Outside the console that is a second call. The same principal making both for one function has finished opening it to the internet.
- A
CreateFunctionUrlConfigorUpdateFunctionUrlConfigevent fromlambda.amazonaws.comwhose request sets AuthType to NONE. Note the function name of the request and the caller inuserIdentity.arn. - Within 30 minutes the same caller makes an
AddPermission20150331v2call for the same function whose Principal is the wildcard and whose FunctionUrlAuthType is NONE. - Check what the execution role of the function can do and whether the caller is one of your deployment roles.
EventsCreateFunctionUrlConfigUpdateFunctionUrlConfigAddPermission20150331v2
LimitsEvery public web endpoint built on a function URL is deployed this way, so it is useful only for callers outside the deployment roles. The 30 minutes are a starting point. A URL created in the console has the policy added by Lambda, and how that appears in CloudTrail is not documented.
Function or layer permission names an account that is not yours
Granting one outside account the right to invoke a function is an ordinary call with an account ID in it. Whether the account belongs to an attacker or to a partner is not in the event and needs your own account list.
- Collect
AddPermission20150331v2andAddLayerVersionPermissionevents fromlambda.amazonaws.comand read the Principal of the request, which is an account ID or an ARN when it is not a service. - Extract the 12-digit account ID and compare it with the accounts of your organization and the third parties you have approved.
- Alert when the ID is on neither list, and when the Principal is a wildcard without an organization ID.
EventsAddPermission20150331v2AddLayerVersionPermission
LimitsIt needs a current list of your accounts and approved partners. The Principal comes from the Lambda API reference, and AWS publishes no example record that shows it, so confirm the field in your own events first.
Triage
- Identify the caller (userIdentity.arn), the source IP address and the user agent, and the function in requestParameters.functionName. Is the caller the pipeline that deploys this function?
- For AddPermission, read the Principal, Action, SourceArn, SourceAccount and PrincipalOrgID values of the request. An account ID that is not yours, or a wildcard without an organization ID, needs an owner and a reason.
- For a function URL, read the AuthType of the request, then read the resource-based policy of the function to see whether public invocation is allowed.
- Check what the execution role of the function can do, and what the function does with its input.
- Look for a function creation or a code or role change on the same function by the same caller shortly before.
Response
Once the attack is confirmed:
- Close the function. Remove the policy statement with RemovePermission, and delete the function URL or set its auth type back to AWS_IAM.
- Contain the identity that made the change by deactivating its access keys or revoking its role sessions.
- Review what the function did while it was open, using its logs and the CloudTrail activity of its execution role, and revoke the sessions of that role if the function could be made to act for the caller.
- Compare the code and configuration of the function with what the pipeline deployed, and redeploy it if they differ.
- Check the other functions and layers the identity could change for the same kind of statement or URL.
Mitigation
- Allow lambda:AddPermission, lambda:CreateFunctionUrlConfig and lambda:UpdateFunctionUrlConfig only to deployment roles, not to workload roles or developers in production accounts.
- Deny function URLs without authentication where you do not need them, with the condition key
lambda:FunctionUrlAuthTypein a service control policy or in identity policies. - When a statement names an AWS service as principal, set the source ARN or source account, so that resources in other accounts cannot invoke the function through that service.
- Review public and cross-account access to functions and layers with IAM Access Analyzer.
- Keep execution roles least-privilege, so that an opened function has little to offer.
Frequently asked questions
Why does a rule that matches the plain name AddPermission find nothing?
Lambda logs this call with a versioned event name, `AddPermission20150331v2`, and AWS lists it that way among the Lambda management events. A rule on the plain API name misses it. The rules on this page match the start of the versioned name, and do the same for the other Lambda events in case a suffix is present.
Does a function URL with auth type NONE mean that anyone can invoke the function?
Not by itself. AWS documents that the resource-based policy of the function is always in effect and must grant public access before the URL can receive requests. The console adds that policy automatically when the URL is created there. With the CLI or the API it is a separate AddPermission call, so look for both events.
Will CloudTrail show the invocations that came from outside?
Only if data events for Lambda are logged. `Invoke` and `InvokeFunctionUrl` are data events, and AWS documents that CloudTrail does not log them by default. Without that setting, use the logs of the function and the activity of the sessions of its execution role.
Has this been seen in real intrusions?
This page was not written from an incident report, and no public report that describes it at the audit event level was used. It follows what AWS documents about resource-based policies, function URLs and layer permissions.
References
- MITRE ATT&CK T1098.003: Account Manipulation: Additional Cloud Roles
- Logging AWS Lambda API calls using AWS CloudTrail (management events and versioned names)
- Monitoring Lambda function URLs
- Control access to Lambda function URLs
- Lambda API Reference: AddPermission
- Lambda API Reference: CreateFunctionUrlConfig
- Lambda API Reference: AddLayerVersionPermission