Skip to content
Memory corruption Advisory Advanced CVE-2023-49600

libigl PlyFile ply_cast_ascii out-of-bounds write vulnerability

A heap buffer overflow exists in libigl's PLY file parsing when a specially crafted ASCII PLY file causes the first pass to compute a zero-length buffer, leading to an out-of-bounds write during the second pass. An attacker could exploit this to corrupt heap memory, potentially leading to code execution or denial of service.

Carl Hurd Follow

Originally disclosed on Cisco Talos

High 8.1 View original

An out-of-bounds write vulnerability exists in the PlyFile plycastascii functionality of libigl v2.5.0. A specially crafted .ply file can lead to a heap buffer overflow.

Carl Hurd, 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 skip function does not check if reading from the stream failed, leaving totalSizeBytes at zero and causing a zero-length buffer allocation that is later overflowed.

Impact

An attacker could cause a heap buffer overflow, potentially leading to code execution or a crash, as demonstrated by the ASAN report.

What the attacker needed

Victim opens a malicious .ply file

How it was found

  1. Craft a PLY file with an edge element containing a non-standard property name.
  2. The parser adds the property to _edge_header and requests it, creating a ParsingHelper.
  3. During the first pass, skip reads the property but fails silently, leaving totalSizeBytes at 0.
  4. A zero-length buffer is allocated based on totalSizeBytes.
  5. During the second pass, read writes the property value into the zero-length buffer, causing a 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.

A PLY file is a 3D model format. The library reads it in two passes: first to measure how much memory is needed, then to fill the data. If the file is malformed so the first pass measures zero bytes, the second pass writes data into a tiny buffer, overflowing it and corrupting memory. This can crash the program or let an attacker 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.

More by Carl Hurd

View all

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