Canva Affinity EMF File EMR_CREATEDIBPATTERNBRUSHPT DIBHeaderInfo HeaderSize Out-Of-Bounds Write Vulnerability
The EMF loader in Canva Affinity does not validate the HeaderSize field of a DIB header inside an EMR_CREATEDIBPATTERNBRUSHPT record, so a crafted EMF file causes a heap buffer overflow during a memcpy. An attacker could use this to write out of bounds in the process, potentially leading to code execution.
An out‑of‑bounds write 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 write, potentially leading to 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 HeaderSize field from the DIB header is used as the memcpy length without being checked against the calculated destination buffer size.
Impact
An attacker could write to arbitrary memory within the process, which could potentially lead to code execution; the attack requires the victim to open a crafted file.
What the attacker needed
Victim opens a crafted EMF file; local user interaction
How it was found
- Open a crafted EMF file in Canva Affinity so the EMF loader parses the EMR_CREATEDIBPATTERNBRUSHPT record.
- The loader reads offBmi and adds it to the record pointer to locate the DIB header.
- The DIB header's HeaderSize value is read and used as the copy length.
- A destination buffer is allocated based on the calculated header size, which is smaller than HeaderSize.
- memcpy copies DIBHeaderInfo into that buffer, writing past its end and causing 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 made of records, and one record type describes a pattern brush that includes a small bitmap header. The program works out how big that header should be, but then trusts a size value written inside the file instead of checking it. When it copies the header into a buffer sized by its own calculation, it writes past the end of the buffer, which can crash the app or let an attacker control memory.
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.