The Biosig Project libbiosig MFER unvalidated length stack-based buffer overflow vulnerability
The MFER file parser in libbiosig reads a length field from the file and then copies that many bytes into fixed-size stack buffers without checking the destination size. An attacker can supply a crafted MFER file to overflow the stack and potentially execute arbitrary code.
Originally disclosed on Cisco Talos
A stack-based buffer overflow vulnerability exists in the MFER parsing functionality of The Biosig Project libbiosig 3.9.0 and Master Branch (35a819fa). A specially crafted MFER file can lead to arbitrary code execution.
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 parser reads an attacker-controlled length from the MFER file and passes it to a read into a fixed-size stack buffer without validating that the length fits the buffer.
Impact
An attacker could write arbitrary data past the end of a stack buffer, potentially leading to arbitrary code execution.
What the attacker needed
Victim opens a crafted MFER file
How it was found
- Craft an MFER file whose header matches the MFER magic bytes.
- Encode a data length using multiple octets so the decoded length exceeds the buffer size.
- Set the tag to a value whose handler reads that length into a stack buffer.
- Open the file with libbiosig to trigger the 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 buffer is a small fixed-size area of memory a program uses for temporary data. The program trusts a length value written in the file and copies that many bytes into the small area, so a large length spills over into nearby memory. This can crash the program or let an attacker control what it does next.
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.