Skip to content
Memory corruption Advisory Advanced CVE-2022-38072

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.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

Medium 6.5 View original

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.

Francesco Benvenuto, 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

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

  1. Open a crafted STL file with ADMesh so that the repair routine runs.
  2. The repair routine allocates the fixed-facet tracking array based on the facet count.
  3. A neighbour value in the file exceeds the array capacity and is used as an index.
  4. 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.

More by Francesco Benvenuto

View all

152 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.