Skip to content
Memory corruption Advisory Intermediate CVE-2022-41793

Open Babel CSR format title out-of-bounds write vulnerability

A heap buffer overflow exists in Open Babel's CSR format when writing a molecule title longer than 80 characters, because PadString copies the title using strncpy with the input length instead of the destination size. An attacker could supply a malicious file to trigger the overflow and potentially achieve 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 CSR format title 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 PadString function uses strncpy with the length of the input string instead of the destination buffer size, causing a heap buffer overflow when the input exceeds the allocated size.

Impact

A heap buffer overflow could lead to arbitrary code execution.

What the attacker needed

Victim opens a malicious file with Open Babel

How it was found

  1. Create a Cacao Cartesian format file with a title longer than 80 characters.
  2. Ensure the file specifies at least one atom so that WriteMolecule is called.
  3. Run obabel with the crafted file as input and CSR as output format.
  4. The overflow occurs when PadString copies the long title into a fixed-size buffer.

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 writes a file in the CSR format, it copies the molecule's title into a fixed-size buffer without checking if the title is too long. If the title is longer than the buffer, it overwrites memory beyond the 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.

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.