Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update vendored xz to 5.6.1 #2

Conversation

jaredallard
Copy link

Updates the vendored version of xz to be 5.6.1. Also updates the
vendor script to support the addition of SPDX-License-Identifier
headers into some files.

Updates the vendored version of `xz` to be `5.6.1`. Also updates the
vendor script to support the addition of `SPDX-License-Identifier`
headers into some files.
@jamespfennell
Copy link
Owner

Thank you! So if I'm understanding correctly the license of the C files have changed? We'll need to update this repo's readme I guess.

@jaredallard
Copy link
Author

Correct, I realized that after I made this change. I'll update the README

@jaredallard jaredallard force-pushed the jaredallard/update-vendor-5.6.1 branch from 76932be to a3b2f62 Compare March 28, 2024 10:51
@jamespfennell
Copy link
Owner

I just read that xz 5.6.1 has been compromised: https://news.ycombinator.com/item?id=39865810

I'm sorry, but I find the timing of this PR to be very suspicious. This repo has been dormant for 2/3 years with no PRs. But a compromised xz is released and all of a sudden there's a PR to include it here...

@fdellwing
Copy link

None of the backdoor files (build-to-host.m4, bad-3-corrupt_lzma2.xz and good-large_compressed.lzma) are present in this repo or PR though. So let's not jump to conclusions here.

@craigcabrey
Copy link

None of the backdoor files (build-to-host.m4, bad-3-corrupt_lzma2.xz and good-large_compressed.lzma) are present in this repo or PR though. So let's not jump to conclusions here.

It's not out of the question that a malicious PR author would wait for an approval before updating the PR with malicious contents.

I believe GitHub flows allow for that if a repo is configured as such.

@cbeuw
Copy link

cbeuw commented Mar 29, 2024

I've sent an email to 1Password security

Potential GitHub account takeover of an 1Password Employee

Hi 1Password security,

#2 was opened by what appears to be the GitHub account belonging to one of your employees, Jared Allard https://github.com/jaredallard. The PR updates the dependency xz to a recently backdoored version (https://www.openwall.com/lists/oss-security/2024/03/29/4, CVE-2024-3094). It is not conclusive that the PR introduces the backdoor behind the CVE, but given the suspicious circumstances I believe you should investigate.

Kind Regards
Andy

@marekr
Copy link

marekr commented Mar 29, 2024

None of the backdoor files (build-to-host.m4, bad-3-corrupt_lzma2.xz and good-large_compressed.lzma) are present in this repo or PR though. So let's not jump to conclusions here.

Honestly? I would consider 5.6.0 and 5.6.1 source compromised until audited. The attacker did a backdoor in the packaging but they did have repo access, so who knows if anything else is hidden inside.

For example, this commit:
tukaani-project/xz@82ecc53

Is most likely part of hiding the exploit that was in the packaging.

@fdellwing
Copy link

None of the backdoor files (build-to-host.m4, bad-3-corrupt_lzma2.xz and good-large_compressed.lzma) are present in this repo or PR though. So let's not jump to conclusions here.

Honestly? I would consider 5.6.0 and 5.6.1 source compromised until audited. The attacker did a backdoor in the packaging but they did have repo access, so who knows if anything else is hidden inside.

For example, this commit: tukaani-project/xz@82ecc53

Is most likely part of hiding the exploit that was in the packaging.

I would not only consider 5.6.0 and 5.6.1 to be compromised, that GH account signed releases for multiple years.

I'm just not a fan of jumping to conclusions on things that are not obviously (but might be) related.

@olmari
Copy link

olmari commented Mar 29, 2024

This is serious!

While this is mostly incoherent blurb of links and thoughts, this vulnerability "in general" is well planned and timing of 1password personnel pushing this ASAP now sounds suspicious, while obviously it might not be related directly, as 1PW user I obviously certainly hope these are not related... But XZ is backdoored in certain versions and there is no telling yet how deep this rabbit hole goes!

