Canva Affinity EMF File EMR_STRETCHBLT cbBitsSrc Out-Of-Bounds Read Vulnerability
The EMF loader in Canva Affinity computes the size of the remaining bitmap data from attacker-controlled offset and size fields without checking the result against the record size. A crafted EMF file can therefore make the application copy more bytes than the record holds, causing an out-of-bounds read that may disclose sensitive memory.
An out-of-bounds read vulnerability exists in the EMF functionality of Canva Affinity. By using a specially crafted EMF file, an attacker could exploit this vulnerability to perform an out-of-bounds read, potentially leading to the disclosure of sensitive information.
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 loader calculates the remaining bitmap size as offBitsSrc + cbBitsSrc - offBmiSrc - headerSize and passes it to a copy routine without verifying it fits within the record.
Impact
An attacker could cause an out-of-bounds read that may disclose sensitive information, and the crash shows the copy running past the buffer; exploitation requires the victim to open a crafted file.
What the attacker needed
Victim opens a crafted EMF file; local access to the application
How it was found
- Open a crafted EMF file in Canva Affinity.
- The loader reads the EMR_STRETCHBLT record and its offset and size fields.
- It computes the remaining bitmap size from those fields without a bounds check.
- It calls the bitmap creation routine with that oversized length.
- A memcpy copies past the end of the record, triggering an out-of-bounds read and an access violation.
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 EMF file is a picture format that stores drawing instructions, and each instruction is a record with fields saying where its data sits and how big it is. The program worked out how much bitmap data to copy using those numbers but never checked that the answer stayed inside the record, so it read past the end of the buffer. Reading past a buffer can pull unrelated memory into the image or crash the program.
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.