Bug 1584412 - sharpziplib: zip slip - arbitrary file write vulnerability / arbitrary code execution using a specially crafted zip file
Summary: sharpziplib: zip slip - arbitrary file write vulnerability / arbitrary code e...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1585948 1585949
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-30 20:21 UTC by Laura Pardo
Modified: 2019-09-29 14:40 UTC (History)
3 users (show)

Fixed In Version: sharpcompress 0.21.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-10 10:27:03 UTC
Embargoed:


Attachments (Terms of Use)

Description Laura Pardo 2018-05-30 20:21:47 UTC
A vulnerability has been found in the way developers have implemented the archive extraction of files. An arbitrary file write vulnerability, that can be achieved using a specially crafted zip archive (affects other archives as well, bzip2, tar,xz, war, cpio, 7z), that holds path traversal filenames. So when the filename gets concatenated to the target extraction directory, the final path ends up outside of the target folder. Of course if an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily. This affects multiple libraries that lacks of a high level APIs that provide the archive extraction functionality.

Comment 1 Doran Moppert 2018-06-05 07:32:07 UTC
Public via:

https://snyk.io/vuln/SNYK-DOTNET-SHARPCOMPRESS-60246

Comment 2 Doran Moppert 2018-06-05 07:32:51 UTC
Created sharpziplib tracking bugs for this issue:

Affects: fedora-27 [bug 1585948]
Affects: fedora-28 [bug 1585949]

Comment 3 Timotheus Pokorra 2018-06-05 20:56:01 UTC
I had a look at https://github.com/snyk/zip-slip-vulnerability
It does not actually say that sharplibzip is vulnerable.

There does not seem to be an upstream bug for sharplibzip yet.

Comment 4 Doran Moppert 2018-06-06 01:10:29 UTC
(In reply to Timotheus Pokorra from comment #3)
> I had a look at https://github.com/snyk/zip-slip-vulnerability
> It does not actually say that sharplibzip is vulnerable.
> 
> There does not seem to be an upstream bug for sharplibzip yet.

hmm you're right, there seems to have been some confusion between this report and the one for sharpcompress.

The Snyk advisory lists sharpziplib as "lacks high-level API" which is only partially correct.  FastZip.cs and TarArchive.cs both include ExtractEntry methods which appear to be vulnerable.  The wiki examples also don't defend against these attacks, afaics.

This pull request against SharpCompress illustrates one strategy to fix:

https://github.com/adamhathcock/sharpcompress/pull/374

Comment 5 Timotheus Pokorra 2018-06-20 18:39:32 UTC
there is now an official bug upstream:
https://github.com/icsharpcode/SharpZipLib/issues/232

and a potential fix:
https://github.com/piksel/SharpZipLib/commit/79503293a6991d7074236b9442c151562b94c648

Comment 6 Product Security DevOps Team 2019-06-10 10:27:03 UTC
This CVE Bugzilla entry is for community support informational purposes only as it does not affect a package in a commercially supported Red Hat product. Refer to the dependent bugs for status of those individual community products.


Note You need to log in before you can comment on or make changes to this bug.