Remote code execution affecting most iOS/macOS apps
A memory corruption flaw in Apple's ImageIO framework allowed a malformed GIF with negative width and height values to bypass a size check and cause an out-of-bounds access. Processing such an image could lead to arbitrary code execution or, as demonstrated, a persistent crash in many iOS and macOS apps.
blog.flanker017.me
Published on blog.flanker017.me
(For Chinese version of this writeup see https://blog.flanker017.me/cve-2017-2416-gif-rce-chn/)
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a signed multiplication of negative width and height values bypassed a file-size sanity check, leading to an out-of-bounds read in IIOReadPlugin::IIOReadPlugin.
Impact
Processing a maliciously crafted image may lead to arbitrary code execution; in practice, many apps crash and some repeatedly reparse the image, causing a persistent denial of service.
What the attacker needed
Victim receives or opens a malformed image; vulnerable iOS 10 or macOS 10.12
The fix
Apple addressed the memory corruption through improved input validation in iOS 10.3 and macOS 10.12.4.
How it was found
- Craft an image file and change the width and height fields to negative short values whose unsigned form is larger than 0xff00.
- Send or drag the malformed image into any macOS or iOS application that processes images.
- Observe the application crash if it is vulnerable.
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 write-up has not been written yet. The Original tab links to the source.
ImageIO is the part of Apple's operating system that reads image files. A specially crafted GIF could make it read memory outside the intended area, which can crash the app or, in theory, let an attacker run their own code. Many messaging and email apps automatically process images, so simply receiving the file could trigger the problem.
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.