Leadtools fltSaveCMP integer overflow vulnerability
An integer overflow in the fltSaveCMP function of Leadtools 22 occurs when saving a specially crafted BMP file, leading to a buffer overflow. An attacker could exploit this to cause memory corruption, potentially leading to code execution.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the fltSaveCMP functionality of Leadtools 22. A specially-crafted BMP file can lead to an integer overflow, that in turn causes a buffer overflow.
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 a 32-bit integer overflow in the multiplication (uVar2 + 1) * BytesPerLine used to compute the allocation size, where BytesPerLine is derived from the width field of the BMP file.
Impact
An attacker could cause memory corruption, potentially leading to code execution, as indicated by the CVSS score of 8.8.
What the attacker needed
Victim opens a malicious BMP file; application uses Leadtools 22
The fix
The fix is included in updated versions of the affected components.
How it was found
- Craft a BMP file with a large width value.
- Load the BMP file using Leadtools.
- Save the loaded bitmap using L_SaveBitmap, which triggers fltSaveCMP.
- The integer overflow causes an undersized allocation, leading to a buffer overflow and 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.
When a program calculates how much memory to reserve, it multiplies two numbers. If the result is too large for the variable holding it, the number wraps around to a small value, so the program reserves too little memory. Later, when it copies data into that buffer, it writes past the end, corrupting memory and crashing.
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.