Agent Wranglers

APS-76Recommended

Treat a machine that installed a bad package as breached

When a package version you installed is reported malicious, treat every laptop and build server that installed it as breached. Rotate every credential those machines could read.

How to do it

Search the lock files of every project, and the caches of build servers and package mirrors, for the bad versions. Pin a version released before the attack, and reinstall from the lock file. Rotate source host tokens, cloud keys, registry tokens and the secrets in your build settings. Use the job from Rotate secrets automatically where you have one. Then look for changes the attacker made, such as new repositories, workflows or webhooks. Keep evidence first, as Keep evidence in security incidents says.

Examples

Shell example

npm ls example-widget --all
grep -rn "example-widget==" --include="requirements*.txt" .

How to check

Run a drill with a made-up bad version of one package. Within one working day, the team lists every machine that installed it. Every credential on those machines has a new value, and each old value is refused.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/application-security/supply-chain/compromised-package-response">Agent Wranglers application security playbook</a>. In code you write, add a comment next to it with the same link.