News for hackers. Stuff that matters.
Re:Critical vulnerability of NPM package macaddress by drdaeman on Monday June 11, 2018 @09:23AM (#17283938)
Other platforms do `exec` calls, e.g. `"ifconfig " + iface`, etc. This `cat` is odd, but still within what can be attributed to sloppiness (and copy-paste-driven programming) rather than malice.
Re:Critical vulnerability of NPM package macaddress by arghwhat on Monday June 11, 2018 @09:42AM (#17284085)
exec cat is so odd that I can't seriously attribute it to sloppiness. It's for reading a file, and much more cumbersome.

Plus, exec is not something to be taken lightly, to the point where I'd barf if I found out a lib I depended on exec'd internally and immediately remove it, unless there was absolutely no other way to perform the action for some absurd reason.

Re:Critical vulnerability of NPM package macaddress by nucleardog on Monday June 11, 2018 @03:18PM (#17287560)
Somebody Google'd "get mac address from script linux" and scrolled through a couple things involving awk and other nonsense until they found something easily digestible--a StackOverflow answer saying:

    For particular interface like for eth0:
    cat /sys/class/net/eth0/address
Then without thought or understanding, put that into their JavaScript as directly as possible.

This is someone doing work without a full understanding of the problem space. Less of a programmer, more of a programming technologist. I don't find it surprising at all.

Re:Critical vulnerability of NPM package macaddress by arghwhat on Tuesday June 12, 2018 @04:09AM (#17291541)
Hmm, an adequate explanation, but why in the world is someone making a public library out of that, and furthermore, why in the world are people using this library? The library has been downloaded 2300 times in the past year!

I have nothing against bad developers—we all started there—but there is something seriously wrong with the JavaScript ecosystem and the barrier of entry for pushing your code into other people's projects through libraries.

Re:Critical vulnerability of NPM package macaddress by drdaeman on Monday June 11, 2018 @02:18PM (#17286871)
My point is, it's likely that the first line was something like exec("ifconfig " + name), then it was copied and edited to exec("networksetup -getmacaddress"), then this exec("cat") had happened. Because laziness.

It really wouldn't be a problem (a poor and ineffective code for sure, but no security bugs), if all the arguments would be correctly validated (and escaped, although valid interface names probably don't need it).