Check ID:
Provider: AWS
Service:
Severity: HIGH
Categories:
Resource type:
awslambda_function_using_cross_account_layersProvider: AWS
Service:
awslambdaSeverity: HIGH
Categories:
software-supply-chainResource type:
AwsLambdaFunctionWhat this check verifies
AWS Lambda functions use only layers published within the same AWS account, rather than layers owned by external accounts. A Lambda layer bundles shared code or dependencies that are injected into the function execution environment at runtime.Risk
A layer from an external account is a supply chain dependency outside your control. If that account is compromised or the layer is updated maliciously, every consumer function executes attacker code with its IAM role — a direct privilege escalation and lateral movement path across all functions using that layer.Recommendation
Eliminate cross-account layer dependencies by hosting all layers in your own AWS account.- Audit all layers with
aws lambda get-function-configurationand inspectLayers[].Arn - Extract the account ID from the ARN (field 5 in colon-split) and compare against your account
- For approved vendor layers, pin to a specific immutable version ARN and review on each update
- Enforce this via SCP: deny
lambda:UpdateFunctionConfigurationwhenlambda:LayerARN does not match your account ID
Remediation
- CLI
- Terraform
- Native IaC
- Dashboard steps
Copy the cross-account layer version into your own account first:
aws lambda publish-layer-version —layer-name <layer-name> —zip-file fileb://<layer.zip>Then update the function to use your own layer ARN:
aws lambda update-function-configuration —function-name <function-name> —layers <your-account-layer-arn>References
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
- https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html
- https://unit42.paloaltonetworks.com/lambda-layers-supply-chain/
Where this check fires
This check runs on every scheduled scan against your AWS account. Findings appear at Cloud Security → Findings filterable byCheck ID = awslambda_function_using_cross_account_layers. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to AWS checks