# Dangerous Package Lifecycle Scripts

> Detects npm/pip package lifecycle scripts that download and execute code, a common malicious package technique.

- Skill: `zakirkun/dangerous-package-lifecycle-scripts` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/dangerous-package-lifecycle-scripts`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/dangerous-package-lifecycle-scripts/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/dangerous-package-lifecycle-scripts

---


# Dangerous Package Lifecycle Scripts

## Overview
npm package `postinstall`, `preinstall`, and `install` scripts run automatically when a package is installed. Malicious packages abuse this to:
- Download and execute a remote payload
- Exfiltrate environment variables (API keys, AWS credentials)
- Install persistent backdoors

## Remediation
- Audit all `postinstall` scripts in `node_modules`
- Use `npm install --ignore-scripts` for packages that don't need build steps
- Use tools like `npm audit`, `socket.dev`, or `snyk` to scan packages

