Dependabot and Renovate PRs get merged automatically once CI passes. AI agents are left to update lockfiles. There are reported cases where setups like these, which pull in new dependency versions automatically, pulled in a version that contained malware.1
You cannot tell whether a version contains malware from how its version number changes. In past cases, the malicious versions were published as patch or minor releases, the same as ordinary updates.2 Limiting auto-merge to patch and minor does not keep them out.
This article lays out where such malware runs and what it does, then looks at settings that reduce the damage and at the logs you need to notice that it ran.
How new versions get pulled in automatically
New dependency versions get pulled in automatically in three ways.
- Auto-merging Dependabot or Renovate PRs
- A person or an AI agent bumping the lockfile with
uv lock --upgradeornpm update - Referencing GitHub Actions or container images by tag. What a tag points to can be changed later3
Auto-merge has settings that wait a number of days after a release before updating (Dependabot's cooldown,4 Renovate's minimumReleaseAge5). They do not check whether a version contains malware. They only mean that if the version is removed from the registry during the wait, you never pull it in. Lockfile updates and tag references are not covered by these settings. There is a limit to what can be stopped before it comes in, so you need settings that reduce the damage after it does, and logs for noticing that it ran.
Where malware runs and what it does
Malware does not run only in production, and the damage is not limited to exfiltration.
Where it runs
Malware that runs at install time (npm preinstall, postinstall, and so on) runs wherever dependencies are installed: CI, Docker builds, and local machines.6 Malware that runs when the package is loaded or when Python starts also runs in production.7
What happens
Exfiltration
It can steal the credentials present where it runs:8 in CI, tokens in environment variables and secrets passed to Docker builds;9 on local machines, credential files on disk;10 in production, credentials passed to the process and credentials available from the cloud metadata service.
Cryptocurrency mining
The malware uses the CPU where it runs to mine cryptocurrency.11
Deleting and encrypting files
The malware deletes12 or encrypts files it can write to. Ransomware that encrypts files and demands payment has so far appeared in fake packages with lookalike names.13
Stopping processes
A process that loads the dependency stops responding, for example because of an infinite loop.14
Settings that reduce the damage
The settings below assume CI runs on GitHub Actions and production runs in Docker containers. Local machines are not covered, because each developer's environment is different.
Turn off install scripts
Install-time malware does not run if install scripts are turned off when CI and Docker builds install dependencies. With npm, add --ignore-scripts.15 Since v10, pnpm does not run them by default.16 This does not stop malware that runs at load time or at startup.
Reduce what can be exfiltrated
In GitHub Actions, reduce the credentials passed to jobs.
- Limit
GITHUB_TOKENto the permissions it needs, usingpermissionson the workflow or job17 - Put deploy secrets in an environment. Environment secrets are passed only to jobs that use that environment18
- Deploy to the cloud with OIDC, so no long-lived credentials sit in secrets.19 Publishing to npm with trusted publishing also needs no long-lived token20
In Docker builds, do not pass secrets through ARG. Use RUN --mount=type=secret to pass them only to the RUN that uses them.9 In production, pass a container only the environment variables it uses through docker run.
Limit mining
Set a CPU limit with docker run --cpus. By default there is no limit; with one, the container is throttled when it goes over.21 The mining does not stop, but CPU is left for the other containers.
Prepare for deletion and encryption
Switch to a non-root user with USER in the Dockerfile, and make the root filesystem read-only with docker run --read-only. Put the paths that need writes on volumes,22 and make sure they can be restored from backup.
Prepare for stopped processes
With a HEALTHCHECK in the Dockerfile, a container that does not respond becomes unhealthy.23 Only the status changes, so make the deploy procedure stop the old container only after the container running the new version becomes healthy.
Logs for noticing that it ran
What Docker keeps is the container's stdout and stderr (docker logs) and events such as container start and exit (docker events).24 To notice DNS queries, outbound connections, and file changes, you need something separate that records them.
Noticing exfiltration
Exfiltration does not require starting a new process, so it does not necessarily show up in a record of process starts. Record DNS queries and outbound connections in a form that shows which container they came from.
Records of stolen credentials being used are left where they were used. For cloud credentials, check the cloud's API call logs. For an npm token, check the list of published versions. For a database password, check the database's connection log.
Noticing mining
Check that CPU usage per container is being recorded. With a limit in place, usage sits at the limit and does not come down.
Noticing deletion and encryption
Record which processes started and which files they modified.
Noticing stopped processes
docker events shows container starts and exits and changes in health_status. Without --since, though, it only shows events from that point on, and there is a cap on how many past events it returns, so ship the events elsewhere and keep them.25
Which version ran where
When you see a malware report, check where that version has been running in your environment, and since when. GitHub Actions workflow run logs are kept for 90 days by default.26 Keep the deploy times, along with the commit and the image digest for each deploy, for longer than that. If images are referenced by digest, what is running is pinned.3
I think the size of the damage is decided by what you put where the malware runs and what you allow there. If you keep pulling in dependencies automatically, I would cut the credentials passed to jobs and the permissions given to containers before lengthening the cooldown.
-
GitGuardian. ↩
-
Patch releases: chalk and debug (Aikido), LiteLLM 1.82.7 and 1.82.8 (litellm#24518). Minor release: LiteLLM 1.107.0 (Flatt Security). ↩
-
For GitHub Actions, the Secure use reference says action tags can be moved or deleted. A container image referenced by digest is pinned to the same image (the
docker image pullreference). ↩ -
Dependabot options reference. Since 2026-07-14, a 3-day cooldown applies even when none is configured (changelog). ↩
-
Renovate's minimumReleaseAge. It does not apply unless configured. ↩
-
One example is Shai-Hulud 2.0, which ran in
preinstall(Datadog Security Labs). ↩ -
One example is LiteLLM 1.82.8, which used a
.pthfile and ran every time Python started (litellm#24512). ↩ -
LiteLLM 1.82.8 collected environment variables with
printenvand sent them out (litellm#24512). ↩ -
Secrets mounted with
RUN --mount=type=secretare placed at/run/secrets/<id>only for the duration of thatRUN, so install-time malware running in thatRUNcan read them too (Docker documentation, Build secrets). ↩ -
Shai-Hulud 2.0 collected credential files on disk, such as gcloud's
application_default_credentials.json, and used the npm token in.npmrcand the GitHub credentials on disk (Datadog Security Labs). ↩ -
The malware in ultralytics ran XMRig, a cryptocurrency miner (PyPI Blog). ↩
-
Shai-Hulud 2.0 deleted files in the home directory when it could not steal anything (Datadog Security Labs). ↩
-
Socket. ↩
-
The maintainer of colors published a version that enters an infinite loop when loaded (Snyk). ↩
-
ignore-scriptsin npm's config. ↩ -
pnpm Settings. A gap that let install scripts run for dependencies fetched from git was fixed in 10.26.0 (GHSA-379q-355j-w6rj). ↩
-
Managing environments for deployment. If you set required reviewers, the job cannot read the secrets until it is approved. ↩
-
npm Trusted publishing. It applies to GitHub-hosted runners. ↩
-
Docker documentation, Resource constraints. ↩
-
USER in the Dockerfile reference and --read-only in the
docker runreference. ↩ -
HEALTHCHECK in the Dockerfile reference. The status changes and a
health_statusevent is emitted. The reference does not say that the container is stopped or restarted. ↩ -
Docker documentation, View container logs, and the
docker eventsreference. ↩ -
The
docker eventsreference. When looking back, it returns at most the 256 most recent events. ↩ -
Configuring the retention period for GitHub Actions artifacts and logs in your organization. ↩