CVE-2021-3575

7.8 HIGH

📋 TL;DR

This vulnerability allows remote code execution via a heap-based buffer overflow in openjpeg when processing malicious JPEG 2000 (.j2k) files. Attackers can exploit this to execute arbitrary code with the permissions of the application using openjpeg. Any system or application that uses vulnerable versions of openjpeg to process JPEG 2000 images is affected.

💻 Affected Systems

Products:
  • openjpeg
  • libopenjp2
  • applications using openjpeg library
Versions: openjpeg versions before 2.4.0
Operating Systems: Linux, Windows, macOS, BSD
Default Config Vulnerable: ⚠️ Yes
Notes: Any application compiled against vulnerable openjpeg versions that processes JPEG 2000 files is affected. Common in image processing tools, document viewers, and web applications.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with attacker gaining the same privileges as the vulnerable application, potentially leading to data theft, ransomware deployment, or persistent backdoor installation.

🟠

Likely Case

Application crash (denial of service) or limited code execution within the application's context, potentially allowing lateral movement in enterprise environments.

🟢

If Mitigated

Application crash with no code execution if proper memory protections (ASLR, DEP) are enabled and effective.

🌐 Internet-Facing: MEDIUM - Exploitation requires uploading or processing malicious .j2k files, which is common in web applications handling image uploads.
🏢 Internal Only: LOW - Requires user interaction to open malicious files or automated processing of untrusted .j2k files.

🎯 Exploit Status

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

Exploitation requires crafting a malicious .j2k file and getting it processed by vulnerable software. Public proof-of-concept exists in GitHub issues.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: openjpeg 2.4.0 and later

Vendor Advisory: https://github.com/uclouvain/openjpeg/issues/1347

Restart Required: Yes

Instructions:

1. Update openjpeg to version 2.4.0 or later using your package manager. 2. For Linux: 'sudo apt update && sudo apt upgrade libopenjp2-7' (Debian/Ubuntu) or 'sudo yum update openjpeg2' (RHEL/CentOS). 3. Recompile any applications using openjpeg with the updated library. 4. Restart affected services or applications.

🔧 Temporary Workarounds

Disable JPEG 2000 processing

all

Configure applications to reject or not process .j2k/.jp2 files

Use application sandboxing

linux

Run vulnerable applications in containers or with reduced privileges

docker run --security-opt no-new-privileges -v /path:/path image_name

🧯 If You Can't Patch

  • Implement strict file upload filtering to block .j2k/.jp2 files at network perimeter
  • Deploy application control to prevent execution of vulnerable openjpeg binaries

🔍 How to Verify

Check if Vulnerable:

Check openjpeg version: 'opj_decompress -v' or 'dpkg -l | grep openjpeg' or 'rpm -qa | grep openjpeg'. If version is below 2.4.0, system is vulnerable.

Check Version:

opj_decompress -v 2>&1 | head -1

Verify Fix Applied:

Confirm openjpeg version is 2.4.0 or later using version check commands. Test with known malicious .j2k file in controlled environment.

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults when processing image files
  • Unexpected child process spawning from image processing applications

Network Indicators:

  • Unusual outbound connections from image processing services
  • Upload of .j2k/.jp2 files to web applications

SIEM Query:

source="application.logs" AND ("segmentation fault" OR "SIGSEGV") AND process="*openjpeg*" OR file_extension=".j2k" OR file_extension=".jp2"

🔗 References

📤 Share & Export