Join our Newsletter — 33% off our NHI Course

What happens when Lambda meets dependency confusion packages?

 

(@nhi-mgmt-group)
Member Moderator
Joined: 2 years ago
Posts: 19717
Topic starter  

TL;DR: A 24712-pl npm campaign turned dependency confusion into a serverless runtime issue, with Xygeni reporting eight packages and a postinstall hook aimed at AWS Lambda variables. Lambda builds now need namespace, install-script, and runtime-path controls as one surface because event handling can be intercepted before the handler runs.

Editorial analysis by NHI Mgmt Group, based on content published by Xygeni: “AWS Lambda npm Dependency Confusion Attack: The 24712-pl Campaign”.

Key questions

Q: Why do Lambda runtime variables increase the impact of a poisoned npm package?

A: Because they expose the runtime endpoint that serves invocation events.

Q: What do security teams get wrong about package install scripts?

A: They treat install scripts as minor convenience features instead of execution points.

Q: What breaks when a dependency confusion package runs inside a Lambda build path?

A: The build path stops being a safe staging area and becomes part of the attack surface.

Practitioner guidance

  • Restrict install-time scripts in trusted build paths Block or review preinstall, install, and postinstall execution for packages that can reach CI, container build, or Lambda layer environments.
  • Force private registry resolution for internal namespaces Pin internal package prefixes to private registries and reject public packages that mimic internal naming schemes such as numeric prefixes or version-like suffixes.
  • Monitor Lambda builds for runtime-variable access Alert when third-party packages read AWS_LAMBDA_RUNTIME_API or attempt to call the Lambda Runtime API during package installation.

Bottom line: Dependency confusion becomes more serious when the payload can run during install and interact with a cloud runtime rather than only loading into an application.

Glossary terms: Dependency Confusion, Preinstall Hook, Serverless Runtime API, Package Namespace Governance

Explore further

View Full Forum →  |  NHI Foundation Course →  |  Our Services →  |  Read the full analysis →


This topic was modified 2 days ago by NHI Mgmt Group

   
Quote
(@mr-nhi)
Member Moderator
Joined: 6 months ago
Posts: 20207
 

Install-time execution is now a first-class runtime risk: dependency confusion is no longer just a package selection mistake when the payload can consume serverless invocation events. The trust boundary has moved from import-time behavior to install-time behavior, and that matters wherever build systems, layers, or containers touch privileged cloud context. Teams should treat package installation as an execution phase with its own controls, not as a passive delivery step.

A question worth separating out:

Q: How should organisations respond when internal package names can be published publicly?

A: They should treat namespace control as an access-control problem. Internal package prefixes need registry pinning, approval controls, and monitoring for public lookalikes, because attackers can exploit naming collisions to get code executed in trusted pipelines. The goal is to make public impersonation ineffective before it reaches a build or deploy stage.

👉 Read our full editorial: Npm dependency confusion can hijack AWS Lambda runtime events



   
ReplyQuote
Share:

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.