Install any skill in seconds. Free to start, no credit card required.
Get Started Free →mukul975/detecting-malicious-npm-packages
Triage npm packages for install-script malware, exfiltration, and worming behavior.
Passed 19 of 21 test cases with the skill, and 13 of 21 without it.
and 5 more in the full report
6 fixed14 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 6 test cases the skill fixed. Same model, same prompt, with and without the skill.
We want to use the bundled `agent.py` script to analyze a local file archive `/tmp/downloaded-package.tgz` instead of fetching from the registry. What flag passes the local archive path?
| Checked | Without skill | With skill |
|---|---|---|
| Passes --tarball /tmp/downloaded-package.tgz to agent.py. | Missed | Passed |
The instructions your model reads when the skill loads.
Legal Notice: Analyze packages in an isolated, disposable environment. Some malicious packages execute on install (
npm installruns lifecycle scripts automatically) or on import. Never analyze a suspect package on a workstation with credentials, SSH keys, cloud tokens, or network access to production. This skill is for defensive analysis and authorized incident response only.
The npm registry is the largest software package ecosystem in the world and the most heavily targeted by supply-chain attackers. Malicious packages reach victims through typosquatting (expresss, crossenv), dependency confusion, account/maintainer takeover (the 2025 Shai-Hulud worm and the event-stream compromise are canonical examples), and starjacking. The defining danger of npm is that npm install automatically runs preinstall, install, and postinstall lifecycle scripts with the developer's full privileges before any application code is invoked — so simply installing a package is enough to be compromised. Roughly 2% of npm packages use install scripts, which makes them both common and a powerful malware delivery vehicle.
Typical malicious behaviors are: exfiltrating environment variables, ~/.npmrc tokens, SSH keys, and cloud credentials to an attacker-controlled URL; opening reverse shells; dropping cryptominers; reading and posting process.env; obfuscating payloads with base64/eval; and self-propagating (worming) by stealing the maintainer's npm token and republishing trojanized versions of other packages they own.
This skill provides a repeatable triage workflow centered on GuardDog (Datadog's open-source heuristic scanner built on Semgrep + metadata rules), supplemented by manual tarball inspection, lockfile-based compromise checks against known-bad version lists, and dynamic detonation with network and filesystem monitoring. The goal is to decide, quickly and safely, whether a given package or a project's dependency tree contains malicious code.
package.json / package-lock.json during code review or onboarding a third-party library.pip install guarddog
# or run via Docker without local install:
docker pull ghcr.io/datadog/guarddog
alias guarddog='docker run --rm ghcr.io/datadog/guarddog'
--ignore-scripts when downloading for analysis).jq, tar, and optionally OSV-Scanner for known-vulnerability/known-malicious cross-checks:
go install github.com/google/osv-scanner/cmd/osv-scanner@v1
tcpdump, a DNS sink, or a network namespace).test cases passed, vs 13 / 21 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.