News for hackers. Stuff that matters.
Re:Remote code execution in Homebrew by compromising the off... by stjo on Saturday April 24, 2021 @05:02AM (#26923454)
I feel a lot less secure now knowing there is an automated pipeline glued with yaml and ruby, that takes a stranger's code and pushes it directly to my machine.

I'm sure the homebrew team tried hard to make sure it is as simple and restrictive as possible. As they are doing it for free and without warranty, they are not obligated to match any security standards. I am grateful, but I still wish it is done differently. Maybe instead of armchair complaining on HN I should donate...

Re:Remote code execution in Homebrew by compromising the off... by btown on Saturday April 24, 2021 @08:27AM (#26924398)
For what it’s worth, Homebrew responded by entirely removing the automation, not just patching the specific vulnerability: https://brew.sh/2021/04/21/security-incident-disclosure/

To me this means they take the class of threats seriously. And in the first place, automating version bumps could actually improve availability of security hotfixes for brew-installed software, so it’s consistent with a good faith security stance.

And, to be fair, there are plenty of NPM repositories with far fewer qualms about pushing untrusted code in dependencies to dev machines...

Re:Remote code execution in Homebrew by compromising the off... by jacquesm on Saturday April 24, 2021 @08:54AM (#26924528)
NPM shouldn't be up for serious consideration as part of anything that needs to be secure after their series of incidents like these.

If that's the new standard that is problematic.

Re:Remote code execution in Homebrew by compromising the off... by tenacious_tuna on Saturday April 24, 2021 @12:21PM (#26926063)
I think it's less about using NPM as a good-practice model, and more just as an example of a widespread tool with worse flaws.

Not an excuse, just a comparison.

Re:Remote code execution in Homebrew by compromising the off... by btown on Monday April 26, 2021 @10:44AM (#26943033)
https://github.com/stripe/stripe-js strikes perhaps the most realistic balance possible, recognizing that NPM is an insecure place for their core JS logic that creates a PCI compliant iFrame, and so their NPM package is just a loader for a script tag hosted securely. And yet they encourage people to use NPM for the wrapper itself. Which is just as vulnerable to supply chain attacks as anything else on NPM. If this isn't tacit acknowledgement of a "new standard" I don't know what is. I absolutely agree that it's problematic.
Re:Remote code execution in Homebrew by compromising the off... by aequitas on Saturday April 24, 2021 @09:20AM (#26924665)
This also makes the default auto update behaviour of Homebrew itself a double edged sword. On the one end it ensures people run into less issues because Homebrew is always up to date but on the other end an RCE like this will be propagated to every user automatically within a really short time.
Re:Remote code execution in Homebrew by compromising the off... by aphextron on Saturday April 24, 2021 @05:39AM (#26923593)
I'm not sure yaml and ruby have anything to do with it. This is a common risk with all centralized package management systems. It's ultimately a tradeoff of trusting a third party for the speed and simplicity. The alternative is building everything from source, or hashing your own binaries. If anything, this is on Apple for the inexplicable fact that they haven't implemented native package management in macOS yet.
Re:Remote code execution in Homebrew by compromising the off... by stjo on Saturday April 24, 2021 @05:57AM (#26923697)
Well, if they didn’t made the trade off between security (manual pull request review) and easy of maintenance (automatic pull request merge), this would have happened.

If instead of parsing git diffs with ruby they used libgit (or something equivalent in how much battle tested it is), this wouldn’t have happened.

If Apple provided a more capable package manager, this wouldn’t have happened.

If the millions of customers of homebrew (as am I) gave them even a fraction of the monetary resources they need to build such a massive project, this wouldn’t have happened.

As you say, there is no single responsible party for the vulnerability. But it is an interesting case too ponder about. If instead of responsibly disclosed, a malicious party decided to use it, this could’ve been very ugly. I hope it gets noticed by the community and better measures are taken.

Re:Remote code execution in Homebrew by compromising the off... by IgorPartola on Saturday April 24, 2021 @08:58AM (#26924550)
To be fair, if Apple provided a more capable package manager, you wouldn’t be allowed to publish an HTTP library to it for fear it may make requests to lewd images.
Re:Remote code execution in Homebrew by compromising the off... by elondaits on Saturday April 24, 2021 @09:49AM (#26924813)
I wish Apple would provide a package manager... but just like with Linux we’d have to rely on PPAs. If you need to control how / when you update key packages (e.g., you need the latest PHP 7.4 and not 8, or node 12 instead of 15), you can’t use the official distribution... and then you’re still relying on a third party who might not have good security practices.
Re:Remote code execution in Homebrew by compromising the off... by rswail on Saturday April 24, 2021 @10:26AM (#26925048)
Macports is a package manager that gives you that control, including having multiple versions of packages installed.
Re:Remote code execution in Homebrew by compromising the off... by bdamm on Saturday April 24, 2021 @03:15PM (#26927525)
Really this is what Docker is all about. If you have environments that need certain preconditions then wrap them up in a container so they don’t break when the system updates.
Re:Remote code execution in Homebrew by compromising the off... by thu2111 on Saturday April 24, 2021 @06:06AM (#26923725)
Well, it's also just bad engineering tbh. What they're trying to do here is take a workflow intended for humans to make arbitrary code changes and other humans to review those changes, then restrict it to be a workflow for machines to update two keys in a database. Why not just introduce a real API for people to submit new versions instead of hacking one together from tools never meant for this use case?

Honestly I use brew and love it but the decision to make everything git and ruby is super hacky. And fundamental architectural decisions like that aren't something you can fix with donations.

Re:Remote code execution in Homebrew by compromising the off... by nhoughto on Saturday April 24, 2021 @06:38AM (#26923855)
yep is a founding decision, so they can use free git/github infrastructure to run their entire backend, and someone else pays for it. To do what you describe would require hosting something outside of that, which would cost $.

Reminds me of at least 1 github engineering blogpost where they reference Homebrew repo(s) as pathological examples, repos that cause them pain to operate effectively because they just don't 'look' like almost anything else.

Is what happens when you build your entire architecture around using someone elses free-tier / public service.

Re:Remote code execution in Homebrew by compromising the off... by rmorey on Saturday April 24, 2021 @11:28AM (#26925571)
would be interested to see that blog post if you happen to have a link, couldn’t find it googling “github engineering blog homebrew”
Re:Remote code execution in Homebrew by compromising the off... by zbentley on Saturday April 24, 2021 @01:54PM (#26926879)
Not brew, but a very similar set of issues were faced by the GitHub team with the CocoaPods project, which at the time worked similar to Homebrew in that they used github as a CDN/host in a somewhat uncommon way:

https://blog.cocoapods.org/Master-Spec-Repo-Rate-Limiting-Po...

https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomm...

Re:Remote code execution in Homebrew by compromising the off... by tingletech on Saturday April 24, 2021 @11:50AM (#26925802)
I can't find it either; but the post I remember was from someone from homebrew. IIRC, homebrew used to do a shallow clone (the first time it ran everyday, or something like that) of the repo with all the taps and casks or whatever is in it. A big old git repo. I think github asked them to change homebrew, and they fixed so that it uses the regular git commands vs trying to get tricky and do a shallow clone.
Re:Remote code execution in Homebrew by compromising the off... by stjo on Saturday April 24, 2021 @06:12AM (#26923747)
Maybe, but this would require even more work, time and infrastructure.
Re:Remote code execution in Homebrew by compromising the off... by myolxid1 on Saturday April 24, 2021 @08:11AM (#26924322)
I'd rather call it smart engineering that makes it easy for anyone to contribute. `brew bump-formula-pr` etc. are huge drivers behind Homebrew having among the largest number of contributors on GitHub.

It would help them a lot more if users like us contributed and volunteered to help maintain it. It's crazy that cask has over 100000 PRs and gets a few hundred everyday. For a team of just 20-30, that's insanely hard to manage.

Edit: spelling

Re:Remote code execution in Homebrew by compromising the off... by thu2111 on Saturday April 24, 2021 @09:40AM (#26924760)
They could have a convenient command line submission process for new versions without requiring every such change to be an actual PR. A simple web server that takes a POST request and converts it into a PR behind the scenes would be simpler for users as well, as there's no need then to clutter up your own github account with forks of their repo (or even to have a GH account in the first place).
Re:Remote code execution in Homebrew by compromising the off... by myolxid1 on Saturday April 24, 2021 @09:49AM (#26924816)
I imagine that having an additional server for a (somewhat understaffed) project run by volunteers introduces additional costs and additional maintenance burden.

The current process is already convenient and all you need is a GitHub account. Having the account adds some identity or semblance of it at the very least. Without that? And with an additional server? Seems like a much wider attack surface compared to what's there now.

Re:Remote code execution in Homebrew by compromising the off... by dcow on Saturday April 24, 2021 @02:22PM (#26927133)
Thats what their GH action effectively _is_. They just used a poor choice of tool. They could write a program and host it on a web server and it still might screw up.
Re:Remote code execution in Homebrew by compromising the off... by flpa on Saturday April 24, 2021 @06:53AM (#26923925)
The exploit isn't a general risk of package management, but a weakness in scripted pull request handling.

GitHub is the problem, and not for the first time (remember the Homakov exploit?).

Homebrew is quite similar to FreeBSD ports, which do not have these issues. Incidentally, I find that a lot of packages in Homebrew have a very high packaging quality that puts several distributions to shame. I'm saying this as someone who had previously been suspicious of Homebrew, but then I looked at some of the packages.

Re:Remote code execution in Homebrew by compromising the off... by myolxid1 on Saturday April 24, 2021 @08:28AM (#26924408)
The automated pipeline doesn't exist any more. More than donations I think this requires volunteering to review pull requests, as they mention in the disclosure.