List of links relating tho this backdoor:
https://boehs.org/node/everything-i-know-about-the-xz-backdoor
https://www.redhat.com/en/blog/urgent-security-alert-fedora-41-and-rawhide-users
https://www.openwall.com/lists/oss-security/2024/03/29/4

https://news.ycombinator.com/item?id=39865810
https://www.helpnetsecurity.com/2024/03/29/cve-2024-3094-linux-backdoor/

So in any way, DO NOT PUSH THIS VERSION OF XZ TO PRODUCTION!!

@lukasmalkmus
Copy link

The PR author mentions @1Password in his GitHub profile but he is not listed under https://github.com/orgs/1Password/people. Not unlikely but also something I wanted to point out here.

@cbeuw
Copy link

cbeuw commented Mar 29, 2024

The PR author mentions @1Password in his GitHub profile but he is not listed under https://github.com/orgs/1Password/people. Not unlikely but also something I wanted to point out here.

https://www.linkedin.com/in/jaredallard/ is a verified LinkedIn account (meaning the account owner has a 1Password/AgileBits email address). To be clear I don't think the 1Password employee is complicit in the supply chain attack. If this PR were a malicious act, it's likely due to this GitHub account having been taken over.

@lukasmalkmus
Copy link

The PR author mentions @1Password in his GitHub profile but he is not listed under https://github.com/orgs/1Password/people. Not unlikely but also something I wanted to point out here.

https://www.linkedin.com/in/jaredallard/ is a verified LinkedIn account (meaning the account owner has an 1Password/AgileBits email address). To be clear I don't think the 1Password employee is complicit in the supply chain attack. If this PR were a malicious act, it's likely due to this GitHub account having been taken over.

Good information 👍

However, the takeover must have went unnoticed for multiple days given the timeline of this PR (open + comment 4 days apart). Which is not impossible (account owner on holiday, etc.).

@huaracheguarache
Copy link

I think it's best to just wait for a comment from @jaredallard. That will help clear things up.

@olmari
Copy link

olmari commented Mar 29, 2024

While the immediate results is more or less engineered towards certain "this is getting built, target that", the author has had access to repository over an year.. So "we" or 1PW, needs to be extra careful what has been used and where.

@jaredallard
Copy link
Author

Hey all, context on this change:

I've been working on building a Gentoo binary package server that I maintain on Github. I wanted an easier way to manage Gentoo binary package targets (that is to make managing my current gentoo.rgst.io site easier to operate).

As part of this, I needed to support xz archives. I always set BINPKG_COMPRESS
to xz (which makes the inner archives of a gpkg use xz) because xz has the best compression ratio. Go does not have native support for xz archives. I ran into this the last time I tried to support xz archives in code (ref). At that time, I used a native Go library. It was painfully slow. So, this time around, I went looking for other options. I saw https://github.com/jamespfennell/xz, which used CGO. As much as I dislike CGO, I wanted to give this a shot and see if performance was better.

When I looked at that repo, I noticed it easily supported updating the version of xz in use and that it hadn't been updated in 3 years. Given that I get a huge kick out of updating things, for example: on ohmyzsh and gentoo (I guess from SRE days?), I updated the submodule, ran the generate code and prayed tests would pass. They did and the functionality worked locally, so I figured I'd be nice and open a PR on that repo since it's basically never gotten any love. That's it.

We can see where I used that code out in the open also: https://github.com/jaredallard/binhost/blob/main/go.mod#L5

@maratik123
Copy link

@jaredallard

I always set BINPKG_COMPRESS
to xz (which makes the inner archives of a gpkg use xz) because xz has the best compression ratio

Why not to use zstd? The later one has compression ratio similar to xz, but blazing fast decompression speed.

@jaredallard
Copy link
Author

@maratik123
Why not to use zstd? The later one has compression ratio similar to xz, but blazing fast decompression speed.

Going forward I will now 😄 But, to be honest, I just haven't kept up with the state of the world there.

@tocariimaa
Copy link

well that was some really unfortunate timing...

@fche
Copy link

