Open Babel PQS format pFormat uninitialized pointer dereference vulnerability
An uninitialized pointer in Open Babel's PQS format parser can be dereferenced when a crafted file references an external geometry file without a recognised format keyword. An attacker could potentially execute arbitrary code by controlling the pointer value.
Originally disclosed on Cisco Talos
A use of uninitialized pointer vulnerability exists in the PQS format pFormat functionality of Open Babel 3.1.1 and master commit 530dbfa3. A specially crafted malformed 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
Likely the pointer variable pFormat is declared without initialisation and only assigned inside conditional branches that may not be taken, leading to a dereference of an uninitialised pointer.
Impact
An attacker could potentially execute arbitrary code, depending on compilation and stack layout, as the uninitialised pointer is stored on the stack and may be controllable.
What the attacker needed
Victim opens a crafted PQS file; referenced file must be readable
How it was found
- Create a PQS file containing a line with 'geom' and 'file=' pointing to an existing file, without any of the recognised format keywords.
- Run obabel with the PQS input format and any output format, e.g. obabel -i pqs crafted.pqs -o sdf.
- The program attempts to open the referenced file and then dereferences the uninitialised pFormat pointer, causing a crash.
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.
Open Babel is a tool that converts chemical file formats. A bug in its PQS parser means that if a file points to an external geometry file but does not specify a known format, the program uses a pointer that was never set, which can crash 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.