The Biosig Project libbiosig sopen_FAMOS_read integer underflow to out-of-bounds write vulnerability
An integer underflow in the sopen_FAMOS_read function of libbiosig allows a crafted .famos file to cause an out-of-bounds write on the heap, which can lead to arbitrary code execution.
Originally disclosed on Cisco Talos
An integer underflow vulnerability exists in the sopenFAMOSread functionality of The Biosig Project libbiosig 2.5.0 and Master Branch (ab0ee111). A specially crafted .famos file can lead to an out-of-bounds write which in turn 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
Likely, the code decrements an unsigned counter without checking for zero, causing it to wrap around to a huge value, which then leads to an out-of-bounds index when writing to an array.
Impact
A crafted file could cause a heap out-of-bounds write, potentially leading to arbitrary code execution.
What the attacker needed
Victim opens a malicious .famos file
The fix
The vendor provided a new release that likely fixes the vulnerability.
How it was found
- Create a file starting with the magic bytes '|CF,' to be recognised as a FAMOS file.
- Include a 'CG,1' line to set the number of channels and reallocate the channel buffer.
- Repeat 'CC,1' lines more times than the number of channels to cause the channel counter to underflow.
- Include a 'Cb,1' line with a crafted value to write out-of-bounds to the channel array.
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.
This is a bug in a library that reads medical signal files. A specially made file can trick the program into writing data past the end of a memory buffer, which 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.