The Biosig Project libbiosig Nicolet WFT parsing heap-based buffer overflow vulnerability
A heap-based buffer overflow exists in libbiosig's parsing of Nicolet WFT files because a header field is copied with strcpy into a fixed-size buffer without checking its length. An attacker can supply a crafted .wft file to overflow the heap and potentially achieve arbitrary code execution.
Originally disclosed on Cisco Talos
A heap-based buffer overflow vulnerability exists in the Nicolet WFT parsing functionality of The Biosig Project libbiosig 3.9.2 and Master Branch (db9a9a63). A specially crafted .wft 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 code uses strcpy to copy an attacker-controlled string into a fixed-size buffer at an offset, without checking the source length against the remaining space.
Impact
The overflow can corrupt heap metadata and, depending on heap layout, potentially lead to arbitrary code execution; however, when _FORTIFY_SOURCE is enabled it detects the overflow and terminates the program, reducing impact to denial of service.
What the attacker needed
Victim opens a crafted .wft file; libbiosig built without _FORTIFY_SOURCE
The fix
The report suggests replacing strcpy with strncpy limited to the destination buffer size, or better, enforcing fixed field offsets and sizes as per the WFT specification; a patch was released according to the timeline.
How it was found
- Craft a file whose first eight bytes match the Nicolet WFT magic sequence.
- Place a long string in the Nicolet_Digitizer_Type field so that the next null byte is more than 120 bytes away.
- Open the file with libbiosig, which triggers the vulnerable strcpy and overflows the heap 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.
A buffer overflow happens when a program copies more data into a fixed-size memory area than it can hold, so the extra data spills into neighbouring memory. Here, a file header field is copied without checking its length, letting an attacker control what gets written past the buffer. This can crash the program or, in some cases, 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.