libxls xls_mergedCells Code Execution Vulnerability
An out-of-bounds write in the xls_mergedCells function of libxls 1.4 allows a crafted XLS file to corrupt memory, potentially leading to remote code execution. An attacker can send a malicious XLS file to trigger the vulnerability.
Originally disclosed on Cisco Talos
An exploitable out-of-bounds write vulnerability exists in the xlsmergedCells function of libxls 1.4. A specially crafted XLS file can cause a memory corruption resulting in remote code execution.
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 function uses attacker-controlled values from the file as array indices without validating them against the allocated row and cell counts, leading to out-of-bounds writes.
Impact
A crafted XLS file could cause memory corruption, potentially leading to remote code execution, though the report only demonstrates a crash.
What the attacker needed
Victim opens a malicious XLS file
How it was found
- Craft an XLS file with a MergedCell record containing malicious span values.
- Open the file with a program that uses libxls, such as the readxl package in R.
- The xls_mergedCells function processes the span values and writes out of bounds, causing 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 report describes a bug in a library that reads old Excel files. The library trusts numbers inside the file to decide where to write in memory, so a malicious file can make it write outside the intended area, crashing the program or possibly letting 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.