Artifex MuPDf JBIG2 Parser Code Execution Vulnerability
A specially crafted PDF with a JBIG2 image segment can cause a negative stride value to be passed to memset, leading to a heap buffer overflow. An attacker could potentially execute code by sending the PDF to a victim.
Originally disclosed on Cisco Talos
An exploitable memory corruption vulnerability exists in the JBIG2 parser of Artifex MuPDF 1.9. A specially crafted PDF can cause a negative number to be passed to a memset resulting in memory corruption and potential 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 the stride calculation for a JBIG2 image can produce a negative value when width is zero or negative, and this negative stride is used as the size argument to memset without validation.
Impact
A remote attacker could potentially execute arbitrary code by convincing a victim to open a malicious PDF, though the CVSS vector indicates high attack complexity and user interaction.
What the attacker needed
Victim opens a crafted PDF
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.
A PDF file can contain images compressed with a format called JBIG2. The software that reads these images calculates a size value that can become negative, and then uses that negative size to clear memory, writing outside the intended area. This 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.