Skip to content
Memory corruption Advisory Intermediate CVE-2024-24686CVE-2024-24685CVE-2024-24684

libigl readOFF stack-based buffer overflow vulnerability

Multiple stack-based buffer overflows exist in libigl's readOFF function because it uses fscanf to read strings into fixed-size 1000-byte buffers without bounds checking. An attacker can provide a malicious .off file to trigger a stack buffer overflow, potentially leading to code execution.

Philippe Laulheret Follow

Originally disclosed on Cisco Talos

High 7.8 View original

Multiple stack-based buffer overflow vulnerabilities exist in the readOFF functionality of libigl v2.5.0. A specially crafted .off file can lead to stack-based buffer overflow.

Philippe Laulheret, 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 code uses fscanf with %s or %[^\n] to read unbounded input into fixed-size stack buffers of 1000 bytes, without limiting the number of characters read.

Impact

A crafted .off file could cause a stack-based buffer overflow, potentially leading to code execution or a crash.

What the attacker needed

Victim opens a malicious .off file

How it was found

  1. Create a .off file with a header line longer than 1000 bytes.
  2. Open the file with libigl's readOFF function.
  3. The fscanf call reads the long header into the 1000-byte header buffer, causing a stack 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 stack-based buffer overflow happens when a program writes more data into a fixed-size memory area than it can hold, overwriting nearby data. In this case, libigl reads text from a .off file into small buffers without checking length, so a very long line can corrupt memory. An attacker could use this to crash the program or possibly 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 Philippe Laulheret

View all

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