Skip to contentSkip to conversation

ghostscript: CVE-2019-14811, CVE-2019-14817

PATCH New Stefan Ghinea 1 participant 1 message Sep 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ghostscript: CVE-2019-14811, CVE-2019-14817

A flaw was found in, ghostscript versions prior to 9.28, in the .pdf_hook_DSC_Creator 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.

A flaw was found in, ghostscript versions prior to 9.28, in the .pdfexectoken and other procedures 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.

References:
https://nvd.nist.gov/vuln/detail/CVE-2019-14811
https://nvd.nist.gov/vuln/detail/CVE-2019-14817

Upstream patches:
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=885444fcbe10dc42787ecb76686c8ee4dd33bf33
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=cd1b1cacadac2479e291efe611979bdc1b3bdb19

---
 .../ghostscript/CVE-2019-14811-0001.patch     |  68 +++++
 .../ghostscript/CVE-2019-14817-0001.patch     | 270 ++++++++++++++++++
 .../ghostscript/CVE-2019-14817-0002.patch     | 236 +++++++++++++++
 .../ghostscript/ghostscript_9.27.bb           |   3 +
 4 files changed, 577 insertions(+)
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2019-14811-0001.patch
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2019-14817-0001.patch
 create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2019-14817-0002.patch
meta/recipes-extended/ghostscript/ghostscript/CVE-2019-14811-0001.patch new file +68 -0
new file mode 100644
index 0000000000..3f28555e8a
@@ -0,0 +1,68 @@
+From 885444fcbe10dc42787ecb76686c8ee4dd33bf33 Mon Sep 17 00:00:00 2001
+From: Ken Sharp <[email protected]>
+Date: Tue, 20 Aug 2019 10:10:28 +0100
+Subject: [PATCH] make .forceput inaccessible
+
+Bug #701343, #701344, #701345
+
+More defensive programming. We don't want people to access .forecput
+even though it is no longer sufficient to bypass SAFER. The exploit
+in #701343 didn't work anyway because of earlier work to stop the error
+handler being used, but nevertheless, prevent access to .forceput from
+.setuserparams2.
+
+CVE: CVE-2019-14811
+Upstream-Status: Backport [git://git.ghostscript.com/ghostpdl.git]
+
+Signed-off-by: Stefan Ghinea <[email protected]>
+---
+ Resource/Init/gs_lev2.ps  | 6 +++---
+ Resource/Init/gs_pdfwr.ps | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Resource/Init/gs_lev2.ps b/Resource/Init/gs_lev2.ps
+index 98d55fe..f1b771f 100644
+--- a/Resource/Init/gs_lev2.ps
++++ b/Resource/Init/gs_lev2.ps
+@@ -158,7 +158,7 @@ end
+     {
+       pop pop
+     } ifelse
+-  } forall
++  } executeonly forall
+         % A context switch might have occurred during the above loop,
+         % causing the interpreter-level parameters to be reset.
+         % Set them again to the new values.  From here on, we are safe,
+@@ -229,9 +229,9 @@ end
+        { pop pop
+        }
+       ifelse
+-    }
++    } executeonly
+    forall pop
+-} .bind odef
++} .bind executeonly odef
+ 
+ % Initialize the passwords.
+ % NOTE: the names StartJobPassword and SystemParamsPassword are known to
+diff --git a/Resource/Init/gs_pdfwr.ps b/Resource/Init/gs_pdfwr.ps
+index 00c19fa..dfe504d 100644
+--- a/Resource/Init/gs_pdfwr.ps
++++ b/Resource/Init/gs_pdfwr.ps
+@@ -652,11 +652,11 @@ currentdict /.pdfmarkparams .undef
+           systemdict /.pdf_hooked_DSC_Creator //true .forceput
+         } executeonly if
+         pop
+-      } if
++      } executeonly if
+     } {
+       pop
+     } ifelse
+-  }
++  } executeonly
+   {
+     pop
+   } ifelse
+-- 
+2.20.1
+
meta/recipes-extended/ghostscript/ghostscript/CVE-2019-14817-0001.patch new file +270 -0

270 lines not on this page · raw message

meta/recipes-extended/ghostscript/ghostscript/CVE-2019-14817-0002.patch new file +236 -0

236 lines not on this page · raw message

meta/recipes-extended/ghostscript/ghostscript_9.27.bb +3 -0
index fcc9e0099e..349c0c2e8b 100644
@@ -25,6 +25,9 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d
                 file://do-not-check-local-libpng-source.patch \
                 file://avoid-host-contamination.patch \
                 file://mkdir-p.patch \
+                file://CVE-2019-14811-0001.patch \
+                file://CVE-2019-14817-0001.patch \
+                file://CVE-2019-14817-0002.patch \
 "
 
 SRC_URI = "${SRC_URI_BASE} \
Signature · 1 line
2.20.1