fche commented Mar 30, 2024

I get a huge kick out of updating things

Perhaps this event will get people to chill to that attitude.

@jaredallard
Copy link
Author

Closing this for... obvious reasons 😄

@AUTOMATIC1111
Copy link

AUTOMATIC1111 commented Mar 30, 2024

I'm still baffled by how github deemed it appropriate to just hide all code and all history of this from public eye in reponse.

@Bulat-Ziganshin
Copy link

None of the backdoor files (build-to-host.m4, bad-3-corrupt_lzma2.xz and good-large_compressed.lzma) are present in this repo or PR though. So let's not jump to conclusions here.

even if this PR is perfectly fine, it helps to build a "web of trust" to xz-5.6. "See, Debian guys, everyone is upgrading to xz-5.6 now, why you are slugs?"

@Bulat-Ziganshin
Copy link

Why not to use zstd? The later one has compression ratio similar to xz, but blazing fast decompression speed.

afaik, lzma (xz) has the same compression ratio as zstd on text files, but ~10% better on many binary files. try e.g. a large executable or a database file, use the same dictionary size and choose maximum compression

@DanielRuf
Copy link

@AUTOMATIC1111 I think you assume more than there is.

They mention the breach of their terms, which mention malware as forbidden content. Since both maintainers were suspended by GitHub, they are probably just minimizing the damage and chose the easiest solution for the moment.

We'll have to wait until there is news from GitHub regarding the incident.

@ayancey
Copy link

ayancey commented Mar 30, 2024

I'm still baffled by how github deemed it appropriate to just hide all code and all history of this from public eye in reponse.

Obviously the alphabet boys got involved. They're reading this PR too, I'm sure 😉

@AUTOMATIC1111
Copy link

We'll just have to wait until the complicit party clarifies that it's not complicit in the cover up.

@pjjw
Copy link

pjjw commented Mar 30, 2024

I'm still baffled by how github deemed it appropriate to just hide all code and all history of this from public eye in reponse.

its to prevent any inadvertent further deployment

@ThiefMaster
Copy link

Probably they do not have something more fine-grained. :/

A good solution for the future would be to have a way for their staff to mark a repository as "contains compromised code", which would then add a big disclaimer when viewing it via web, disable unauthenticated git clones, and for authenticated clones require acknowledging (via web) that you really do want to clone a repository containing malicious code.

@AverseABFun
Copy link

Probably they do not have something more fine-grained. :/

A good solution for the future would be to have a way for their staff to mark a repository as "contains compromised code", which would then add a big disclaimer when viewing it via web, disable unauthenticated git clones, and for authenticated clones require acknowledging (via web) that you really do want to clone a repository containing malicious code.

I support this idea. GitHub, take notes!

@Shreyaan
Copy link

its to prevent any inadvertent further deployment

Protecting history is one of the core ideas of github so scrubing it clean is not the way to go imo. Disabling clones is a better approach

@AverseABFun
Copy link

Does anyone here have a mirror of xz that is relatively up-to-date? I'm trying to do security research(i.e. torturing myself for hours by going through EVERY SINGLE COMMIT by the attacker if no one else has done it) and you can't git clone from the internet archive.

@ar-jan
Copy link

ar-jan commented Mar 30, 2024

Does anyone here have a mirror of xz that is relatively up-to-date?

https://archive.softwareheritage.org/browse/origin/directory/?origin_url=https://github.com/tukaani-project/xz

@AverseABFun
Copy link

Does anyone here have a mirror of xz that is relatively up-to-date?

https://archive.softwareheritage.org/browse/origin/directory/?origin_url=https://github.com/tukaani-project/xz

Thanks!

@fdellwing
Copy link

Does anyone here have a mirror of xz that is relatively up-to-date? I'm trying to do security research(i.e. torturing myself for hours by going through EVERY SINGLE COMMIT by the attacker if no one else has done it) and you can't git clone from the internet archive.

Just use the official mirror: https://git.tukaani.org/?p=xz.git;a=summary

