Skip to content
Memory corruption Advisory Advanced CVE-2025-52581

The Biosig Project libbiosig GDF parsing integer overflow to heap-based buffer overflow vulnerability

An integer overflow in libbiosig's GDF file parsing leads to a heap-based buffer overflow, allowing an attacker to write arbitrary data past the end of a heap buffer. This could potentially lead to arbitrary code execution.

Mark Bereza Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

An integer overflow vulnerability exists in the GDF parsing functionality of The Biosig Project libbiosig 3.9.0 and Master Branch (35a819fa). A specially crafted GDF file can lead to arbitrary code execution.

Mark Bereza and Lilith >_>, 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 an integer overflow in the calculation of the buffer size for event data, where attacker-controlled values for the number of events and event size are multiplied and added to 8, resulting in a small allocation size due to 32-bit truncation.

Impact

An attacker can write arbitrary data past the end of a heap-allocated buffer, which could potentially lead to arbitrary code execution depending on the heap setup.

What the attacker needed

Victim opens a malicious GDF file

The fix

The vulnerability was fixed by the vendor in a patch release.

How it was found

  1. Craft a GDF file with a header that passes the GDF magic check and sets a large event count and event size.
  2. The file is parsed by sopen_extended, which calls read_header for GDF files.
  3. In read_header, the event count and size are read from the file and used to compute the realloc size, which overflows.
  4. The realloc allocates a small buffer, and then ifread writes the event data past the end of the buffer.

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.

When a program reads a file, it often calculates how much memory to allocate based on numbers in the file. If those numbers are very large, the calculation can wrap around to a small number, so the program allocates too little memory. Then, when it copies data from the file into that memory, it writes past the end, corrupting other memory and potentially allowing an attacker 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.

More by Mark Bereza

View all

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