Skip to content
Memory corruption Advisory Advanced CVE-2024-22373

Grassroot DICOM JPEG2000Codec::DecodeByStreamsCommon out-of-bounds write vulnerability

A heap buffer overflow exists in the JPEG2000Codec::DecodeByStreamsCommon function of Grassroot DICOM 3.0.23 because the buffer size is calculated from DICOM header dimensions but the loop writes based on dimensions from the JPEG2000 decoder, which can be larger. An attacker can provide a malicious DICOM file to trigger the overflow, leading to memory corruption.

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

High 8.1 View original

An out-of-bounds write vulnerability exists in the JPEG2000Codec::DecodeByStreamsCommon functionality of Mathieu Malaterre Grassroot DICOM 3.0.23. A specially crafted DICOM file can lead to a heap buffer overflow.

Emmanuel Tacheau, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the buffer allocation size is derived from DICOM header dimensions while the write loop uses dimensions from the JPEG2000 decoder, and there is no bounds check to ensure the write stays within the allocated buffer.

Impact

An attacker could cause a heap-based buffer overflow, leading to memory corruption, which may result in a crash or potentially arbitrary code execution.

What the attacker needed

Malicious DICOM file; victim opens file with vulnerable software

The fix

The vendor has fixed the code on their sourceforge site.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This report describes a memory safety bug in a library that reads medical image files. When the library processes a specially crafted file, it writes more data into a memory buffer than was allocated, which can crash the program or allow an attacker to corrupt memory. The root cause is that the buffer size is based on one set of dimensions from the file header, but the amount of data written is based on different dimensions from the compressed image data, and these are not checked to match.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Emmanuel Tacheau

View all

58 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.