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

minizip: Check length of comment, filename, and extra field, in zipOpenNewFileInZip4_64 #843

Closed
wants to merge 1 commit into from

Conversation

zmodem
Copy link
Contributor

@zmodem zmodem commented Aug 18, 2023

These are stored in 16-bit fields in the zip file format. Passing longer values would generate an invalid file.

Passing very long values could also cause the computation of zi->ci.size_centralheader to overflow, which would cause heap buffer overflow on subsequent writes to zi->ci.central_header.

This was reported to Chromium in https://crbug.com/1470539, and patched in https://crrev.com/1182507 and https://crrev.com/1182669

…enNewFileInZip4_64

These are stored in 16-bit fields in the zip file format. Passing longer
values would generate an invalid file.

Passing very long values could also cause the computation of
zi->ci.size_centralheader to overflow, which would cause heap buffer
overflow on subsequent writes to zi->ci.central_header.
@madler
Copy link
Owner

madler commented Aug 19, 2023

Applied.

@madler madler closed this Aug 19, 2023
@Neustradamus
Copy link

@zmodem, @madler: Can you look @irwir comments here:

@zmodem zmodem deleted the minizip_fix branch August 21, 2023 06:54
@ljavorsk
Copy link

ljavorsk commented Oct 17, 2023

Hi, @madler does this affect the versions prior to 1.3 as well?

@ljavorsk
Copy link

Also the CVE-2023-45853 has been assigned to this bug

@Persi
Copy link

Persi commented Oct 20, 2023

@madler The above mentioned CVE is ranked with high criticality. As the fix already is in delelop branch, could you please provide a new patch release 1.3.1 of this lib?

@Neustradamus
Copy link

@madler: Can you look?

LeSuisse added a commit to LeSuisse/nixpkgs that referenced this pull request Oct 22, 2023
@rossburton
Copy link

For anyone looking for the integrated patch, it's 73331a6.

jpuhlman pushed a commit to MontaVista-OpenSourceTechnology/poky that referenced this pull request Oct 23, 2023
Source: poky-nut
MR: 127628
Type: Security Fix
Disposition: Merged from poky-nut
ChangeID: 6e265e44febbb6fdf85c7926b9a64b731c98d814
Description:

Backport commit merged to develop branch from PR linked in NVD report:
* https://nvd.nist.gov/vuln/detail/CVE-2023-45853
* madler/zlib#843

Signed-off-by: Peter Marko <[email protected]>
Signed-off-by: Steve Sakoman <[email protected]>
Signed-off-by: Jeremy A. Puhlman <[email protected]>
@Neustradamus
Copy link

@rossburton: Yes it is in "develop" branch, not in a stable build.

github-actions bot pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 24, 2023
Upstream PR: madler/zlib#843

(cherry picked from commit 282d9cd)
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Oct 25, 2023
Backport commit merged to develop branch from PR linked in NVD report:
* https://nvd.nist.gov/vuln/detail/CVE-2023-45853
* madler/zlib#843

Signed-off-by: Peter Marko <[email protected]>
Signed-off-by: Steve Sakoman <[email protected]>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Oct 25, 2023
Backport commit merged to develop branch from PR linked in NVD report:
* https://nvd.nist.gov/vuln/detail/CVE-2023-45853
* madler/zlib#843

(From OE-Core rev: 6e265e44febbb6fdf85c7926b9a64b731c98d814)

Signed-off-by: Peter Marko <[email protected]>
Signed-off-by: Steve Sakoman <[email protected]>
rouault added a commit to rouault/gdal that referenced this pull request Nov 3, 2023
rouault added a commit to OSGeo/gdal that referenced this pull request Nov 4, 2023
@rvoliveti-cpu
Copy link

Hi, @madler does this affect the versions prior to 1.3 as well for example version 1.2.12?

@aiakubovich
Copy link

@madler @zmodem

I have pipeline that has to use Aqua Scan and I started to get critical vulnerability for version 1:1.2.13.dfsg-1. Here is reference to report: https://security-tracker.debian.org/tracker/CVE-2023-45853. Could you please look at it?

@yaayes
Copy link

yaayes commented Nov 8, 2023

@madler could you please release a patch ?

@svadnala
Copy link

svadnala commented Nov 8, 2023

@madler @zmodem

I have pipeline that has to use Aqua Scan and I started to get critical vulnerability for version 1:1.2.13.dfsg-1. Here is reference to report: https://security-tracker.debian.org/tracker/CVE-2023-45853. Could you please look at it?

