• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Stop npm i-ing Blind: How I Catch Malicious Packages Before They Hit Production

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,605
Баллы
155

Stop npm i-ing Blind: Catch Malicious Packages Before They Hit Production


Most developers assume their dependencies are “safe enough.” Run npm audit, fix a few warnings, ship the code, move on.

That mindset is exactly why malware keeps slipping into the npm ecosystem.

Billions have been stolen through malicious npm packages: crypto drainers hidden in postinstall scripts, env-var stealers that exfiltrate API keys, compromised maintainers shipping backdoored updates, and typosquats designed to look like popular libraries. None of this shows up in npm audit because these aren’t vulnerabilities. They’re active malware.

Why the usual tools won’t save you


Tools like npm audit, Snyk, and Dependabot match your dependencies against a CVE database. That works for old, disclosed vulnerabilities — but it does nothing against:

  • freshly published malicious packages
  • compromised maintainers pushing a bad version
  • obfuscated install scripts
  • credential-stealing code
  • crypto wallet drainers

Attackers know this. They publish malware specifically because they won’t get caught by CVE-based scanners.

If you install packages blindly, you’re effectively running strangers’ shell scripts inside your CI, dev machine, and production server.

What malicious npm packages actually look like


You can’t rely on “stars,” download count, or “it’s popular” as a safety signal. The real indicators are in behavior:

  • Crypto theft: scripts targeting wallet paths or injecting malicious JS
  • Exfiltration: code reading process.env and sending secrets to a remote server
  • Backdoors: hidden command execution via postinstall
  • Suspicious publish behavior: sudden ownership change, new maintainer, weird version bump
  • Heavy obfuscation: unreadable blobs inside an “innocent” utility package

This is the stuff that drains money, steals credentials, compromises CI tokens, and gives attackers remote access.

How I deal with this: a preflight malware scan


I got tired of hoping traditional tools would catch things they were never designed to detect. So I built NPMScan — a simple behavior-based scanner focused specifically on malicious packages, not CVEs.

It tracks known malicious packages in real time and flags patterns like:

  • env-var stealing
  • credential exfiltration
  • crypto drainers
  • dangerous child_process usage
  • suspicious network calls
  • obfuscation and tampering
  • sketchy maintainer activity

You can either search a single package or paste your entire package.json to get a full dependency-tree analysis.

The point is to get a yes/no sanity check before a new dependency ever touches your codebase.

My workflow for safe dependency management


This is the exact process I use now:

1. Before adding a package


I search it on npmscan.com.
If it’s flagged for malware-like behavior, it’s gone. No discussion.

2. Before upgrading dependencies


I paste my package.json into NPMScan’s Analyze page.
It quickly shows which dependencies or sub-dependencies are risky.

3. Team hygiene that actually matters

  • Commit lockfiles
  • Keep dependencies minimal
  • Review diffs when upgrading packages
  • Avoid random GitHub repos with zero reputation
  • Watch for unexpected maintainers or publish patterns

No tool is magic, but this combination catches 90% of what actually matters in the real world.

Try it on your real project


If you’re shipping Node.js/TypeScript code, stop installing dependencies blind.
Scan the packages you rely on before they hit production.

Run a check on your current project and see if anything weird shows up:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



If it flags something unexpected — or if you want CI integration, GitHub Actions, or VS Code plugins — tell me. I’m actively building the next features based on real developer workflows.



Источник:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу