Use-After-Free Vulnerability in libarchive
Summary
CVE-2021-36976: libarchive 3.4.1 through 3.5.1 has a use-after-free in copy_string (called from do_uncompress_block and process_block). Affects libarchive versions < 3.5.3-r0. Fixed in 3.5.3-r0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
libarchive is an open-source library that provides a flexible interface for reading and writing various archive formats. It is commonly used in software applications to handle compressed files. The library allows users to extract files from archives and create new archives. However, a use-after-free vulnerability has been discovered in libarchive versions 3.4.1 through 3.5.1. This vulnerability can be triggered when the library attempts to copy a string, leading to a use of memory after it has been freed.
Vulnerability Detail
The use-after-free vulnerability in libarchive arises from a flaw in the copy_string function, which is called from the do_uncompress_block and process_block functions. An attacker can exploit this vulnerability by crafting a malicious archive file that triggers the use-after-free condition. If successful, the attacker may be able to execute arbitrary code or cause a denial-of-service condition. The severity of this vulnerability is rated as moderate with a CVSS score of 6.5.
How To Fix
Minimum fixed version
3.5.3-r0
This is the first release that contains the fix.
sudo apk add --upgrade libarchive
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is essential to update to the fixed version of libarchive to ensure the security of the system.
Conclusion
The use-after-free vulnerability in libarchive can be exploited by crafting a malicious archive file. To protect systems from potential attacks, it is recommended to update libarchive to version 3.5.3-r0 or later. This update includes a patch that addresses the vulnerability. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for libarchive →
FAQ
libarchive is an open-source library used for reading and writing various archive formats, such as tar, zip, and gzip.
Versions 3.4.1 through 3.5.1 of libarchive are affected by this use-after-free vulnerability.
A use-after-free vulnerability occurs when a program continues to use a memory region after it has been freed, leading to potential memory corruption or code execution.
Exploiting this vulnerability could allow an attacker to execute arbitrary code or cause a denial-of-service condition on systems using the vulnerable versions of libarchive.
To mitigate the risk, it is crucial to update libarchive to version 3.5.3-r0 or later, which includes a fix for the use-after-free vulnerability.
Related vulnerabilities
Recent vulnerabilities recorded for libarchive.