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.
Originally disclosed on Cisco Talos
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.
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
- Craft an XLS file containing a malformed MULRK record with a large column value.
- Open the file with a vulnerable application using libxls.
- The integer overflow causes lastcol to be set to a small value.
- The cell array is allocated with the small size.
- 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.