Skip to content
Memory corruption Advisory Advanced CVE-2022-43467

Open Babel PQS format coord_file out-of-bounds write vulnerability

A stack buffer overflow in Open Babel's PQS format parser allows an attacker to write beyond a fixed-size buffer by supplying a crafted file with a long 'file=' value and a long title. This can lead to arbitrary code execution.

Claudio Bozzato Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

An out-of-bounds write vulnerability exists in the PQS format coordfile functionality of Open Babel 3.1.1 and master commit 530dbfa3. A specially crafted malformed file can lead to arbitrary code execution.

Claudio Bozzato, on Cisco Talos

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 strcat to append coord_file to full_coord_path without ensuring the destination buffer is large enough, and both buffers can be filled to their maximum size beforehand.

Impact

A remote attacker could execute arbitrary code by providing a malicious file, though the text notes that exploitability depends on compilation and stack layout.

What the attacker needed

Victim opens a malicious PQS file

How it was found

  1. Create a PQS file with a line containing 'geom' and 'file=' followed by a long string.
  2. Ensure the input filename (title) is also long enough to fill full_coord_path.
  3. Run obabel with the crafted file as input and any output format, e.g., 'obabel -i pqs crafted.pqs -o sdf'.
  4. The program crashes due to stack buffer overflow.

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. When it reads a PQS file, it copies a filename from the file into a fixed-size memory box without checking if it fits. If the filename is too long, it spills over into other memory, 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.

More by Claudio Bozzato

View all

185 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.