Blender BKE_mesh_calc_normals_tessface Integer Overflow Code Execution Vulnerability
An integer overflow in Blender's mesh normal calculation for older .blend files can cause an undersized heap buffer, leading to a buffer overflow when normals are written. An attacker could convince a user to open a malicious .blend file, potentially achieving code execution.
An exploitable integer overflow exists in the BKEmeshcalcnormalstessface functionality of the Blender open-source 3d creation suite. A specially crafted .blend file can cause an integer overflow resulting in a buffer overflow which can allow for code execution under the context of the application.
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 product of the vertex or face count and the size of a normal vector is computed in 32-bit arithmetic without overflow checking, so a large count wraps to a small value and the subsequent allocation is undersized.
Impact
This could allow code execution under the context of the application, though the user must open a malicious file.
What the attacker needed
Victim opens a malicious .blend file
The fix
The report recommends not using untrusted Blender files; it does not state that a code fix was released.
How it was found
- Create a .blend file with a mesh whose vertex or face count is large enough to overflow the size calculation.
- Open the crafted .blend file in Blender, or pass it as a command-line argument.
- Blender loads the file and calls the version-upgrade routine for old files.
- The routine calls the normal calculation function with the oversized counts.
- The undersized buffer is allocated and then written past its bounds, causing a crash or memory corruption.
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 Blender loads an old file, it calculates how much memory to reserve for storing mesh data. If the numbers in the file are huge, the multiplication used to compute the size can wrap around to a small number, so too little memory is reserved. Later, writing the calculated normals goes past the end of that small buffer, corrupting memory and possibly letting 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.