@AverseABFun
Copy link

AverseABFun commented Mar 30, 2024 via email

@ghost
Copy link

ghost commented Mar 30, 2024

is @inversebrah on github too

@inversebrah
Copy link

only the fake one

is @inversebrah on github too 也在github上

@jamespfennell
Copy link
Owner

Thank you for your very calm and kind response @jaredallard! I hope my comment calling this PR was suspicious wasn't too offensive. This is a crazy coincidence!

I think closing the PR was the right move. In fact, given that the xz attacker was involved in the xz repo for 2 years, I don't see any path for updating the version xz used in for this Go library at all. I am going to note on the repo readme that (a) the repo is essentially frozen and (b) the version of xz in use predates the attack so it's still potentially safe to use, depending on your risk profile. Maybe moving to zstd is the right move though.

@Neustradamus
Copy link

Official announcement from XZ team is here:

@AIndoria
Copy link

AIndoria commented Mar 31, 2024

I've sent an email to 1Password security

Maybe I should send an email to Netcraft in London that their "Security engineer I" Andy Wang is sending emails to employers making baseless claims, 'possibly to shift blame' and to 'investigate if they're a state actor who have an interest in doing so.' (y'know - while we're all making baseless claims here)

Witch hunting is a shameful behavior.

@antedeguemon
Copy link

antedeguemon commented Mar 31, 2024

This kind of coincidence could happen to anyone who contributes to OSS.

It is a shame that some people jumped to conclusions without waiting for an explanation.

Might next times we all remember that there are different timezones around the world and that different cultures celebrate different holidays.

Thank you very much for the calm and good sense @jamespfennell.

I hope no harm was done to @jaredallard employment relationship and that he continues contributing to OSS.

@nm-remarkable
Copy link

nm-remarkable commented Mar 31, 2024

I've sent an email to 1Password security

Maybe I should send an email to Netcraft in London that their "Security engineer I" Andy Wang is sending emails to employers making baseless claims, 'possibly to shift blame' and to 'investigate if they're a state actor who have an interest in doing so.' (y'know - while we're all making baseless claims here)

Witch hunting is a shameful behavior.

Informing 1Password about a possible account being compromised is the correct thing to do.

While wrong in this case and just a coincidence. The report would, in the case of the account being overtaken, allow for a faster response both from Jared and 1Password, allowing them to limit the damage done to both the company and the person himself.

Of course in this case it was not necessary as it was simply a coincidence but if my account was compromised I’d prefer to have a warning as soon as possible (that my account was presenting suspicious behaviour).

@Speculate7348
Copy link

CIA agent spotted

@Raymo111
Copy link

Raymo111 commented Apr 2, 2024

I've sent an email to 1Password security

Maybe I should send an email to Netcraft in London that their "Security engineer I" Andy Wang is sending emails to employers making baseless claims, 'possibly to shift blame' and to 'investigate if they're a state actor who have an interest in doing so.' (y'know - while we're all making baseless claims here)

Witch hunting is a shameful behavior.

The email to 1Password was a security behavior. An email such as the one you're describing would be harassment/retaliation/any given number of things, and could potentially make you liable for any damages that happen next.

@ayancey
Copy link

ayancey commented Apr 2, 2024

why don't we all just relax with the emailing of employers

@3v1n0
Copy link

3v1n0 commented Apr 2, 2024

Also the attacker included in the 5.6.0 release the support for the long-awaited multi-threading decompression making it very attractive to upgrade to...

It was probably a tactic to give a reason to upgrade. It's not always a fault for those who did or tried to do.

@ntt77
Copy link

ntt77 commented Apr 3, 2024

I've sent an email to 1Password security

Maybe I should send an email to Netcraft in London that their "Security engineer I" Andy Wang is sending emails to employers making baseless claims, 'possibly to shift blame' and to 'investigate if they're a state actor who have an interest in doing so.' (y'know - while we're all making baseless claims here)

Witch hunting is a shameful behavior.

???
so you want a hacker hacked 1pass then notify them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.