The Biosig Project libbiosig BrainVision Header Parsing double-free vulnerability
A double-free vulnerability exists in the BrainVision header parsing of libbiosig when a crafted .vhdr file contains multiple [Channel Infos] tags, causing the same buffer to be freed repeatedly. An attacker could exploit this to achieve arbitrary code execution.
Originally disclosed on Cisco Talos
A double-free vulnerability exists in the BrainVision Header Parsing functionality of The Biosig Project libbiosig Master Branch (ab0ee111) and 2.5.0. A specially crafted .vdhr 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 frees a temporary filename buffer each time it encounters a [Channel Infos] tag, but the buffer is only allocated once, so multiple tags cause repeated frees of the same address.
Impact
An attacker could achieve arbitrary code execution by providing a malicious file.
What the attacker needed
Victim opens a malicious .vhdr file
The fix
The vendor provided a new release that likely fixes the issue.
How it was found
- Craft a file that starts with the BrainVision magic number to be recognised as a .vhdr file.
- Include multiple [Channel Infos] tags in the file.
- Open the file with libbiosig, which triggers the parsing and frees the same buffer repeatedly.
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 double-free happens when a program tries to free the same piece of memory twice. This can corrupt the memory and let an attacker run their own code. Here, a specially crafted file causes the program to free the same memory many times.
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.