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

[20.09] mutt: fix for CVE-2021-3181 #110692

Merged
merged 1 commit into from Jan 25, 2021

Conversation

tu-maurice
Copy link
Contributor

@tu-maurice tu-maurice commented Jan 24, 2021

Motivation for this change

In #110449 the CVE-2021-3181 was addressed for unstable, however the consensus seems to be that we cannot update mutt from 1.14.7 to 2.0.5 on release-20.09 due to breaking changes in version 2, and thus have to backport the patches.

I realized the patches referenced in the CVE apply rather cleanly to the 1.14.7 sources as well. It builds without errors and the resulting binary starts. However I am not a mutt user, just a guy with a little spare time. So I would require the maintainer @rnhmjoj and other users of mutt to try this out before merging.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@@ -40,6 +40,8 @@ stdenv.mkDerivation rec {
url = "https://gitlab.com/muttmua/mutt/-/commit/04b06aaa3e0cc0022b9b01dbca2863756ebbf59a.patch";
sha256 = "117mm757yj4k4cb9f1cmc9p0dqmi2mf92qsxvi8a794b9kdj5m2z";
})
# CVE-2021-3181
./CVE-2021-3181.patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use fetchpatch instead of pulling the file into nixpkgs? See the line just above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It is 3 commits though, all 3 referenced by the CVE.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 24, 2021

However I am not a mutt user, just a guy with a little spare time.

Thank you for opening a PR, however I think we should wait to for the CVE evaluation before backporting this: I'm not even sure this is the only commit that needs to be backported. I could try asking the maintainers in the meantime.

@tu-maurice
Copy link
Contributor Author

I think we should wait to for the CVE evaluation

I thought so. I didn't expect this to get merged, I just wanted to have a go at it and thought might as well also upload it. I'll set this to draft but I can close it if there's no reason to keep it.

@tu-maurice tu-maurice marked this pull request as draft January 24, 2021 14:04
@ofborg ofborg bot requested a review from rnhmjoj January 24, 2021 14:05
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 24, 2021

@tu-maurice: I asked in the #mutt IRC channel and they told me only the first patch is needed to fix the CVE. The second should probably not be backported and the third is unrelated.

@tu-maurice
Copy link
Contributor Author

Alright, first patch only. Here you go. 😄

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 24, 2021

There is a hash mismatch for the patch... look at the log.

@tu-maurice
Copy link
Contributor Author

@rnhmjoj No idea what was downloaded in this log, but even repeatedly downloading and checking the patch provides me with the hash I specified in the commit.

Maybe ofborg received something else? like an error page?

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 25, 2021

No, I'm getting the same hash as of ofBorg's. Can you share the result of fetchpatch, for comparison?

@tu-maurice
Copy link
Contributor Author

tu-maurice commented Jan 25, 2021

The difference was that fetchpatch removes unnecessary lines from the patch while nix-prefetch-url, which I used to get the hash initially, does not. I was able to build mutt successfully on my machine because fetchpatch did not download and alter the patch again because there already was an entry in my nix store with that hash provided by nix-prefetch-url. That obviously did not work for ofborg or you.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 25, 2021

The difference was that fetchpatch removes unnecessary lines from the patch while nix-prefetch-url

Oh yeah, that's a common pitfall with nix-prefetch-url.

Looks good to go.

@rnhmjoj rnhmjoj marked this pull request as ready for review January 25, 2021 13:21
@rnhmjoj rnhmjoj merged commit 70f5006 into NixOS:release-20.09 Jan 25, 2021
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 25, 2021

Thank you!

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

Successfully merging this pull request may close these issues.

None yet

3 participants