Similar issue, are there any instructions to get this patch while awaiting to be included as part of debian package repository 1.3?

@cgargas
Copy link

cgargas commented Nov 13, 2023

@madler @zmodem
I have pipeline that has to use Aqua Scan and I started to get critical vulnerability for version 1:1.2.13.dfsg-1. Here is reference to report: https://security-tracker.debian.org/tracker/CVE-2023-45853. Could you please look at it?

Similar issue, are there any instructions to get this patch while awaiting to be included as part of debian package repository 1.3?

Running into same issue with the vulnerability being flagged via a scan. Any updates as to when this fix will be merged into the master branch?

@yashpct2807
Copy link

Running into same issue with the vulnerability being flagged via a scan. Any updates on this stable release?

@madler
Copy link
Owner

madler commented Mar 10, 2024

@madler Can you help in fix the issue?

I don't see how. zlib was fixed. There's nothing more I can do after that.

I am not sure why it still shows the vulnerability

What is the "it" that is saying that there is a vulnerability?

@DarrenJAN
Copy link

By palamida scan, it showed that there are vulnerability on the identical files during this upgrade.
It is the palamida bug.

@raghu298
Copy link

@madler: VulnerabilityID": "CVE-2023-45853",
"Title": "zlib: integer overflow and resultant heap-based buffer overflow in zipOpenNewFileInZip4_6",
"Description": "MiniZip in zlib through 1.3 has an integer overflow and resultant heap-based buffer overflow in zipOpenNewFileInZip4_64 via a long filename, comment, or extra field. NOTE: MiniZip is not a supported part of the zlib product. NOTE: pyminizip through 0.2.6 is also vulnerable because it bundles an affected zlib version, and exposes the applicable MiniZip code through its compress API.",

This is the vulnerability and its occurring in python:3.11.8 image as built on debain 12 image.
Is there a way to upgrade to 1.3.1 which is not vulenarble?

@madler
Copy link
Owner

madler commented Mar 11, 2024

@raghu298 You are still not telling me what "it" is that is saying that. I don't need to know the message. I want to know who the messenger is. What, exactly, is reporting this? Are you running something to tell you this?

What do you mean that it is "occurring in python:3.11.8 image"? Are you scanning the Python executable? Are you running Python code? What are you doing to incite the message?

@raghu298
Copy link

raghu298 commented Mar 11, 2024

@madler I have trivy image scan tool which scans the image and shows the vulnerabilities.
I am using python 3.11.8-slim image which is built on top of debian image and that has zlib1g "InstalledVersion": "1:1.2.13.dfsg-1" which is vulnerable(see above msg).
Is there a way to upgrade to zlib1g to 1.3.1 version in the python/ debain image?

@raghu298
Copy link

@madler Is there a way to upgrade zlib1g to non-vulnerable version?

@madler
Copy link
Owner

madler commented Mar 11, 2024

You would have to find a version of the Python 3 executable with a newer zlib, or rebuild one yourself.

But you don't have to. Python does not use minizip, so there is no vulnerability. If you have installed the pyminizip package, it may be vulnerable, but your tool is not reporting it there. It is reporting the zlib version being used by the Python executable.

In short, you do not have a problem. trivy is wrong.

@raghu298
Copy link

@madler i think python image is built on top of debain image so the tool is scanning python image and finding the vulenarability.
Issue is with debian image

@Ajith-Reddy1205
Copy link

Is there a way to upgrade zlib1g to non-vulnerable version? -- any update on this?

@madler
Copy link
Owner

madler commented Mar 20, 2024

@Ajith-Reddy1205
I don't know how to make this any clearer.

  1. You do not have a problem that needs fixing. Your current version of zlib1g does not have that vulnerability. It does not have minizip in it. It never did. You do not need to do anything. Just carry on.
  2. This is not the place to ask about how to update Python or Debian.

@UBessle
Copy link

UBessle commented Mar 22, 2024

Thanks for the clarification @madler,
the remaining problem is, that trivvy marks it as vulnerable nevertheless and trivvy get's this information from the debian security tracker (https://security-tracker.debian.org/tracker/CVE-2023-45853), which claims, that zlib1g with version 1:1.2.13.dfsg-1 is indeed vulnerable.
So the question is, how to get the entry in debian security tracker fixed?
Because my management as well is asking me, when the critical vulnerability will be fixed.

@VincentAntoine
Copy link

VincentAntoine commented Apr 11, 2024

