Skip to content
Memory corruption Advisory Advanced CVE-2017-12109

libxls xls_preparseWorkSheet MULRK Code Execution Vulnerability

An integer overflow in libxls's handling of MULRK records causes the last column index to be miscalculated, leading to an undersized cell array allocation and an out-of-bounds write. An attacker could exploit this to achieve remote code execution by sending a malicious XLS file.

Marcin 'Icewall' Noga Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable integer overflow vulnerability exists in the xlspreparseWorkSheet function of libxls 1.4 when handling a MULRK record. A specially crafted XLS file can cause a memory corruption resulting in remote code execution.

Marcin 'Icewall' Noga, 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

Likely an integer overflow in the calculation of the last column index from the MULRK record's column field and size, leading to an undersized allocation and subsequent out-of-bounds write.

Impact

An attacker could cause memory corruption leading to remote code execution.

What the attacker needed

Victim opens a malicious XLS file

How it was found

  1. Craft an XLS file containing a malformed MULRK record with a large column value.
  2. Open the file with a vulnerable application using libxls.
  3. The integer overflow causes lastcol to be set to a small value.
  4. The cell array is allocated with the small size.
  5. When processing the MULRK record, an out-of-bounds write occurs.

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.

When a program reads an Excel file, it calculates how many columns are in a row. If the file is crafted to have a very large column number, the calculation can wrap around to a small number, so the program allocates too little memory. Later, when it tries to store data for that column, it writes past the end of the allocated 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 Marcin 'Icewall' Noga

View all

146 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.