Live data from Hacker News

Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

medium.com

41–50 of 412 posts

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#41
post #9

That is insane that any company allowed this to happen. ""That said, we consider the root cause of this issue to be a design flaw (rather than a bug) in package managers that can be addressed only through reconfiguration," a Microsoft spokesperson said in the email." No, npm has scopes for a reason, why would that not fix this issue?

Scopes were only introduced in NPM 2, and iirc it's still an optional feature. Companies that used NPM early on may have opted to never use those.

But that's just NPM, it's an issue in all of the mentioned package managers.

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#43

Earlier quoted context omitted.

There's more coming.... tons of github integrations ask for blanket access to your account vs Oauth, ( https://github.com/marketplace ). Tons of github users give that access, the access_tokens are only a password type breach away. If you have these access_tokens you can edit the repos they are for all you want.

Different access tokens have different permissions, you can't just do whatever you want.

Yeah, but at least with PATs (not sure about other token types), you can't scope them to a particular repo, so whenever you need to allow something to even see a private repo or write to a public repo, the token you supply to allow that can do that for all repos and that alone is potentially really destructive. I am not sure if there is a good reason for why PATs can't be scoped to a repository, because if they were allowed to be, it would do a lot for security I think.

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#44
This post seems like a good time to note that by default, there's no direct way to verify that what you are downloading from dockerhub is the exact same thing that exists on dockerhub [1].

Discovered after seeing a comment on HN about a bill of materials for software, i.e., a list of "approved hashes" to ensure one can audit exactly what software is being installed, which in turn led me to this issue.

[1] - https://github.com/docker/hub-feedback/issues/1925

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#45

I'm surprised the reverse fully-qualified domain name (FQDN) model used by Java isn't more widely adopted. If you want to upload artifacts to the main repository (Maven Central) you first need to show ownership of a particular domain. For example, via a DNS TXT record (example [1]). Would make these kind of attacks a lot more difficult. [1] https://issues.sonatype.org/browse/OSSRH-61509

It seems some of the new package systems such as node/npm fail to learn from years of maturity of existing ecosystem such as Java's

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#46

Earlier quoted context omitted.

Different access tokens have different permissions, you can't just do whatever you want.

Yeah, but at least with PATs (not sure about other token types), you can't scope them to a particular repo, so whenever you need to allow something to even see a private repo or write to a public repo, the token you supply to allow that can do that for all repos and that alone is potentially really destructive. I am not sure if there is a good reason for why PATs can't be scoped to a repository, because if they were…

Worse: you can’t even scope it to an org, and some integration points are only available to org owners!

GitHub is terrible.

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#48
post #45

I'm surprised the reverse fully-qualified domain name (FQDN) model used by Java isn't more widely adopted. If you want to upload artifacts to the main repository (Maven Central) you first need to show ownership of a particular domain. For example, via a DNS TXT record (example [1]). Would make these kind of attacks a lot more difficult. [1] https://issues.sonatype.org/browse/OSSRH-61509

It seems some of the new package systems such as node/npm fail to learn from years of maturity of existing ecosystem such as Java's

"Years of maturity" or, just thinking about the problem for a bit.

How long did it take npm to have scoped packages. Sure, let me create a "paypal" project, they only need one js project no?

If Java suffers from excessive bureaucracy, the newer package developers/repos suffer from too much eagerness to ship something without thinking

Not to mention dependency and version craziness. If you want your software to be repeatable you need to be specific with the versions and code you're taking.

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#49
post #6

Package management isn't what I initially think of when I hear "supply chain". Neat hack! It's like left-pad but malicious.

It should be. If you are a developer, your package manager, OS distributions, and any commercial software you use is all part of your supply chain.

Your code is what it depends on.

Re: Dependency Confusion: How I Hacked Into Apple, Microsoft and Other Companies

#50
post #14

To mitigate this kind of supply chain attacks for python, we have created following tool [1], that will check python packages on Artifactory instance you specify and create packages with the same name on the PyPi. [1] https://github.com/pan-net-security/artifactory-pypi-scanner

Uploading dummy packages to PyPi isn't the solution. It just pollutes PyPi and a nuisance to others.

You have always been able to specify the `index-url` when installing packages using pip. This can also be added to `requirements.txt` files as well.

Post reply on HN