[cairo-bugs] [Bug 98165] New: DoS attack based on using SVG to generate invalid pointers from a _cairo_image_surface in write_png

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Oct 8 17:16:15 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=98165

            Bug ID: 98165
           Summary: DoS attack based on using SVG to generate invalid
                    pointers from a _cairo_image_surface in write_png
           Product: cairo
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: All
            Status: NEW
          Severity: critical
          Priority: medium
         Component: svg backend
          Assignee: emmanuel.pacaud at lapp.in2p3.fr
          Reporter: jbowler at acm.org
        QA Contact: cairo-bugs at cairographics.org

This is in cairo-1.14.6

This has already been reported on oss-security, although there is no analysis
there and as yet there is no CVE:

http://www.openwall.com/lists/oss-security/2016/10/06/1

The repro uses:

rsvg-convert -o crash.png crash.svg

The crash happens because write_png passes invalid (off by 4GByte) pointers to
libpng.  The bug is in the declaration of _cairo_image_surface which obviously
won't work on a machine with a 64-bit address space and 32-bit (int) values.

The crash is 'just' a read from the invalid pointer inside libpng, however
there is at least one other case of the loop in read_png where the crash would
be a memory overwrite with data from the PNG; that version has been semi-fixed.

I'm not posting a detailed analysis because I'm not sure how many places the
bug is exposed and it is pretty clear given the fact that the loop in read_png
is different that you already know about one instance of this bug.

The libpng maintainer has a copy of my complete analysis and the original SVG,
I suggest not posting it at the moment because it took me about 4 minutes to
find the problem given the SVG.

I also suspect it isn't specific to SVG; I assume the read_png change came from
test jockeys hitting Cairo with various obvious PNG files, they tend to not
test SVG anywhere near as much.

The fix is to change 'stride' in the surface to (size_t), and preferably
width/height to (uint32_t) and depth to (unsigned).  Doing that will reveal all
cases of the bug given a sufficiently high warning level.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20161008/e03bbe07/attachment.html>


More information about the cairo-bugs mailing list