r/node • u/jaredcasner • Mar 31 '26
Axios 1.14.1 compromised
https://news.ycombinator.com/item?id=47581837
Make sure to pin to 1.14.0
25
u/Hung_Hoang_the Mar 31 '26
this is why i pin exact versions in package.json and only update deps manually after checking changelogs. the default ^ range that npm init gives you is a ticking time bomb for exactly this kind of thing. also worth running npm audit regularly and setting up socket.dev or snyk in your CI — they would have caught this before it hit production. the scary part is axios has like 60 million weekly downloads so the blast radius on these supply chain attacks is massive. if youre not already using a lockfile (package-lock.json) committed to your repo, today is the day to start
9
u/jaredcasner Mar 31 '26
Keep in mind that even tools that actively scan for malware can’t do real time scanning with the volume of packages being added to npm on a daily basis, let alone all the new version updates. Even the best of them are 10+ minutes behind. Which doesn’t seem like a lot, until you consider the download volume of a package like axios.
You should also consider minimum package age settings to give things a chance to be caught.
https://docs.npmjs.com/cli/v11/using-npm/config#min-release-age
6
u/feross Mar 31 '26
Socket caught this in six minutes.
Still a good idea to set up a minimum age policy as well as install Socket Firewall. You can configure it to not let in packages if they're too new
1
13
u/CanIhazCooKIenOw Mar 31 '26
Pining versions is already done in the lock file.
So unless you are npm update randomly you should be fine.
2
u/lirantal Mar 31 '26
I have documented more good security practices for both consumers and maintainers of npm packages here: https://github.com/lirantal/npm-security-best-practices
You might also want to start using npq as your alias for npm/pnpm so you can proactively prevent malicious or new packages from being installed: https://github.com/lirantal/npq
2
u/breakslow Mar 31 '26
this is why i pin exact versions in package.json and only update deps manually after checking changelogs. the default ^ range that npm init gives you is a ticking time bomb for exactly this kind of thing
I always change this behaviour in my ~/.npmrc file:
npm config set save-exact=true
2
u/priyanshusc Apr 01 '26
is axios safe now or not ? can we run "npm i" and do whatever we want or not ? is everything now safe or not ?
1
u/jaredcasner Apr 01 '26
Axios is currently safe and you can npm install it.
However, there are many best practices listed in other comments here that you’ll want to make sure to follow.
minimum package age
SCA tooling
using the —ignore-scripts flag
pinning versions and committing your lock file
43
u/merb42 Mar 31 '26
Thank you! And looks like that version is not available anymore on npm. Also the crypto package was wiped out by npm and there is just a placeholder now. Freakin wild how fast this happened. Makes me feel a little better about the attacks happening lately
9
7
u/Ryuuji159 Mar 31 '26
this is the first time i have been affected... I dont know what to do right now appart from shuting down my work computer...
7
u/decho Mar 31 '26
Take care of your accounts, change credentials, force logout of all active/previous sessions, etc. Then do a clean reinstall of the system.
And start using pnpm with
minimumReleaseAgeof at least 2-3 days.2
u/Ryuuji159 Mar 31 '26
im reinstalling everyting right now, it was time for a general restart of my credentials anyway. I removed every ssh key from the servers I had access to and changed my passwords, I hope nothing happens
2
u/decho Mar 31 '26
It might also be worth checking activity/security/session logs. A lot of platforms have these and they contain info about devices which accessed your account, along with geolocation, IP and such.
https://github.com/settings/sessions
https://github.com/settings/security-log
If you don't recognize anything suspicious there, then you got lucky.
4
u/lirantal Mar 31 '26
Rotate all credentials, secrets, etc. Likely you need to start from scratch for your OS.
3
u/lirantal Mar 31 '26
For the future, see this curated list of npm security practices to follow: https://github.com/lirantal/npm-security-best-practices
1
u/xiaokangwang Mar 31 '26
I wonder whether npm could something like two factor authentication for publishing packages… like to confirm publishing a package, you can ask npm to request your confirmation on a browser…
1
2
u/lirantal Mar 31 '26
Seems very timely and helpful to share my curated list of npm security best practices: https://github.com/lirantal/npm-security-best-practices
2
u/VolumeActual8333 Mar 31 '26
The crypto package wipe mentioned in the comments shows npm is playing whack-a-mole while attackers automate. I moved to a private registry with artifact verification after the event-stream fiasco, and sleeping soundly is worth the $50/month. Popularity isn't a security model—60 million downloads just means 60 million potential victims.
1
u/EcstaticProfession46 Mar 31 '26
Any one wanna try https://socket.dev/npm/package/xior ? similar axios syntax, tiny size and rich plugins support?
1
u/Quiet_Stress7092 Mar 31 '26
How all the popular libraries are getting hacked this days , is that conspiracy that to force user or companies to use ai driven security scanner
1
u/bad_bowlings Apr 14 '26
Yep. Also if 1.14.1 or 0.30.4 ever got installed in CI/dev, pinning alone isnt enough. I’d treat that machine as potentially popped: wipe `node_modules` + npm cache, regen lockfiles, rotate any env/API tokens, and grep for `plain-crypto-js` in lockfiles or build logs. Kinda nasty one tbh
-2
39
u/jaredcasner Mar 31 '26
More information: https://github.com/axios/axios/issues/10604
Stay vigilant. It’s a wild world out there.