Independent analysis by NHI Mgmt GroupSource article: Plerion, “"But without PassRole it should be fine", Lambda edition” (March 27, 2026)

TL;DR: Lambda functions with privileged execution roles can be abused through configuration changes alone, even when attackers lack iam:PassRole and cannot update code, according to Plerion. That means update permissions, layer controls, and runtime wrappers must be treated as privilege-bearing access, not routine configuration.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on Plerion's blog post: Lambda configuration changes can expose privileged execution roles through layer attachment and wrapper injection even without iam:PassRole.

Why it matters: IAM teams need to treat function configuration rights as privileged access because they can inherit high-value machine permissions without touching the handler or passing a new role.


Context

In AWS Lambda, the security boundary is not just the handler code. Existing functions already hold an execution role, so a principal that can change configuration may be able to influence what runs under that identity without ever assigning a new role.

The governance gap is the assumption that role assignment is the only privilege boundary worth reviewing. In practice, a function with a privileged execution role becomes a reusable execution context, and configuration changes can turn that context into an attack path.

Treat environment variables and .env files as one part of a broader serverless exposure model, because Lambda configuration can modify both runtime behaviour and the values delivered to code at startup.


Key questions

Q: How do Lambda layers change the security model of a function?

A: Lambda layers add shared code and dependencies to a function, so the security model expands from the function package to include every layer it loads at runtime. A compromised or overly broad layer can influence execution, import behaviour and dependency trust, so teams should treat layer provenance, version control and permission to publish or attach layers as part of the function’s attack surface.

Q: What is the difference between PassRole and runtime configuration abuse?

A: PassRole is the permission to let a principal assign an IAM role to a service or resource, while runtime configuration abuse changes the function’s behaviour after deployment without changing role assignment. The first is an authorisation boundary issue, the second is a code, environment or parameter integrity issue, and both can let an attacker steer a function into using privileges they should not control.

Q: How should teams detect malicious Lambda startup changes?

A: Teams should detect malicious Lambda startup changes by monitoring configuration writes, deployment artefacts and runtime settings such as environment variables, layers and handler or wrapper values. A suspicious change in any of those can alter what code executes at cold start, so alerting should cover update events, drift from approved baselines and unexpected changes to the function bootstrap path.

Q: Can least privilege fail even when no new role is created?

A: Yes. Least privilege can fail when the active function code, environment or attached dependency is changed to exercise capabilities already granted within the runtime boundary. In that case the role may remain unchanged, but the function can still reach data, services or credentials that its legitimate execution path should not need.


Technical breakdown

Why PassRole does not protect an existing Lambda function

iam:PassRole controls the act of attaching a role to a resource. That matters at creation time, but it does not govern what happens when a role is already attached. In Lambda, a function that already has an execution role can still be modified through configuration fields that influence runtime behaviour. The core distinction is between assigning a role and running code under a role that already exists. Once the identity is in place, the attack surface shifts from provisioning to execution context. See the Privileged Access Management Guide.

Practical implication: Review configuration-change permissions as privileged access whenever a Lambda function runs with sensitive permissions.

How Lambda layers execute without touching the handler

Lambda layers are mounted under /opt and discovered by the runtime automatically. For Python, anything placed under /opt/extensions/ can be launched as an extension process during the Init phase, and the handler can remain unchanged. That makes layers a code-adjacent delivery mechanism rather than a simple dependency container. If a function allows arbitrary layer attachment, the runtime may execute attacker-controlled binaries or scripts before or alongside the business logic.

Practical implication: Restrict layer attachment to approved ARNs and sign any layer that is allowed to run in production.

How AWS_LAMBDA_EXEC_WRAPPER changes startup behaviour

AWS_LAMBDA_EXEC_WRAPPER is a reserved environment variable that tells Lambda to invoke a wrapper executable before the runtime bootstrap starts. The wrapper can inspect the environment, call cloud APIs, exfiltrate credentials, or alter startup flow before handing control back to the real bootstrap. Because the wrapper runs during cold start, the function can appear to behave normally while the malicious action has already happened. This is a runtime control point, not just a configuration flag. Read Environment Variables and .env Files.

Practical implication: Monitor configuration writes that introduce AWS_LAMBDA_EXEC_WRAPPER and block unapproved wrappers from production functions.


Threat narrative

Attacker objective: Steal the function's execution-role credentials and use them outside the target account.

  1. Entry occurs when a principal with lambda:UpdateFunctionConfiguration targets an existing Lambda function that already has a privileged execution role.
  2. Escalation happens when the attacker attaches a malicious layer or sets AWS_LAMBDA_EXEC_WRAPPER so attacker-controlled code runs during Init without changing the handler.
  3. Impact follows when the runtime exposes the function's execution-role credentials and the attacker uses them to write data into an external S3 bucket.
  • 230M AWS environment compromise: 230M AWS environments compromised via exposed .env files with cloud credentials.
  • CircleCI breach 2023: Malware stole a CircleCI engineer's SSO session; attackers exfiltrated customers' CI/CD secrets and keys, forcing a platform-wide rotation.

Read and download The State of NHI & AI Agent Breach Report 2026, covering 200+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Lambda configuration is a privileged access path, not a housekeeping surface. The assumption that only iam:PassRole can place a powerful identity on a resource is too narrow for serverless operations. Once a function already carries an execution role, configuration rights can steer execution inside that role without any new assignment step. Practitioners should treat configuration-change authority as part of the privileged perimeter, not as a secondary admin setting.

Function configuration creates an identity blast radius that is larger than code-only reviews assume. A privileged Lambda is not only a runtime artifact; it is an execution context that can be redirected through layers and wrapper variables. That means the effective control boundary is the combination of update rights, runtime hooks, and attached permissions. Security programmes that review code changes but not configuration mutations will miss the real escalation channel.

Least privilege for serverless should be judged by what the function can do after startup, not by whether the caller can pass a role. The article's key failure mode is a control model built around role assignment, while the attack lives inside an already-assigned role. That breaks the common governance premise that PassRole is the gate that matters most. The implication is that authorisation reviews need to include runtime-influencing configuration as first-class privilege.

Runtime hooks turn serverless execution into a policy question about who may alter startup semantics. Lambda extensions and wrapper variables are legitimate operational features, but they become an abuse path when update rights are too broad. This is a strong example of how infrastructure convenience can blur into identity abuse when the identity already has meaningful permissions. Practitioners should map every startup hook to an access decision, not just a deployment choice.

What this signals

Configuration drift is the new serverless escalation path. Teams that only watch for code replacement will miss changes that alter startup behaviour while leaving the handler intact. That shifts detection toward layer mutations, wrapper injection, and environment writes on sensitive functions.

Lambda governance now has to treat update permissions as identity-bearing access. When a function already holds secrets access, database write access, or other high-value permissions, the question is no longer whether a caller can pass a role. The question is whether they can change the way that role is exercised.

Startup semantics deserve the same review discipline as deployment pipelines. A layer or wrapper can be enough to turn an ordinary invocation into credential theft, so serverless security programmes need explicit controls around who may change runtime hooks.


For practitioners

  • Treat configuration updates as privileged access Review who can call lambda:UpdateFunctionConfiguration on functions that run with sensitive permissions, and place that permission under the same approval standard as handler replacement.
  • Restrict attachable layers to approved ARNs Use the lambda:Layer condition key or equivalent guardrails so only vetted layer versions can be attached to production functions.
  • Block unapproved runtime wrappers Alert on updates that set AWS_LAMBDA_EXEC_WRAPPER or introduce new environment variables on functions with elevated execution roles.
  • Scope execution roles to the smallest callable surface Limit each function to the minimum S3, DynamoDB, Secrets Manager, or other data permissions it truly needs so a compromised runtime has less to steal.

Key takeaways

  • The central risk is not role creation but role reuse inside an existing Lambda runtime with privileged permissions.
  • The article shows that configuration-only changes can be enough to reach execution-role credentials even when iam:PassRole is absent.
  • The control that matters most is who can change function configuration, attach layers, or alter startup hooks on privileged functions.

Related NHI Mgmt Group resources: Privileged Access Management Guide · Environment Variables and .env Files · Cloud Workload Identity Guide · Cloud IAM Review Checklist


Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and MITRE ATT&CK address the attack and risk surface, while NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-05 — Overprivileged NHIPrivileged Lambda execution roles can be abused through configuration changes that widen effective access.
NHI-06 — Insecure Cloud Deployment ConfigurationsLayer attachment and wrapper injection are cloud configuration paths that alter execution behaviour.
Recommendation — Apply overprivilege reviews to privileged Lambda functions and reduce the permissions their execution roles can exercise. Harden Lambda configuration controls so only approved layers, variables, and wrappers can be applied.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementExecution-role credentials are the protected authenticators at risk when startup hooks are abused.
Recommendation — Manage and restrict execution-role credentials with rotation, scoping, and revocation controls.
MITRE ATT&CKTA0006;TA0008 — Credential Access; Lateral MovementThe attack chain uses runtime changes to obtain role credentials and use them beyond the original function boundary.
Recommendation — Map Lambda configuration abuse to credential access and lateral movement detection in your hunting programme.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThe issue is excessive authorization to change privileged function behaviour.
Recommendation — Tighten entitlements for Lambda configuration changes on functions that hold sensitive permissions.

Key terms

  • Lambda extension layer: A Lambda extension layer is code that runs alongside a Lambda function in the same execution environment. For authorization, it can reduce network overhead and make policy checks behave more like a local call, but it also shares runtime resources with application logic.
  • AWS_LAMBDA_EXEC_WRAPPER: AWS_LAMBDA_EXEC_WRAPPER is an environment variable that tells AWS Lambda to run a wrapper executable before the function’s normal runtime starts. It is used to insert initialisation logic, instrumentation or policy checks into the bootstrap path, so changing it can alter what code runs at start-up.
  • IAM:PassRole: IAM:PassRole is an AWS permission that allows one principal to assign a role to a service or workload. It matters because it governs delegation, not direct role assumption, so a misconfiguration can let a low-privilege identity create a higher-privilege execution path.
  • Lambda Layer: A modular ZIP archive attached to an AWS Lambda function to add files, libraries, or runtime components without changing the function code. Layers are extracted into the execution environment at initialization time. Their contents and placement matter because they can introduce both useful dependencies and hidden trust risk.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on November 9, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org