Heap-use-after-free vulnerability in libredwg

libredwg Updated 02 Oct 2025

Summary

21/04/2022
MEDIUM
Yes i
Medium
Not published

OSV-2022-363: Heap-use-after-free in dwg_free_TABLEGEOMETRY_private. Affects libredwg versions >= cb74d5cf5bffc2a9dee8da43105d892f9a728777, < 9e629ba3649464a928b0af75ddd246b3defee128. Fixed in 9e629ba3649464a928b0af75ddd246b3defee128. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

libredwg is an open-source library for reading and writing DWG files, which are the native file format for AutoCAD. It provides functionality for parsing and manipulating DWG files, allowing developers to work with AutoCAD drawings in their applications. However, a vulnerability has been discovered in libredwg that could lead to a heap-use-after-free condition.

Vulnerability Detail

The vulnerability in libredwg is a heap-use-after-free issue, which occurs when a program attempts to access memory that has already been freed. This can result in a crash or potentially allow an attacker to execute arbitrary code. The specific vulnerability is triggered in the dwg_free_TABLEGEOMETRY_private function, which is responsible for freeing memory associated with table geometry in DWG files. By exploiting this vulnerability, an attacker could potentially manipulate the freed memory to execute malicious code or cause a denial-of-service condition.

How To Fix

Minimum fixed version

9e629ba3649464a928b0af75ddd246b3defee128

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, developers can implement additional checks and safeguards in their code to prevent the exploitation of the heap-use-after-free vulnerability. This can include validating input data, implementing proper memory management practices, and using secure coding techniques to minimize the risk of memory-related vulnerabilities. Here's an example of how to check for and handle potential heap-use-after-free conditions:

if (ptr != NULL) {
  // Perform operations on ptr
}

Conclusion

The heap-use-after-free vulnerability in libredwg can have serious security implications, potentially allowing attackers to execute arbitrary code or cause a denial-of-service condition. It is crucial for developers using libredwg to update to a patched version and implement proper memory management practices to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for libredwg →

Share this vulnerability

FAQ

libredwg is an open-source library for reading and writing DWG files, the native file format for AutoCAD. It provides functionality for parsing and manipulating DWG files in applications.

A heap-use-after-free vulnerability occurs when a program attempts to access memory that has already been freed. This can lead to crashes or potential code execution by manipulating the freed memory.

By exploiting the heap-use-after-free vulnerability in libredwg, an attacker could potentially execute arbitrary code or cause a denial-of-service condition.

Yes, the vulnerability has been fixed in commit 9e629ba3649464a928b0af75ddd246b3defee128 on the official GitHub repository of libredwg.

Developers should update their version of libredwg to a patched version that includes the fix. They can do this by pulling the latest changes from the official GitHub repository and rebuilding their application.

Related vulnerabilities

Recent vulnerabilities recorded for libredwg.

How To Fix

Minimum fixed version

9e629ba3649464a928b0af75ddd246b3defee128

This is the first release that contains the fix.

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