Bug 2024237 (CVE-2021-31566) - CVE-2021-31566 libarchive: symbolic links incorrectly followed when changing modes, times, ACL and flags of a file while extracting an archive
Summary: CVE-2021-31566 libarchive: symbolic links incorrectly followed when changing ...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2021-31566
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
: 2024242 (view as bug list)
Depends On: 2024238 2024239 2026075 2026078 2026828 2026829 2028035
Blocks: 2024258
TreeView+ depends on / blocked
 
Reported: 2021-11-17 16:42 UTC by Guilherme de Almeida Suckevicz
Modified: 2023-02-02 10:34 UTC (History)
19 users (show)

Fixed In Version: libarchive 3.5.2
Doc Type: If docs needed, set a value
Doc Text:
An improper link resolution flaw can occur while extracting an archive leading to changing modes, times, access control lists, and flags of a file outside of the archive. An attacker may provide a malicious archive to a victim user, who would trigger this flaw when trying to extract the archive. A local attacker may use this flaw to gain more privileges in a system.
Clone Of:
Environment:
Last Closed: 2022-03-15 15:01:34 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2022:0892 0 None None None 2022-03-15 10:20:05 UTC

Description Guilherme de Almeida Suckevicz 2021-11-17 16:42:34 UTC
Some modes, times, ACLs and file flags especially on directories are set on archive_write_close() time. An archive can contain multiple entries with the same path. If a directory entry is marked for post-processing and a symlink entry with the same path "replaces" the directory with the symlink, the "fixup" postprocessing may alter the link target instead of the file itself.

Reference:
https://github.com/libarchive/libarchive/issues/1566

Upstream patch:
https://github.com/libarchive/libarchive/commit/b41daecb5ccb4c8e3b2c53fd6147109fc12c3043

Comment 1 Guilherme de Almeida Suckevicz 2021-11-17 16:42:59 UTC
Created libarchive tracking bugs for this issue:

Affects: fedora-all [bug 2024238]


Created mingw-libarchive tracking bugs for this issue:

Affects: fedora-all [bug 2024239]

Comment 4 Doran Moppert 2021-11-26 04:29:17 UTC
Second upstream patch completes the fix for this issue:

https://github.com/libarchive/libarchive/commit/e2ad1a2c3064fa9eba6274b3641c4c1beed25c0b

Comment 5 Doran Moppert 2021-11-26 04:30:37 UTC
*** Bug 2024242 has been marked as a duplicate of this bug. ***

Comment 11 Honza Horak 2021-12-22 13:35:58 UTC
There is another upstream fix that seems to be related (mentions the original b41daec):
https://github.com/libarchive/libarchive/commit/8a1bd5c18e896f0411a991240ce0d772bb02c840

which seems to be problematic and was later improved with this one:
https://github.com/libarchive/libarchive/commit/ede459d2ebb879f5eedb6f7abea203be0b334230

Comment 13 errata-xmlrpc 2022-03-15 10:20:03 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2022:0892 https://access.redhat.com/errata/RHSA-2022:0892

Comment 14 Product Security DevOps Team 2022-03-15 15:01:31 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-31566


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