Re:Dependency Confusion: How I Hacked Into Apple, Microsoft ...
by korijn on Wednesday February 10, 2021 @05:07PM
(#26095447)
Wether controls are coarse or fine (all the way to function level, or even line by line), you still need to audit the source code to see if a package is not going to abuse the permissions you grant it. Right?
[ Parent
| on HN ]
Re:Dependency Confusion: How I Hacked Into Apple, Microsoft ...
by ryukafalz on Wednesday February 10, 2021 @05:50PM
(#26095905)
Not to nearly the same extent; the key is to not grant unnecessary authority in the first place.
Let's say I'm using a `left-pad` function that someone else wrote, and I'm using a system in which modules aren't granted any authority except what you give them. If I then call
left-pad('foo', 5')
...I don't really have to worry that it'll go rummaging around my filesystem for my private keys and exfiltrate them somewhere. After all, I didn't give it access to my filesystem or the network! (Side-channel attacks notwithstanding, things get thorny real quick at that point.)Now, you still have to worry about the function not doing what being correct - it might return an empty string, it might go into an infinite loop, etc - but you've tremendously reduced the scope of what this module could do if the developer were malicious.
Re:Dependency Confusion: How I Hacked Into Apple, Microsoft ...
by korijn on Thursday February 11, 2021 @05:39PM
(#26108361)
In obvious cases like that, I agree with you. In real life however my dependencies are rarely that simple.
So let's imagine a REST API library that needs disk and network access to do it's work. How do I know it doesn't abuse my permission?
And what about its transient dependencies?