3MF Consortium lib3mf NMR::COpcPackageReader::releaseZIP() use-after-free vulnerability
A use-after-free exists in lib3mf's COpcPackageReader::releaseZIP() because zip_close() frees the zip_source_t object that is then passed to zip_source_close(). An attacker can supply a crafted 3MF file to trigger the bug, potentially leading to code execution.
Originally disclosed on Cisco Talos
A use-after-free vulnerability exists in the NMR::COpcPackageReader::releaseZIP() functionality of 3MF Consortium lib3mf 2.0.0. A specially crafted 3MF file can lead to code execution.
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 cleanup function calls zip_close() first, which frees the underlying zip_source_t, and then calls zip_source_close() on the same now-freed pointer.
Impact
A crafted 3MF file could lead to code execution, though the CVSS vector notes high attack complexity.
What the attacker needed
Victim opens a crafted 3MF file; attacker can win a heap race
How it was found
- Call ReadFromBuffer or ReadFromFile with a crafted 3MF file.
- The reader creates a COpcPackageReader and a zip_source_t via zip_source_function_create.
- An exception is raised during package processing, entering the catch block.
- releaseZIP() calls zip_close(), which frees the zip_source_t.
- releaseZIP() then calls zip_source_close() on the freed pointer, causing the use-after-free.
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 3MF file is a kind of zip archive used for 3D printing. The library frees a memory object while cleaning up after an error, then uses that same freed object again, which is a use-after-free. If an attacker can control what lands in that freed memory, they may be able to run their own code.
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.