CVE-2021-21900

8.8 HIGH

📋 TL;DR

This CVE describes a use-after-free vulnerability in LibreCAD's libdxfrw library that allows remote code execution. Attackers can exploit it by tricking users into opening malicious .dxf files, potentially compromising systems running vulnerable versions. This affects anyone using LibreCAD or software incorporating the vulnerable libdxfrw library.

💻 Affected Systems

Products:
  • LibreCAD
  • libdxfrw
Versions: libdxfrw 2.2.0-rc2-19-ge02f3580 and earlier
Operating Systems: Linux, Windows, macOS
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using the vulnerable libdxfrw library to process DXF files is affected, not just LibreCAD.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with attacker gaining full control of the affected system, potentially leading to data theft, ransomware deployment, or lateral movement within networks.

🟠

Likely Case

Local privilege escalation or arbitrary code execution in the context of the user opening the malicious file, leading to data compromise and potential persistence.

🟢

If Mitigated

Limited impact if proper file validation and user privilege restrictions are in place, potentially resulting in application crash only.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: HIGH

🎯 Exploit Status

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

Exploitation requires user interaction to open malicious file. The vulnerability is in file parsing code, making reliable exploitation feasible.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: libdxfrw versions after 2.2.0-rc2-19-ge02f3580

Vendor Advisory: https://lists.debian.org/debian-lts-announce/2021/12/msg00002.html

Restart Required: No

Instructions:

1. Update LibreCAD to latest version. 2. For Linux distributions, use package manager: 'sudo apt update && sudo apt upgrade librecad' (Debian/Ubuntu) or 'sudo yum update librecad' (RHEL/CentOS). 3. For Windows/macOS, download latest version from official LibreCAD website.

🔧 Temporary Workarounds

Restrict DXF file processing

all

Block or sandbox processing of untrusted DXF files

User privilege reduction

all

Run LibreCAD with limited user privileges to reduce impact

🧯 If You Can't Patch

  • Implement strict file validation for DXF files before opening
  • Use application whitelisting to prevent unauthorized execution

🔍 How to Verify

Check if Vulnerable:

Check libdxfrw version: 'ldconfig -p | grep libdxfrw' or check LibreCAD version in About dialog

Check Version:

librecad --version or check About in GUI

Verify Fix Applied:

Verify updated version is installed and test with known malicious DXF file in sandbox

📡 Detection & Monitoring

Log Indicators:

  • Application crashes when processing DXF files
  • Unusual process creation from LibreCAD

Network Indicators:

  • Downloads of DXF files from untrusted sources

SIEM Query:

Process creation where parent process contains 'librecad' or 'dxf' and child process is suspicious

🔗 References

📤 Share & Export