Bug 28444

Summary: zstd creates compressed files with incorrect permissions (CVE-2021-2403[12])
Product: Mageia Reporter: David Walser <luigiwalser>
Component: SecurityAssignee: QA Team <qa-bugs>
Status: RESOLVED FIXED QA Contact: Sec team <security>
Severity: major    
Priority: Normal CC: mageia, ouaurelien, sysadmin-bugs, thierry.vignaud
Version: 8Keywords: advisory, validated_update
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: MGA7TOO MGA7-64-OK MGA8-64-OK
Source RPM: zstd-1.4.0-1.mga7.src.rpm CVE: CVE-2021-24031, CVE-2021-24032
Status comment:

Description David Walser 2021-02-26 16:38:41 CET
Debian has issued an advisory on February 10:
https://www.debian.org/security/2021/dsa-4850

There is discussion of the issue and fix in the Debian bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=981404
Comment 1 David Walser 2021-02-26 16:44:47 CET
Debian has issued an advisory on February 20:
https://www.debian.org/security/2021/dsa-4859

The initial fix, both upstream and in Debian, was insufficient, so Mageia 8 is also affected.

Status comment: (none) => Patches available from upstream and Debian
Summary: zstd creates compressed files with incorrect permissions (bdo#981404) => zstd creates compressed files with incorrect permissions (bdo#981404, bdo#982519)
Version: 7 => 8
Whiteboard: (none) => MGA7TOO

Comment 2 Lewis Smith 2021-02-27 09:10:43 CET
Thierry looks the best person for this.

Assignee: bugsquad => thierry.vignaud

Comment 3 David Walser 2021-05-28 20:18:36 CEST
There are CVEs for this.

Ubuntu has issued an advisory for this on March 8:
https://ubuntu.com/security/notices/USN-4760-1

Summary: zstd creates compressed files with incorrect permissions (bdo#981404, bdo#982519) => zstd creates compressed files with incorrect permissions (CVE-2021-2403[12])
Severity: normal => major

David Walser 2021-06-22 01:08:40 CEST

CC: (none) => thierry.vignaud
Assignee: thierry.vignaud => pkg-bugs

Comment 4 David Walser 2021-06-27 19:54:17 CEST
Advisory (Mageia 7):
========================

Updated zstd packages fix security vulnerability:

In the Zstandard command-line utility prior to v1.4.1, output files were
created with default permissions. Correct file permissions (matching the input)
would only be set at completion time. Output files could therefore be readable
or writable to unintended parties (CVE-2021-24031).

References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-24031
https://ubuntu.com/security/notices/USN-4760-1


Advisory (Mageia 8):
========================

Updated zstd packages fix security vulnerability:

Beginning in v1.4.1 and prior to v1.4.9, due to an incomplete fix for
CVE-2021-24031, the Zstandard command-line utility created output files with
default permissions and restricted those permissions immediately afterwards.
Output files could therefore momentarily be readable or writable to unintended
parties (CVE-2021-24032).

References:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-24032
https://ubuntu.com/security/notices/USN-4760-1
========================

Updated packages in core/updates_testing:
========================
zstd-1.4.0-1.1.mga7
libzstd1-1.4.0-1.1.mga7
libzstd-devel-1.4.0-1.1.mga7
zstd-1.4.8-1.1.mga8
lib64zstd1-1.4.8-1.1.mga8
lib64zstd-devel-1.4.8-1.1.mga8

from SRPMS:
zstd-1.4.0-1.1.mga7.src.rpm
zstd-1.4.8-1.1.mga8.src.rpm

Status comment: Patches available from upstream and Debian => (none)
Assignee: pkg-bugs => qa-bugs

Comment 5 PC LX 2021-06-28 12:46:58 CEST
Installed and tested without issues.

I don't have existing zstd compressed files so I created some and used those to test all zstd* binaries.

Tested:
- compress, decrompres, compare;
- single and multithreaded compression;
- zstdcat, zstdgrep, zstdless;
- tested through tar.



$ uname -a
Linux marte 5.10.45-desktop-2.mga7 #1 SMP Sat Jun 19 15:58:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ rpm -qa | grep zstd | sort
lib64zstd1-1.4.0-1.1.mga7
libzstd1-1.4.0-1.1.mga7
zstd-1.4.0-1.1.mga7

CC: (none) => mageia

Comment 6 PC LX 2021-06-29 12:38:12 CEST
Since the end-of-support for Mageia 7 is approaching, I'm giving this update an OK for x86_64 based on comment 5.

Whiteboard: MGA7TOO => MGA7TOO MGA7-64-OK

Comment 7 David Walser 2021-07-08 23:18:32 CEST
rsync uses this library to do zstd compress with --compress=zstd, so I used it to download the VERSION file from my local Cauldron mirror before and after the update.

$ rsync -av --compress=zstd rsync://<servername>/mageia/distrib/cauldron/i586/VERSION .
$ cat VERSION 
Mageia 9 Devel-i586-Download 20210707 21:53
$ rm VERSION

Same results before and after.  Done on Mageia 8 x86_64.

Whiteboard: MGA7TOO MGA7-64-OK => MGA7TOO MGA7-64-OK MGA8-64-OK

Comment 8 Aurelien Oudelet 2021-07-08 23:36:05 CEST
Validating.

CC: (none) => ouaurelien, sysadmin-bugs
Keywords: (none) => advisory, validated_update
CVE: (none) => CVE-2021-24031, CVE-2021-24032

Comment 9 Mageia Robot 2021-07-09 02:28:19 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGASA-2021-0322.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 10 Mageia Robot 2021-07-09 02:28:21 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGASA-2021-0323.html