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

CVE-2023-4863 (libwebp heap buffer overflow) tracking #254798

Closed
47 of 90 tasks
delroth opened this issue Sep 12, 2023 · 75 comments
Closed
47 of 90 tasks

CVE-2023-4863 (libwebp heap buffer overflow) tracking #254798

delroth opened this issue Sep 12, 2023 · 75 comments

Comments

@delroth
Copy link
Contributor

delroth commented Sep 12, 2023

Filing this issue to track CVE-2023-4863 related actions in nixpkgs. Feel free to send questions my way and/or contribute via comments in this issue!

What's CVE-2023-4863

A buffer overflow in libwebp which allows a malicious actor to potentially get code execution in software that displays a specially crafted image file. This impacts pretty much all web browsers, as well as other software which might process or display untrusted images (image editing software, email clients, chat clients, social media clients, etc.). Chrome has rated this vulnerability as critical severity and has indicated that they have evidence some actors are already exploiting it in the wild.

This vulnerability was very shortly referred to as CVE-2023-5129, but that second CVE for the same vulnerability has since been withdrawn.

Current status

Firefox and Chromium are not vulnerable anymore as of 2023-09-16 in unstable and 23.05. Direct dependents of the system libwebp are also not vulnerable anymore. Some applications bundle their own version of libwebp instead of using the system version (including some other web browsers in nixpkgs: Brave, Tor Browser, etc.). Each of these need to be updated separately by nixpkgs maintainers. See below for a list of all the known applications that need an update and their status.

How to help

  • Review/merge any nixpkgs PR that you see pending in the task list below.
  • Help figure out a course of action for yet untriaged packages. Report your findings and suggested course of action in a comment here, and I'll update the sheet and the task list below.
  • If you have an idea of how to fix/address the vulnerability in any of the packages listed in the task list below, don't hesitate to post a comment here and send pull requests! Feel free to cc me on PRs so I can make sure they're tracked and they don't get lost.

Task list

Notes

  • For derivations that vendor a vulnerable libwebp, priority list of preferred action to take:
    • De-vendor libwebp and use the version from nixpkgs. (Difficult/impossible for binary provenance derivations.)
    • Update to a new version from upstream that has a more recent libwebp patched for the vulnerability (TODO: how to check?)
    • Mark as knownVulnerable at some point if upstream can't be convinced to make a new release.
  • List of all software in nixpkgs known to contain libwebp: https://gist.github.com/delroth/a49ce318c4a2c28ec3d7c8bc4adb9b61
@delroth
Copy link
Contributor Author

delroth commented Sep 12, 2023

delroth added a commit to delroth/nixpkgs that referenced this issue Sep 12, 2023
github-actions bot pushed a commit that referenced this issue Sep 12, 2023
yu-re-ka pushed a commit that referenced this issue Sep 12, 2023
(cherry picked from commit 6b29012)

Co-authored-by: Pierre Bourdon <delroth@gmail.com>
@mweinelt mweinelt pinned this issue Sep 12, 2023
@theotheroracle
Copy link
Contributor

theotheroracle commented Sep 13, 2023

i think one way you could check for vendored webp is with nix-locate, searching for libwebp.so, for example darktable might be vulnerable :

darktable.out                                    35,056 x /nix/store/1gzd3ccrpay6gxzcpdgyw32rxbjx14hg-darktable-4.4.1/lib/darktable/plugins/imageio/format/libwebp.so

possibly also koreader

koreader.out                                    453,256 r /nix/store/v1mbs4f2mi9zcx89b52qf0yajrj5kp27-koreader-2023.04/lib/koreader/libs/libwebp.so.7

the full output

