The Biosig Project libbiosig ABF parsing out-of-bounds read vulnerability
The ABF file parser in libbiosig uses an attacker-controlled signed 16-bit value from the file as an index into a fixed-size channel-name array without checking it against the array bounds. A crafted .abf file can therefore make the parser read memory far outside the allocated header buffer, leaking data or crashing the process.
Originally disclosed on Cisco Talos
An out-of-bounds read vulnerability exists in the ABF parsing functionality of The Biosig Project libbiosig 3.9.2 and Master Branch (5462afb0). A specially crafted .abf file can lead to an information leak.
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 value read from the file's nADCSamplingSeq array is used directly as an index into the fixed-size sADCChannelName array without any bounds check.
Impact
A crafted file could cause an information leak by copying out-of-bounds memory into the channel label, and in the demonstrated case it crashed the process with a segmentation fault.
What the attacker needed
Victim opens a crafted .abf file; libbiosig used to parse the file
The fix
The parser should validate that the index read from the file is within the bounds of the channel-name array before using it, and the text notes a vendor patch was released.
How it was found
- Craft an ABF file whose header begins with the ABF magic bytes so it is detected as the original ABF format.
- Place a large positive value in the nADCSamplingSeq entry for a channel so the computed index exceeds the array size.
- Open the file with libbiosig so sopen_extended calls sopen_abf_read.
- Observe the strncpy call reading from an address beyond the allocated header buffer, causing a segfault.
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 program that opens a file must trust nothing inside it. Here the file supplies a number that is meant to pick one of sixteen channel names, but the program never checks the number is small enough, so it reads from a memory address far past the end of the data it loaded. That can crash the program or copy unrelated memory into the channel label.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.