CVE-2021-3520

9.8 CRITICAL

📋 TL;DR

CVE-2021-3520 is an integer overflow vulnerability in the LZ4 compression library that allows attackers to trigger out-of-bounds writes by submitting crafted files. This can lead to application crashes (availability impact) or potentially arbitrary code execution (confidentiality/integrity impact). Any application or system using vulnerable versions of LZ4 is affected.

💻 Affected Systems

Products:
  • LZ4 library
  • Applications using LZ4 compression
  • Red Hat Enterprise Linux
  • Oracle products
  • NetApp products
Versions: LZ4 versions before 1.9.3
Operating Systems: Linux distributions, Various Unix-like systems
Default Config Vulnerable: ⚠️ Yes
Notes: Any application that processes untrusted LZ4-compressed files is vulnerable. The vulnerability is in the library itself, not specific applications.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Application crashes causing denial of service, with potential for limited memory corruption.

🟢

If Mitigated

Application crashes with no data compromise if proper sandboxing and memory protections are in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires submitting a crafted LZ4 file to a vulnerable application. No authentication is needed if the application accepts external files.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: LZ4 1.9.3 and later

Vendor Advisory: https://bugzilla.redhat.com/show_bug.cgi?id=1954559

Restart Required: Yes

Instructions:

1. Update LZ4 library to version 1.9.3 or later. 2. Rebuild any statically linked applications. 3. Restart affected services. 4. For OS packages, use your distribution's package manager (yum update lz4, apt upgrade liblz4).

🔧 Temporary Workarounds

Input validation

all

Implement strict validation of LZ4 file inputs before processing

Memory protection

linux

Enable ASLR and other memory protection mechanisms

sysctl -w kernel.randomize_va_space=2

🧯 If You Can't Patch

  • Isolate vulnerable systems from untrusted networks
  • Implement strict file upload controls and scanning for LZ4 files

🔍 How to Verify

Check if Vulnerable:

Check LZ4 library version: lz4 --version or check package version (rpm -q lz4, dpkg -l liblz4)

Check Version:

lz4 --version 2>/dev/null | head -1 || rpm -q lz4 || dpkg -l liblz4* | grep ^ii

Verify Fix Applied:

Confirm LZ4 version is 1.9.3 or higher and test with known malicious LZ4 files

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Memory corruption errors in application logs
  • Unexpected process termination

Network Indicators:

  • Unusual LZ4 file uploads to applications
  • Traffic patterns indicating file upload exploitation

SIEM Query:

source="application.logs" AND ("segmentation fault" OR "SIGSEGV" OR "out of bounds")

🔗 References

📤 Share & Export