(wineWowPackages.waylandFull.out)                     0 s /nix/store/z0i5x86ah38yfg72wg4zc1fsgi0q0m96-libwebp-1.3.1/lib/libwebp.so
(wineWowPackages.waylandFull.out)                     0 s /nix/store/z0i5x86ah38yfg72wg4zc1fsgi0q0m96-libwebp-1.3.1/lib/libwebp.so.7
(wineWowPackages.waylandFull.out)               516,292 x /nix/store/z0i5x86ah38yfg72wg4zc1fsgi0q0m96-libwebp-1.3.1/lib/libwebp.so.7.1.7
rigsofrods-bin.out                              420,216 x /nix/store/2gy1acpf7f1rx4q7jwnv2bfnf7qak95f-rigsofrods-bin-2022.12/share/rigsofrods/lib/libwebp.so.6
rigsofrods-bin.out                              420,216 x /nix/store/2gy1acpf7f1rx4q7jwnv2bfnf7qak95f-rigsofrods-bin-2022.12/share/rigsofrods/lib/libwebp.so.6.0.2
(localsend.out)                                       0 s /nix/store/zr6y7jlfryldg25bjvqcrpkqpsln6jrr-localsend-1.10.0-extracted/usr/lib/x86_64-linux-gnu/libwebp.so.7
(localsend.out)                                 428,592 r /nix/store/zr6y7jlfryldg25bjvqcrpkqpsln6jrr-localsend-1.10.0-extracted/usr/lib/x86_64-linux-gnu/libwebp.so.7.1.3
libwebp.out                                           0 s /nix/store/6h8vv9b2i00xzv48a2pm72k90rh26fhi-libwebp-1.3.1/lib/libwebp.so
libwebp.out                                           0 s /nix/store/6h8vv9b2i00xzv48a2pm72k90rh26fhi-libwebp-1.3.1/lib/libwebp.so.7
libwebp.out                                     492,424 x /nix/store/6h8vv9b2i00xzv48a2pm72k90rh26fhi-libwebp-1.3.1/lib/libwebp.so.7.1.7
koreader.out                                    453,256 r /nix/store/v1mbs4f2mi9zcx89b52qf0yajrj5kp27-koreader-2023.04/lib/koreader/libs/libwebp.so.7
(heroic.out)                                          0 s /nix/store/jcwmqv6mx9syrvr6a51km033wzv59swb-heroic-usr-target/lib/libwebp.so
(heroic.out)                                          0 s /nix/store/jcwmqv6mx9syrvr6a51km033wzv59swb-heroic-usr-target/lib/libwebp.so.7
(heroic.out)                                          0 s /nix/store/jcwmqv6mx9syrvr6a51km033wzv59swb-heroic-usr-target/lib/libwebp.so.7.1.7
(heroic.out)                                          0 s /nix/store/4j8r7q0f7q0vfzx87lyy9mj7h3099ik7-heroic-usr-multi/lib/libwebp.so
(heroic.out)                                          0 s /nix/store/4j8r7q0f7q0vfzx87lyy9mj7h3099ik7-heroic-usr-multi/lib/libwebp.so.7
(heroic.out)                                          0 s /nix/store/4j8r7q0f7q0vfzx87lyy9mj7h3099ik7-heroic-usr-multi/lib/libwebp.so.7.1.7
(heroic.out)                                          0 s /nix/store/7safyyman55cnbfb1d0i2pc1q79dxyzi-heroic-fhs/usr/lib32/libwebp.so
(heroic.out)                                          0 s /nix/store/7safyyman55cnbfb1d0i2pc1q79dxyzi-heroic-fhs/usr/lib32/libwebp.so.7
(heroic.out)                                          0 s /nix/store/7safyyman55cnbfb1d0i2pc1q79dxyzi-heroic-fhs/usr/lib32/libwebp.so.7.1.7
(heroic.out)                                          0 s /nix/store/7safyyman55cnbfb1d0i2pc1q79dxyzi-heroic-fhs/usr/lib64/libwebp.so
(heroic.out)                                          0 s /nix/store/7safyyman55cnbfb1d0i2pc1q79dxyzi-heroic-fhs/usr/lib64/libwebp.so.7
(heroic.out)                                          0 s /nix/store/7safyyman55cnbfb1d0i2pc1q79dxyzi-heroic-fhs/usr/lib64/libwebp.so.7.1.7
(golden-cheetah-bin.out)                        424,896 r /nix/store/wpy2vpbkvqa7j4nw9vi93znfckwikl5y-golden-cheetah-3.6-RC4-extracted/lib/libwebp.so.6
darktable.out                                    35,056 x /nix/store/1gzd3ccrpay6gxzcpdgyw32rxbjx14hg-darktable-4.4.1/lib/darktable/plugins/imageio/format/libwebp.so

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

