Heap-buffer-overflow in libdwarf: _dwarf_memcpy_noswap_bytes

libdwarf Updated 02 Oct 2025

Summary

07/10/2023
MEDIUM
Yes i
Medium
Not published

OSV-2023-977: Heap-buffer-overflow in _dwarf_memcpy_noswap_bytes. Affects libdwarf versions >= e612fb75b2b75ff78f550aea7c659799432f5bb4, < 3a658bd1dd7437948cecbf82bb9b24f5f6122a7d. Fixed in 3a658bd1dd7437948cecbf82bb9b24f5f6122a7d. 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

libdwarf is an open-source library that provides access to DWARF debugging information in object files. It is commonly used in software development tools and debuggers. The library allows developers to extract and analyze debugging information, such as variable names, types, and source code locations, from compiled binaries. However, a vulnerability has been discovered in libdwarf that could lead to a heap-buffer-overflow.

Vulnerability Detail

The vulnerability in libdwarf, specifically in the function _dwarf_memcpy_noswap_bytes, allows for a heap-buffer-overflow read of 8 bytes. This can result in a crash or potentially be exploited by an attacker to execute arbitrary code. The issue was reported through the OSS-Fuzz project and has been assigned a medium severity level. The crash state indicates that the overflow occurs in the function fill_in_uni_arch_64, which is called by _dwarf_macho_setup.

How To Fix

Minimum fixed version

3a658bd1dd7437948cecbf82bb9b24f5f6122a7d

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 temporary workaround, developers can implement input validation and bounds checking in their own code to prevent the heap-buffer-overflow from occurring. By ensuring that the input data is within the expected boundaries, the vulnerability can be mitigated. Here is an example of how to perform bounds checking in C:

void process_data(const char* data, size_t length) {
  if (length > MAX_LENGTH) {
    // Handle error or truncate data
  }
  // Process the data
}

Conclusion

In conclusion, a heap-buffer-overflow vulnerability has been discovered in libdwarf, which could potentially lead to a crash or arbitrary code execution. It is crucial for developers to update their dependencies or rebuild their software using the patched version of libdwarf to mitigate this vulnerability. If you need further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for libdwarf →

Share this vulnerability

FAQ

libdwarf is an open-source library that provides access to DWARF debugging information in object files. It is commonly used in software development tools and debuggers.

A heap-buffer-overflow is a type of memory corruption vulnerability where data is written or read outside the bounds of a heap-allocated buffer. In this case, the overflow occurs in the _dwarf_memcpy_noswap_bytes function of libdwarf.

If successfully exploited, this vulnerability could allow an attacker to execute arbitrary code or cause a denial-of-service by crashing the application that uses libdwarf.

Yes, the vulnerability has been fixed in the libdwarf library. Developers are advised to update their dependencies or rebuild their software using the patched version of libdwarf.

You can find more information about this vulnerability in the OSS-Fuzz report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63024

Related vulnerabilities

Recent vulnerabilities recorded for libdwarf.

How To Fix

Minimum fixed version

3a658bd1dd7437948cecbf82bb9b24f5f6122a7d

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