Heap-Based Buffer Overflow in libarchive: CVE-2016-4302 Vulnerability Overview

libarchive Updated 02 Oct 2025

Summary

21/09/2016
N/A
Yes i
High
7.8

ALPINE-CVE-2016-4302: Heap-based buffer overflow in the parse_codes function in archive_read_support_format_rar.c in libarchive before 3.2.1 allows remote attackers to execute arbitrary code via a RAR file with a zero-sized dictionary. Affects libarchive versions < 3.2.1-r0. Fixed in 3.2.1-r0. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

libarchive is a widely used library that provides a flexible and efficient way to read and write various archive formats, including ZIP, TAR, and RAR. It is designed to support a wide range of file formats and offers features such as streaming and random access. However, a vulnerability was discovered in libarchive versions prior to 3.2.1, specifically in the parse_codes function within the archive_read_support_format_rar.c file, which could lead to severe security risks.

Vulnerability Detail

The vulnerability, identified as CVE-2016-4302, is a heap-based buffer overflow that occurs when processing a RAR file containing a zero-sized dictionary. This flaw allows remote attackers to exploit the vulnerability by crafting a malicious RAR file, potentially leading to arbitrary code execution on the affected system. The implications of this vulnerability are significant, as it could allow an attacker to gain unauthorized access, manipulate data, or disrupt services.

How To Fix

Minimum fixed version

3.2.1-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

As a temporary workaround, avoid processing untrusted RAR files until the libarchive package is updated. Implement strict validation checks on the files being processed to minimize exposure to potential attacks.

Conclusion

The CVE-2016-4302 vulnerability in libarchive poses a significant risk due to its potential for arbitrary code execution. It is crucial to update to the patched version to ensure the security of your systems. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for libarchive →

Share this vulnerability

FAQ

CVE-2016-4302 is a vulnerability in libarchive that allows for heap-based buffer overflow, potentially leading to arbitrary code execution.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which analyzes your manifest file for vulnerabilities.

Exploitation of this vulnerability can lead to unauthorized access, data manipulation, and service disruption.

Yes, the patch is available in libarchive version 3.2.1-r0 and later. Updating to this version will resolve the issue.

If immediate updating is not possible, avoid processing untrusted RAR files and implement validation checks on files being processed.

Related vulnerabilities

Recent vulnerabilities recorded for libarchive.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

3.2.1-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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback