CVE-2021-31566 Path traversal in libarchive

High 7.8 Published Updated

A local attacker can exploit improper link resolution in libarchive to modify file permissions and gain privileges by tricking a user into extracting a malicious archive.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2021-31566?

CVE-2021-31566 is a high-severity path traversal vulnerability in Debian Debian Linux, published on 23 Aug 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

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.

Weakness: CWE-59

Which versions are affected by CVE-2021-31566?

It affects 14 products.

Linux distribution packages (7)
libarchive SUSE:Linux Enterprise Micro 5.3All versions3.5.1-150400.3.9.1
libarchive SUSE:Linux Enterprise Module for Basesystem 15 SP3All versions3.4.2-150200.4.12.1
libarchive SUSE:Linux Enterprise Module for Basesystem 15 SP4All versions3.5.1-150400.3.9.1
libarchive SUSE:Linux Enterprise Module for Development Tools 15 SP3All versions3.4.2-150200.4.12.1
libarchive SUSE:Linux Enterprise Module for Development Tools 15 SP4All versions3.5.1-150400.3.9.1
libarchive openSUSE:Leap 15.3All versions3.4.2-150200.4.12.1
libarchive openSUSE:Leap 15.4All versions3.5.1-150400.3.9.1

Products include Debian Debian Linux, Fedoraproject Fedora, Libarchive Libarchive, Redhat Codeready Linux Builder, Redhat Enterprise Linux, Redhat Enterprise Linux Eus and 8 more.

How do I fix CVE-2021-31566?

Apply the vendor's patch.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2021-31566 being exploited?

There is no known exploitation of CVE-2021-31566 in the wild and no public exploit code.

All Debian Debian Linux vulnerabilities

Sources

Also known as ALPINE-CVE-2021-31566, CLSA-2026-1777307149, CLSA-2026-1777544831, DEBIAN-CVE-2021-31566, GHSA-mg62-fpgc-6hjj, JLSEC-2025-236 and 3 more.

Is CVE-2021-31566 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free