News for hackers. Stuff that matters.
Re:Remote Code Execution Vulnerability in Google They Are No... by kelnos on Saturday April 15, 2023 @03:44PM (#35583921)
While the Java ecosystem tends to get a lot of criticism, this is one thing they got right: fetching a package name from a public repository involves prefixing the name with the reverse-DNS name of the uploader (the "group ID" in Java/maven parlance). Uploaders can only submit packages after they've proven they have control over the domain.

It's really unfortunate that even newer package management ecosystems like Rust's haven't learned that lesson. Yes, it increases initial setup friction, but dependency confusion and name squatting issues more or less just go away when you do that. Sure, you might run into issues where people register domains for common misspellings of popular domain names, but that's already a problem with website resolution, and there are ways to mitigate that.

Re:Remote Code Execution Vulnerability in Google They Are No... by bqmjjx0kac on Saturday April 15, 2023 @03:52PM (#35583969)
What happens in the Java ecosystem when someone loses ownership of their domain name?
Re:Remote Code Execution Vulnerability in Google They Are No... by dtech on Saturday April 15, 2023 @04:16PM (#35584144)
nothing immediately, once your account has the namespace it keeps it.

I don't know the policies on what would happen if someone else registered the domain and contested the ownership though.

Re:Remote Code Execution Vulnerability in Google They Are No... by taeric on Saturday April 15, 2023 @04:12PM (#35584115)
As in all things, it breaks. There is no magic bullet. Period.
Re:Remote Code Execution Vulnerability in Google They Are No... by bqmjjx0kac on Saturday April 15, 2023 @05:23PM (#35584658)
Pinning to a private key could help. Admittedly not a magic bullet.
Re:Remote Code Execution Vulnerability in Google They Are No... by twic on Saturday April 15, 2023 @06:33PM (#35585297)
Domain ownership is only needed to claim the group ID in the first place. After that it's associated with your account.
Re:Remote Code Execution Vulnerability in Google They Are No... by pclmulqdq on Saturday April 15, 2023 @05:19PM (#35584630)
Someone who can't bother to pay a $10 renewal fee for a domain probably isn't maintaining that package either.
Re:Remote Code Execution Vulnerability in Google They Are No... by leoh on Saturday April 15, 2023 @05:23PM (#35584661)
That’s just silly. Suppose someone doesn’t want to maintain a package any longer, retires or dies?
Re:Remote Code Execution Vulnerability in Google They Are No... by pclmulqdq on Saturday April 15, 2023 @06:13PM (#35585121)
I think the implication here is that you probably shouldn't be using unmaintained packages. I guess you can at your own risk.
Re:Remote Code Execution Vulnerability in Google They Are No... by McSwag on Saturday April 15, 2023 @06:48PM (#35585424)
I challenge you to audit all dependencies and, particularly, the sub-dependencies of those. Most people, in my experience, look at a requirements.txt or package.json and think that’s everything but your dependency tree is going to be easily 3-4x that size.

Node.js is particularly notorious for this. It’s a big challenge for having non-flat dependency management and there’s no great solution for this problem.

Re:Remote Code Execution Vulnerability in Google They Are No... by pclmulqdq on Saturday April 15, 2023 @07:07PM (#35585554)
Well, I don't use Node.js and I'm careful about cargo dependencies, so I actually can do this with every project I have worked on, and I value the ability to do it. It has led to a lot more sleep, as I understand it, than people with critical projects that rely on npm get. Cargo doesn't exactly have the all of the problems that npm has, but it is already kind of time consuming to audit your dependencies in Rust.
Re:Remote Code Execution Vulnerability in Google They Are No... by Paul-Craft on Sunday April 16, 2023 @01:02AM (#35587415)
Sure, you can do it. But, have you? I'm betting not, and I think that's the point.
Re:Remote Code Execution Vulnerability in Google They Are No... by aflag on Sunday April 16, 2023 @10:49AM (#35590475)
Maybe they cannot legally hold it anymore? For instance, I believe that UK citizens are no longer eligible for .eu
Re:Remote Code Execution Vulnerability in Google They Are No... by spockz on Saturday April 15, 2023 @04:07PM (#35584066)
I think this is primarily something from maven central. No technical limitation in maven.
Re:Remote Code Execution Vulnerability in Google They Are No... by Yoric on Saturday April 15, 2023 @04:11PM (#35584109)
FWIW, I've seen discussions on the topic in the Rust community. No guarantee that it's going to happen, but at least people are aware of the issue.
Re:Remote Code Execution Vulnerability in Google They Are No... by junon on Saturday April 15, 2023 @04:27PM (#35584228)
Especially since a few users slurped up all of the interesting package names and refuse to give them up, despite many people complaining on GitHub. It's one of the huge warts of the cargo ecosystem it seems nobody on the rust team is willing to fix.
Re:Remote Code Execution Vulnerability in Google They Are No... by pclmulqdq on Saturday April 15, 2023 @05:03PM (#35584502)
Who do you think slurped up the package names? It's not going to be random people.
Re:Remote Code Execution Vulnerability in Google They Are No... by cornstalks on Saturday April 15, 2023 @06:37PM (#35585337)
This punk: https://crates.io/users/swmon

They aren’t the only one, but they’re… prolific in this area. A list of squatted names is maintained here: https://github.com/dtolnay/squatternaut

Re:Remote Code Execution Vulnerability in Google They Are No... by matheusmoreira on Saturday April 15, 2023 @05:47PM (#35584886)
I think all packages should be namespaced per user. The language's core team could promote widely used packages to a "standard" namespace and give it a good name that way, thereby making it the "canonical" implementation of something.
Re:Remote Code Execution Vulnerability in Google They Are No... by ilyt on Saturday April 15, 2023 @06:55PM (#35585474)
I dunno how ecosystems keep making the same mistake.

All so someone can save few letters with typing dep name that one time they will be pulling it in into their project

Re:Remote Code Execution Vulnerability in Google They Are No... by dgellow on Sunday April 16, 2023 @06:08AM (#35588682)
The lack of namespacing in Rust is so weird. The discussion has been going for years, but it makes zero sense to me that after seeing issues npm and pypi faced during the past decade Rust is still pushing back against a more structured registry structure. Squatting will become more and more problematic the longer this flat registry approach persists.
Re:Remote Code Execution Vulnerability in Google They Are No... by twic on Saturday April 15, 2023 @06:34PM (#35585308)
Not only do they refuse to fix it, every time I've brought it up, they insist it isn't a mistake, and this way is better than, or no worse than, what Java does.
Re:Remote Code Execution Vulnerability in Google They Are No... by ilyt on Saturday April 15, 2023 @06:53PM (#35585460)
the reversed DNS name part is a bit silly tho
Re:Remote Code Execution Vulnerability in Google They Are No... by matja on Saturday April 15, 2023 @10:23PM (#35586673)
Can you elaborate what is silly about it? The reversing, or the DNS, or both?

A package called com.example.foo would be package foo in the namespace "example", which is under the namespace "com", which is how a lot of languages do namespace nesting.

DNS can be said to be "reversed" from that point of view.

Re:Remote Code Execution Vulnerability in Google They Are No... by astrange on Sunday April 16, 2023 @12:23AM (#35587250)
It's all part of Java's effort to make everything as complicated as possible and put everything in as many namespaces as possible.
Re:Remote Code Execution Vulnerability in Google They Are No... by oblio on Monday April 17, 2023 @03:44AM (#35597834)
Why? Because you don't like it?

Chesterton's fence.

Re:Remote Code Execution Vulnerability in Google They Are No... by kibwen on Saturday April 15, 2023 @07:28PM (#35585684)
The problem described in the post isn't the fault of package naming schemes, it's due to `pip install --extra-index-url` apparently ignoring the user-specified registry if the package exists on PyPI, which, if true, is baffling, because it throws out the concept of private registries altogether in favor of treating PyPI as some sort of universal namespace.
Re:Remote Code Execution Vulnerability in Google They Are No... by 0cf8612b2e1e on Saturday April 15, 2023 @08:40PM (#35586117)
That Github issue is insane. So frustrating that an obviously wrong behavior is continued even after exploits in the wild. Count me as one of those idiot users who was confused by the current behavior.
Re:Remote Code Execution Vulnerability in Google They Are No... by Triesault on Saturday April 15, 2023 @10:37PM (#35586741)
> due to `pip install --extra-index-url` apparently ignoring the user-specified registry if the package exists on PyPI

I thought this was the expected behavior of --extra-index-url

To force pip to use a user-specified registry, you would use --index-url instead of --extra-index-url

Re:Remote Code Execution Vulnerability in Google They Are No... by SOLAR_FIELDS on Sunday April 16, 2023 @12:27AM (#35587280)
We ran into a pretty serious vulnerability around editable installs last year as well. Nearly the same story as here - basically an editable install hit an edge case and went to pypi instead when you wouldn’t expect it to. Python has not thought this problem through nearly as much as the Java people have.
Re:Remote Code Execution Vulnerability in Google They Are No... by Too on Sunday April 16, 2023 @02:44AM (#35587830)
To be fair, the parameter is called extra index url, not private index url.

That there is no other option for private repositories or namespacing is still a big shame.

Re:Remote Code Execution Vulnerability in Google They Are No... by smarnach on Sunday April 16, 2023 @04:47AM (#35588313)
There is, as already pointed out in a sibling comment, and it's called --index-url: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-0
Re:Remote Code Execution Vulnerability in Google They Are No... by vsl on Monday April 17, 2023 @01:05AM (#35597028)
> The problem described in the post isn't the fault of package naming schemes

If PyPI used Java-like scheme with domain ownership verification, Google would presumably use com.google.* namespace for their private stuff and it wouldn’t be possible to introduce malicious package this way.

So the described issue arguably is a consequence of that.

Re:Remote Code Execution Vulnerability in Google They Are No... by yarg on Saturday April 15, 2023 @08:40PM (#35586116)
They didn't get it that right (as the other dude said - it's server side security by the service provider).

Requiring that third party dependencies be signed should have been the default in Maven itself.

Re:Remote Code Execution Vulnerability in Google They Are No... by anothernewdude on Sunday April 16, 2023 @12:30AM (#35587292)
I'm not registering a domain just to publish a package. No wonder Java is a hellscape.
Re:Remote Code Execution Vulnerability in Google They Are No... by dtech on Sunday April 16, 2023 @01:34AM (#35587547)
You can use io.github.youruser or any other meriod of namespaces you can get for free
Re:Remote Code Execution Vulnerability in Google They Are No... by Paul-Craft on Sunday April 16, 2023 @12:56AM (#35587388)
> While the Java ecosystem tends to get a lot of criticism, this is one thing they got right: fetching a package name from a public repository involves prefixing the name with the reverse-DNS name of the uploader (the "group ID" in Java/maven parlance). Uploaders can only submit packages after they've proven they have control over the domain.

That doesn't really solve the fundamental problem, though. Domains can and do change hands by various means and for various reasons having little to do with Java packaging, meaning that control of those packages can be transferred as well. It's just shifting the problem to a different place is all.