Bug 991938 (CVE-2016-6525) - VUL-0: CVE-2016-6525: Heap overflow vulns in MuPDF
Summary: VUL-0: CVE-2016-6525: Heap overflow vulns in MuPDF
Status: RESOLVED FIXED
Alias: CVE-2016-6525
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other openSUSE 42.2
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Forgotten User cAXlJ_FoSf
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/171603/
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-03 13:46 UTC by Sebastian Krahmer
Modified: 2017-07-11 11:36 UTC (History)
3 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Krahmer 2016-08-03 13:46:18 UTC
Quoting from OSS-sec:

Title: Heap overflow vulns in MuPDF
Author: Yu Hong, yu.hong () chaitin com;Zheng Jihong,jihong.zheng () chaitin com
Data: 2016-08-01
Dowload Site: http://ghostscript.com/download;http://mupdf.com/downloads/
Vendor: Ghostscript
----------------------------------------------------------
Vulnerability:
Recently,I found a heap overflow vulnerability that cause this crash .
I thought it a dangerous vulnerability because there are so many function
point in the heap and the program have important the function "system".

The location of this vulnerability is at "pdf_load_mesh_params" function,at
 "source/pdf/pdf-shade.c" .

obj = pdf_dict_get(ctx, dict, PDF_NAME_Decode);
if (pdf_array_len(ctx, obj) >= 6)
{
n = (pdf_array_len(ctx, obj) - 4) / 2;
shade->u.m.x0 = pdf_to_real(ctx, pdf_array_get(ctx, obj, 0));
shade->u.m.x1 = pdf_to_real(ctx, pdf_array_get(ctx, obj, 1));
shade->u.m.y0 = pdf_to_real(ctx, pdf_array_get(ctx, obj, 2));
shade->u.m.y1 = pdf_to_real(ctx, pdf_array_get(ctx, obj, 3));
for (i = 0; i < n; i++)
{
shade->u.m.c0[i] = pdf_to_real(ctx, pdf_array_get(ctx, obj, 4 + i * 2));
shade->u.m.c1[i] = pdf_to_real(ctx, pdf_array_get(ctx, obj, 5 + i * 2));
}
}



the length of array return from "pdf_array_len"  not be checked. But the
max size of "shade->u.m.C0/C1" is defined as a macro(32 as default). So if
I make a pdf which have a large decode array. This code will cause a heap
overflow .

And the overflow data could be control, And on the memory I overflow , I
found a struct which full of function point. Maybe I can let it point to
got table for a chance to call "system"

issue:
http://bugs.ghostscript.com/show_bug.cgi?id=696954

fix code:
http://git.ghostscript.com/?p=mupdf.git;h=39b0f07dd960f34e7e6bf230ffc3d87c41ef0f2e

PoC:

reference attachment


CVE-2016-6525



References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-6525
http://seclists.org/oss-sec/2016/q3/241
Comment 1 Johannes Segitz 2017-07-11 11:36:01 UTC
fixed in current version on leap