Imaging Data Commons libdicom DICOM File Meta Information Parsing Use-After-Free vulnerabilities
A use-after-free vulnerability in libdicom 1.0.5 occurs when parsing DICOM files with duplicate tags in the File Meta Information header or duplicate sequence tags, leading to double-free and potential memory corruption. An attacker could exploit this by inducing the application to process a malicious DICOM image, possibly achieving arbitrary code execution.
Originally disclosed on Cisco Talos
A use-after-free vulnerability exists in the DICOM Element Parsing as implemented in Imaging Data Commons libdicom 1.0.5. A specially crafted DICOM file can cause premature freeing of memory that is used later.
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 function dcm_dataset_insert frees the element when a duplicate tag is found and returns false, causing the caller to free the same element again.
Impact
A crafted DICOM file could cause a crash and potentially allow arbitrary code execution, though the CVSS score indicates high attack complexity.
What the attacker needed
Victim processes a malicious DICOM file
The fix
The vendor has issued a fix on GitHub.
How it was found
- Craft a DICOM file with two elements having the same tag in the File Meta Information header.
- Open the file with a vulnerable application using libdicom.
- The library parses the file and triggers the double-free, leading to a crash or potential code execution.
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.
A use-after-free happens when a program frees memory but then keeps using it, like deleting a file and then trying to open it. Here, the library frees an object twice because of a mistake in error handling, which can crash the program or let an attacker run their own code. The attacker only needs to craft a special image file that the victim opens.
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.