i think one way you could check for vendored webp is with nix-locate, searching for libwebp.so

Thanks, that's indeed useful! I think the most common case though would be bundling the code and linking statically with the lib, which wouldn't necessarily be found by this - but maybe I'm just too pessimistic :)

EDIT: added the ones you found to the tracking in the issue's first comment so we don't lose track of it.

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

darktable: links with libwebp, the libwebp.so is an internal plugin and is not a vendored version.

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

koreader: binary provenance, ships a vulnerable prebuilt libwebp (cc: @contrun @neonfuz).

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

localsend: binary provenance, ships a vulnerable prebuilt libwebp (cc: @sikmir)

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

golden-cheetah-bin: binary provenance, ships a vulnerable prebuilt libwebp (cc: @gador @adamcstephens)

@yu-re-ka
Copy link
Contributor

libreoffice sources file lists a libwebp-1.3.0.tar.gz (or libwebp-1.2.4.tar.gz for libreoffice-still)

@yu-re-ka
Copy link
Contributor

oculante, gst_all_1.gst-plugins-rs vendor libwebp via the rust crate libwebp-sys2

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

oculante, gst_all_1.gst-plugins-rs vendor libwebp via the rust crate libwebp-sys2

Ugh, and good luck finding all the things that end up transitively depending on that crate I guess. qnighy/libwebp-sys2-rs#21 I suggested they file a GHSA so dependabot can go and do its thing, but it might still take a while to trickle down through dependents.

Anyway, libwebp-sys2 version 0.1.8 looks like it's fixed.

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

libreoffice sources file lists a libwebp-1.3.0.tar.gz (or libwebp-1.2.4.tar.gz for libreoffice-still)

There's also ++ optionals (lib.versionAtLeast (lib.versions.majorMinor version) "7.4") [ libwebp ]; and I can't seem to find the vendored code by grepping for strings in the binaries. Would need further checking, but I'm tempted to say libreoffice is fine?

@yu-re-ka
Copy link
Contributor

The libwebp-sys2 crate also will link against the system libwebp if it is found.
I'm currently compiling a list of rust packages that use libwebp-sys2.

@delroth
Copy link
Contributor Author

delroth commented Sep 13, 2023

The libwebp-sys2 crate also will link against the system libwebp if it is found.

But since it transparently falls back to the vendored source, I'm going to assume most Rust programs in nixpkgs haven't bothered declaring libwebp (and pkg-config?) as buildInputs... But at least that might give us a lever to patch without requiring an upstream cargo deps bump?

@yu-re-ka
Copy link
Contributor

...unless the application has enabled the libwebp-sys2 'static' feature, then it will skip looking for the system one and build its own 🙃

@yu-re-ka
Copy link
Contributor

Unsure how to deal with the libwebp-sys2 things, which would still be vulnerable for cross-compiling and pkgsStatic. Opened an upstream issue: qnighy/libwebp-sys2-rs#23

@xyzeva
Copy link

xyzeva commented Sep 13, 2023

Hi!

Sorry for just popping in randomly, are there any publicly available workarounds for this issue currently? I'm on nixos-unstable, but it seems like firefox nor others have gotten their version bump on that branch.

@xyzeva
Copy link

xyzeva commented Sep 25, 2023

Great, thanks for looking into it! Hopefully they'll roll out that update to the stable branch soon... I guess it's difficult for a small indie developer like them, it's only been 2 weeks since the fix was made available! :-)

To make it better, I reported them this like 2 weeks ago! They're still working on running the npm command on the stable branch, give them some time!

@mkg20001
Copy link
Member

fluffychat and flutter updates have been backported now: #257166

@ShamrockLee
Copy link
Contributor

ShamrockLee commented Sep 26, 2023

I made a draft PR that contains the caprine-bin update (#257372), but the updated app turns out to be unusable (sindresorhus/caprine#2074).

@ShamrockLee
Copy link
Contributor

I made a draft PR that contains the caprine-bin update (#257372), but the updated app turns out to be unusable (sindresorhus/caprine#2074).

The above issue is resolved in Caprine 2.58.3. Please take a look at #257372.

@delroth delroth changed the title CVE-2023-4863 (libwebp heap buffer overflow) tracking CVE-2023-5129 (ex CVE-2023-4863, libwebp heap buffer overflow) tracking Sep 26, 2023
@delroth
Copy link
Contributor Author

delroth commented Sep 26, 2023

@Artturin @Scrumplex it was brought to my attention that the Darwin version for Discord was not bumped in 6 months, and is thus still vulnerable to this libwebp vuln.

If nobody maintains this software can it be removed and/or marked as knownVulnerable? Thanks!

@vcunat
Copy link
Member

vcunat commented Sep 26, 2023

I'd say that after a bit of wait you mark packages as vulnerable and that is the main way of finding out whether someone is really willing to keep it alive.

@Scrumplex
Copy link
Member

it was brought to my attention that the Darwin version for Discord was not bumped in 6 months, and is thus still vulnerable to this libwebp vuln.

If nobody maintains this software can it be removed and/or marked as knownVulnerable? Thanks!

I have bumped them in #257496. The main issue is that r-ryantm isn't helping us out here, as there is no updateScript for the darwin packaging. Not sure if any of the other Discord maintainers are using Darwin, but I certainly don't and would need some assistance testing these.

@ShamrockLee
Copy link
Contributor

ShamrockLee commented Sep 26, 2023

losslesscut-bin is affected. I created mifi/lossless-cut#1726 to remind the LosslessCut upstream to make a new patch release, so that me can update losslesscut-bin.

@OPNA2608
Copy link
Contributor

palemoon-bin is affected, fix: #257126

@wamserma wamserma mentioned this issue Sep 28, 2023
12 tasks
@delroth delroth changed the title CVE-2023-5129 (ex CVE-2023-4863, libwebp heap buffer overflow) tracking CVE-2023-4863 (libwebp heap buffer overflow) tracking Sep 28, 2023
delroth added a commit that referenced this issue Oct 1, 2023
See #254798. Upstream has not provided any update for this critical
vulnerability in > 2 weeks. These programs are also likely vulnerable to
many more old vulnerabilities due to using EOL versions of Electron.
delroth added a commit to delroth/nixpkgs that referenced this issue Oct 1, 2023
See NixOS#254798. Upstream has not provided any update for this critical
vulnerability in > 2 weeks. These programs are also likely vulnerable to
many more old vulnerabilities due to using EOL versions of Electron.

(cherry picked from commit dddf103)
This was referenced Oct 1, 2023
@delroth
Copy link
Contributor Author

delroth commented Oct 2, 2023

All the packages I evaluated as being high-risk have now been taken care of (and most of them did actually get updates, woo! only marked 2 or 3 as insecure). Right now I don't think anyone has the bandwidth to try and track the rest. I'm going to close this bug - if someone does want to take over the remediation for the rest of the impacted packages, feel free to reopen and assign yourself.

(Note however that there is a large overlap between vulnerable to this libwebp vuln and vulnerable to the recent libvpx vuln... so maybe just go help over there instead of reusing this bug.)

@delroth delroth closed this as completed Oct 2, 2023
@fabianhjr
Copy link
Member

Unpinning due to closing

@fabianhjr fabianhjr unpinned this issue Oct 3, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/my-wishlist-for-nixos-security-in-2024/34999/22

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

No branches or pull requests