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

libxls xls_addCell Formula Code Execution Vulnerability

A specially crafted XLS file with a formula record can cause an out-of-bounds write in libxls 1.4, leading to memory corruption and potentially remote code execution. An attacker can send a malicious XLS file to trigger this vulnerability.

Marcin 'Icewall' Noga Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable out-of-bounds vulnerability exists in the xlsaddCell function of libxls 1.4. A specially crafted XLS file with a formula record can cause 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

The preparse step does not include the FORMULA record with id 0x0406 when calculating the maximum row and column, so later the column value from that record is used as an array index without bounds checking, causing an out-of-bounds write.

Impact

An attacker could cause memory corruption, potentially leading to remote code execution, by sending a malicious XLS file.

What the attacker needed

Victim opens a malicious XLS file

How it was found

  1. Create an XLS file containing a FORMULA record with id 0x0406 and a column value that exceeds the maximum column found during preparsing.
  2. Open the file with a program that uses libxls, such as xls2csv.
  3. The program crashes with a segmentation fault due to an out-of-bounds write in xls_addCell.

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.

libxls is a library for reading old Excel files. A bug in how it handles a certain type of record lets an attacker write data outside the intended memory area, which can crash the program or let the attacker run their own code. The attacker just needs to trick someone into opening a malicious Excel file.

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.