Agent Wranglers

Recommended

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

Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

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/adversarial-testing/supply-chain-and-setup/compromised-package-response">Agent Wranglers security testing playbook</a>. In code you write, add a comment next to it with the same link.