Same here, debian images (and all images based on debian, including for instance python images) are marked as critically vulnerable by Trivy.
As Trivy is based on debian security-tracker, and zlib 1.2 is marked as vulnerable in the debian security tracker, I guess it would require that the debian team upgrades zlib to 1.3 in a future release for Trivy to mark it as not vulnerable. But in the Trivy report, CVE-2023-45853 is marked as "Won't fix" in Debian Bookworm (which I wonder where this comes from ?) and zlib is upgraded to 1.3 only in Debian Trixie. So it looks like it will stay like this until the release of Trixie (next year ?).

~$ trivy image debian:stable-slim

debian:stable-slim (debian 12.5)

Total: 78 (UNKNOWN: 0, LOW: 57, MEDIUM: 15, HIGH: 5, CRITICAL: 1)

┌────────────────────┬─────────────────────┬──────────┬──────────────┬───────────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
│      Library       │    Vulnerability    │ Severity │    Status    │   Installed Version   │ Fixed Version │                            Title                             │
┌────────────────────┬─────────────────────┬──────────┬──────────────┬───────────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
│          ...       │         ...         │    ...   │     ...      │           ...         │      ...      │                            ...                               │
├────────────────────┼─────────────────────┼──────────┼──────────────┼───────────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
│ zlib1g             │ CVE-2023-45853      │ CRITICAL │ will_not_fix │ 1:1.2.13.dfsg-1       │               │ zlib: integer overflow and resultant heap-based buffer       │
│                    │                     │          │              │                       │               │ overflow in zipOpenNewFileInZip4_6                           │
│                    │                     │          │              │                       │               │ https://avd.aquasec.com/nvd/cve-2023-45853                   │
└────────────────────┴─────────────────────┴──────────┴──────────────┴───────────────────────┴───────────────┴──────────────────────────────────────────────────────────────┘

@madler
Copy link
Owner

madler commented Apr 11, 2024

Sigh. I tried.

It is this page: https://security-tracker.debian.org/tracker/CVE-2023-45853 , that incorrectly marks 1:1.2.13.dfsg-1 as vulnerable, when in fact it has no minizip code in it whatsoever. (I verified that by downloading it and listing the external symbols in the .so file.) I managed to reach someone at debian.org who seems to be in control of that page, but instead of fixing the page, they defended it, even though it's wrong.

@VincentAntoine
Copy link

This is really weird. It's really against their interest to have ALL Debian images flagged as critically vulnerable for so long.

@superlazyname
Copy link

I'm just putting this as a FYI, to try and help people who might land here looking for answers.

Mark's probably sick of hearing about this by now. Sorry Mark, I just didn't see anyone post a public discussion of this with the details I was looking for. Maybe at least I gave you some things to link to if it would help?

  • I did some legwork on this. From what I understand this is a false positive detection in the Debian images. Unfortunately there's a ton of Debian based container images that will get flagged, Debian is a very popular base image.

  • The source code of that particular version of zlib has a vulnerability, but the vulnerable part isn't in the Debian package. The Debian binary for zlib doesn't contain the vulnerable code.

Unfortunately it looks like Bookworm and all older releases will be flagged by this, and this will only be (coincidentally) fixed by the next major release (Trixie). Debian doesn't have a target date for that release right now, but if they keep up with their usual release schedule, I'd guess that won't be for over a year from now.

Here's some other things for further reading, I put more information in them:

I'm not sure if there's a way to modify the code of trivy to handle this case better, but it seems like there's not, because it sounds like "ignored" might be used in the Debian tracker for both "won't fix" and "not affected", and Trivy interprets "ignored" as "this container image is still vulnerable" so that distinction is very important for corporate vulnerability dashboards. I notice that Clair (https://github.com/quay/clair) also seems to have the same problem.

It would seem like the Debian tracker is meant for humans to read, not bots, and tools that try and "simplify" things by reducing that to "you have 10 vulnerabilities" have a hard time handling that. I'm not going to bug either trivy or Debian anymore.

Summary:

  • Don't bug Mark, there's nothing that can be done from his side
  • Whether debian or trivy is wrong depends on your definition of "ignored", "not affected", and "won't fix"
  • It seems like debian and trivy can't be made to agree on that.

Hope that helps

@alexmaurizio
Copy link

Note to Snyk users: you will find this reported as a critical, unfixable vulnerability on your dockers and you will sooner or later end up here.

@superlazyname answer applies to us too :)

@stnert
Copy link

stnert commented Oct 9, 2024

In Arch Linux this needs removed of website (https://security.archlinux.org/) and arch-audit... Any chance of fixing this?

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.