ADMesh stl_fix_normal_directions improper array index validation vulnerability
The stl_fix_normal_directions function in ADMesh allocates a tracking array sized to the facet count, then indexes it with a neighbour facet value taken from the file without any bounds check. A crafted STL file can therefore cause an out-of-bounds read and write on the heap, leading to a heap buffer overflow and a crash.
Originally disclosed on Cisco Talos
An improper array index validation vulnerability exists in the stlfixnormaldirections functionality of ADMesh Master Commit 767a105 and v0.98.4. A specially-crafted stl file can lead to a heap buffer overflow.
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
The neighbour facet index read from the STL file is used to index the norm_sw array without validating it against the allocated facet count.
Impact
A malicious STL file could cause a heap buffer overflow, resulting in a crash and possible memory corruption; the CVSS score reflects low confidentiality and low integrity/availability impact.
What the attacker needed
Attacker supplies a crafted STL file; victim processes the file with ADMesh
The fix
The vendor released a patch, which should add a bounds check on the neighbour index before using it to access the tracking array.
How it was found
- Open a crafted STL file with ADMesh so that the repair routine runs.
- The repair routine allocates the fixed-facet tracking array based on the facet count.
- A neighbour value in the file exceeds the array capacity and is used as an index.
- The out-of-bounds position is read and later written, triggering the heap overflow.
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.
ADMesh is a library that reads 3D model files (STL) and repairs them. It keeps a small checklist of which triangles it has already fixed, but it trusts a number stored in the file to decide where in that checklist to look, so a rigged file makes it read and write past the end of the checklist. That memory corruption can crash the program and, in principle, be abused further.
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.