Media parsing in canvas is at least vulnerable to Denial of Service through multiple vulnerabilities
Fuzzing of the node-canvas image parsing library found memory-safety bugs in PNG, JPG and GIF handling that crash the Node.js process. An attacker who can get a service to parse a crafted image could take it down, and the crash analyser suggested the flaws might allow code execution.
- Triaged in 11 days
- Fixed in 13 months
- Disclosed after 14 months
There is at least a DoS vulnerability in canvas. It segfaults node.js which leads to a Denial of Service, but according to !exploitable it could possibly be worse
Module
canvas
node-canvas is a Cairo backed Canvas implementation for NodeJS.
https://www.npmjs.com/package/canvas
version: 1.6.9
Stats 2,207 downloads in the last day 42,354 downloads in the last week 194,214 downloads in the last month
~1,587,298 estimated downloads per year (2017)
Description
The vulnerabilities were found with fuzzing with afl. PNG, JPG and GIF parsing are all vulnerable. The vulnerabilities can be exploited if user provided images are passed through the libraries. One example of a package using canvas, is ascci-art which generates ascii from an image.
One of the bugs appear to be a classic buffer overflow (PNG), while for some of the other bugs it appears to try to read memory it should not have access to.
Steps To Reproduce:
Provided with this report is a set of images triggering the vulnerabilities. These can be tested with ascii-art which uses canvas:
ascii-art image /full/path/to/test/image
Supporting Material/References:
- Ubuntu 16.04 64-bit
- nodejs v9.5.0
- npm v5.6.0
Impact
Denial of service - take down a service running on node.js, if that service can be tricked into parsing a user-supplied image Possibly worse if !exploitable is right, and these vulnerabilities can be used to inject shell code.
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 memory-safety errors in the image decoders, including a buffer overflow in PNG parsing and out-of-bounds memory reads in other formats.
Impact
A service that parses user-supplied images could be crashed, and the crash analyser suggests the bugs could possibly be used to inject shell code.
What the attacker needed
Service parses user-supplied images; attacker can supply a crafted image
How it was found
- Obtain the crafted image files that trigger the bugs.
- Run the ascii-art tool, which uses canvas, passing the image path as an argument.
- Observe the Node.js process crash.
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 library called canvas lets a Node.js program read and draw images. When it was fed deliberately malformed image files, it read or wrote memory it should not have, and the whole program crashed. If a website uses this library on pictures uploaded by users, someone could send a bad picture to knock the site offline.
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.