Bug 1743754 (CVE-2019-14812) - CVE-2019-14812 ghostscript: Safer mode bypass by .forceput exposure in setuserparams (701444)
Summary: CVE-2019-14812 ghostscript: Safer mode bypass by .forceput exposure in setuse...
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2019-14812
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1744012 1744013 1744014 1744015 1747907
Blocks: 1743530
TreeView+ depends on / blocked
 
Reported: 2019-08-20 15:39 UTC by Cedric Buissart
Modified: 2020-03-25 08:28 UTC (History)
7 users (show)

Fixed In Version: ghostscript 9.50
Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the .setuserparams2 procedure where it did not properly secure its privileged calls, enabling scripts to bypass `-dSAFER` restrictions. A specially crafted PostScript file could disable security protection and then have access to the file system, or execute arbitrary commands.
Clone Of:
Environment:
Last Closed: 2019-09-02 13:07:24 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2675 None None None 2019-09-05 17:27:42 UTC
Red Hat Product Errata RHSA-2019:2586 None None None 2019-09-02 07:54:02 UTC
Red Hat Product Errata RHSA-2019:2591 None None None 2019-09-02 07:54:24 UTC

Description Cedric Buissart 2019-08-20 15:39:46 UTC
In Ghostscript 9.27, some ephemeral routines in .setuserparams2 can expose .forceput operator when hooking errors. This issue is similar to upstream bug https://bugs.ghostscript.com/show_bug.cgi?id=700317. 

The actual root-cause is in .setuserparams2 however there is no direct path to invoke the operator.

http://git.ghostscript.com/?p=ghostpdl.git;a=blob;f=Resource/Init/gs_lev2.ps;h=98d55fe74251e2b8f384a0a97d0a92a9f88949b6;hb=ebfaa2db4cb518a2bc99c1532d4429201a13dfab#l156

 156       /userparams .systemvar 3 1 roll .forceput  % userparams is read-only
 157     } executeonly
 158     {
 159       pop pop
 160     } ifelse
 161   } forall

We can reach .setuserparams2 via setuserparams.

http://git.ghostscript.com/?p=ghostpdl.git;a=blob;f=Resource/Init/gs_lev2.ps;h=98d55fe74251e2b8f384a0a97d0a92a9f88949b6;hb=ebfaa2db4cb518a2bc99c1532d4429201a13dfab#l169

 169 /setuserparams {                % <dict> setuserparams -
 170     {.setuserparams2} stopped
 171     {/setuserparams load $error /errorname get signalerror} if
 172 } .bind odef

This can be used to disable -dSAFER and, for example, access files outside of the restricted area, or command execution.

Reference:
https://bugs.ghostscript.com/show_bug.cgi?id=701444

Comment 4 Cedric Buissart 2019-08-21 06:43:03 UTC
Mitigation:

Please refer to the "Mitigation" section of CVE-2018-16509 : https://access.redhat.com/security/cve/cve-2018-16509

Comment 10 Cedric Buissart 2019-08-27 15:21:44 UTC
Acknowledgments:

Name: Artifex Software
Upstream: Hiroki MATSUKUMA (Cyber Defense Institute)

Comment 11 errata-xmlrpc 2019-09-02 07:54:01 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2019:2586 https://access.redhat.com/errata/RHSA-2019:2586

Comment 12 errata-xmlrpc 2019-09-02 07:54:23 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2019:2591 https://access.redhat.com/errata/RHSA-2019:2591

Comment 13 Cedric Buissart 2019-09-02 08:53:24 UTC
Created ghostscript tracking bugs for this issue:

Affects: fedora-all [bug 1747907]

Comment 14 Product Security DevOps Team 2019-09-02 13:07:24 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2019-14812


Note You need to log in before you can comment on or make changes to this bug.