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

libxls read_MSAT Code Execution Vulnerability

An out-of-bounds write in libxls's read_MSAT function allows a crafted XLS file to corrupt heap memory, potentially leading to arbitrary 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 write vulnerability exists in the readMSAT function of libxls 1.4. 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

The read_MSAT function allocates a buffer based on the cfat value from the file but then writes more sectors into it than the buffer can hold, without checking bounds.

Impact

This could lead to arbitrary code execution.

What the attacker needed

Victim opens a malicious XLS file

How it was found

  1. Craft an XLS file with a small cfat value (e.g., 0x1) and a large number of MSAT sectors.
  2. Open the file with a program using libxls (e.g., readxl in R or xls2csv).
  3. The read_MSAT function reads sectors and writes them beyond the allocated SecID buffer, causing heap corruption and 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.

This is a memory corruption bug in a library that reads Excel files. When the library processes a specially crafted file, it writes data past the end of a 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 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.