Leadtools Image Parser Animated Icon Code Execution Vulnerability
The ANI image parser in Leadtools 20 allocates a heap buffer sized from the RATE header's display rate, then fills it with a byte count derived from the ANIH header's width field. A crafted ANI file with a small rate and large width overflows the heap buffer, which the report says could potentially lead to code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the ANI file format parser of Leadtools 20. A specially crafted ANI file can cause a buffer overflow 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 buffer size comes from the RATE header's display rate while the copy length comes from the ANIH header's width, with no check that the copy fits the allocation.
Impact
A malicious ANI file could overwrite heap memory and potentially achieve code execution, though the report only says this could potentially happen rather than demonstrating it.
What the attacker needed
Victim opens a crafted ANI file; an application using the Leadtools parser
The fix
The parser should validate that the number of bytes read into the buffer does not exceed the allocated size, and the vendor patched the issue.
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.
An ANI file is a Windows animated cursor, and it stores its settings in small labelled blocks called headers. The parser trusted one header to decide how big a memory box to reserve, but used a different header to decide how much data to copy in, so a mismatched file writes past the end of the box. Writing past reserved memory can corrupt other data and, in the worst case, 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.