home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / texts / hacking_info_a-l / cert831.doc < prev    next >
Internet Message Format  |  2001-02-10  |  12KB

  1. From cert-advisory-request@cert.org Thu Aug 31 09:56:21 1995
  2. Return-Path: cert-advisory-request@cert.org
  3. Received: from why.cert.org (why.cert.org [192.88.209.31]) by server.snni.com (8.6.11/8.6.9) with ESMTP id JAA20699 for <noid@server.snni.com>; Thu, 31 Aug 1995 09:56:18 -0700
  4. Received: (from cert-advisory@localhost) by why.cert.org (8.6.12/CERT-ecd.1) id MAA22709 for cert-advisory-queue-22; Thu, 31 Aug 1995 12:29:33 -0400
  5. Date: Thu, 31 Aug 1995 12:29:33 -0400
  6. Message-Id: <199508311629.MAA22709@why.cert.org>
  7. From: CERT Advisory <cert-advisory@cert.org>
  8. To: cert-advisory@cert.org
  9. Subject: CERT Advisory CA-95:10 - ghostscript Vulnerability
  10. Reply-To: cert-advisory-request@cert.org
  11. Organization: CERT Coordination Center - 412-268-7090
  12. Status: RO
  13. X-Status: 
  14.  
  15. =============================================================================
  16. CA-95:10                         CERT Advisory
  17.                                 August 31, 1995
  18.                            ghostscript Vulnerability
  19. -----------------------------------------------------------------------------
  20.                     
  21.              A large portion of the technical content of this
  22.              advisory was provided by the DFN-CERT and NASIRC
  23.              response teams, and is used with their permission.
  24.  
  25. There is a vulnerability in older versions of ghostscript (gs) that enables
  26. users to execute commands and thus modify files. This problem involves the
  27. -dSAFER option and is present in all versions of ghostscript from 2.6 through
  28. 3.22 beta.
  29.  
  30. We recommend that you apply the solution in Section III below to fix the
  31. -dSAFER PostScript code or install the latest version of ghostscript (version
  32. 3.33). In both cases, we urge you to make -dSAFER the default mode for
  33. all versions of ghostscript starting with version 2.6.
  34.  
  35. As we receive additional information relating to this advisory, we
  36. will place it in 
  37.  
  38.         ftp://info.cert.org/pub/cert_advisories/CA-95:10.README
  39.  
  40. We encourage you to check our README files regularly for updates on
  41. advisories that relate to your site.
  42.  
  43. -----------------------------------------------------------------------------
  44.  
  45. I.   Background    
  46.  
  47.      The PostScript language, which was designed for the expression of 
  48.      graphical data, is widely used for transferring images and preformatted
  49.      text across the Internet. The language includes primitives for file 
  50.      operations, which were intended to be useful in the expression of images.
  51.      Unfortunately the operations can be abused by people intentionally 
  52.      embedding commands within an otherwise harmless image so that when 
  53.      displaying that image the PostScript viewer may perform malicious
  54.      file creations or deletions.
  55.     
  56.      This is a potentially serious problem because many images transferred
  57.      on the World Wide Web are sent in PostScript. For example, a malicious
  58.      person could install a booby-trapped image on a web-page, buried among
  59.      useful or interesting data.
  60.     
  61.      The viewer "ghostscript," a PostScript interpreter, recognizes the
  62.      command-line option: "-dSAFER". This option is intended to disable
  63.      the file operations and the %pipe PostScript operator that could be 
  64.      abused to do damage. This option is intended to protect you from this 
  65.      type of sabotage when viewing images from untrusted sources.
  66.  
  67. II.  Problem Description
  68.  
  69.      Problems exist with the ghostscript program, which supports the kind
  70.      of commands discussed above. 
  71.  
  72.      Older versions of ghostscript do not completely disable the pipe operator
  73.      that can be used execute commands that can modify files. Therefore the
  74.      option -dSAFER does not provide full protection.
  75.      
  76.      This problem is present in all versions of ghostscript between
  77.      2.6 (when the %pipe operator was added) and 3.22beta (when a fix
  78.      was made). 
  79.  
  80. III. Impact
  81.  
  82.      Attackers who have inserted malicious code into a PostScript file can 
  83.      cause commands to be executed and files to be modified on any system 
  84.      where that PostScript file is viewed with ghostscript.
  85.  
  86. IV. Solutions
  87.  
  88.      We recommend either fixing the -dSAFER PostScript code or installing
  89.      version 3.33 of ghostscript (see Sections IV.A and IV.B). In addition, 
  90.      we urge you to enable the -dSAFER option as the default (see Section
  91.      IV.C). 
  92.  
  93.      A. Fixing the -dSAFER PostScript code
  94.  
  95.         The following fix is in the form of "diff" output, which is
  96.         suitable for use with the GNU patch program.  This patch brings the
  97.         code into conformance with the version of gs_init.ps distributed
  98.         with the latest version of ghostscript (3.33) and can be
  99.         applied to the GNU versions 2.6, 2.6.1, and 2.6.2.  The file
  100.         to be patched is in the ghostscript library. As an example, 
  101.         gs_init.ps could be installed in:
  102.  
  103.           /usr/local/lib/ghostscript/gs_init.ps
  104.     
  105.         Here is the patch:
  106. --------------------------------cut here--------------------------------------
  107.  
  108. *** gs_init.ps.orig     Fri Aug 25 10:42:51 1995
  109. --- gs_init.ps  Fri Aug 25 11:16:24 1995
  110. ***************
  111. *** 302,308 ****
  112.   % If we want a "safer" system, disable some obvious ways to cause havoc.
  113.   SAFER not { (%END SAFER) .skipeof } if
  114.   /file
  115. !  { dup (r) eq
  116.       { file }
  117.       { /invalidfileaccess signalerror }
  118.      ifelse
  119. --- 302,308 ----
  120.   % If we want a "safer" system, disable some obvious ways to cause havoc.
  121.   SAFER not { (%END SAFER) .skipeof } if
  122.   /file
  123. ! { dup (r) eq 2 index (%pipe*) .stringmatch not and
  124.       { file }
  125.       { /invalidfileaccess signalerror }
  126.      ifelse
  127. --------------------------------cut here--------------------------------------
  128.  
  129.         The key is to change the line that says:
  130.  
  131.           { dup (r) eq
  132.  
  133.         to one that says:
  134.  
  135.           { dup (r) eq 2 index (%pipe*) .stringmatch not and
  136.  
  137.         Here are the relevant lines in the gs_init.ps file for version 2.6.2
  138.         of ghostscript before the patch:
  139.  
  140. 302  % If we want a "safer" system, disable some obvious ways to cause havoc. 
  141. 303  SAFER not { (%END SAFER) .skipeof } if
  142. 304  /file
  143. 305   { dup (r) eq
  144. 306      { file }
  145. 307      { /invalidfileaccess signalerror }
  146. 308     ifelse
  147. 309   } bind odef
  148. 310  /renamefile { /invalidfileaccess signalerror } odef
  149. 311  /deletefile { /invalidfileaccess signalerror } odef
  150. 312  %END SAFER
  151.  
  152.         Here are the same lines after the patch has been applied:
  153.  
  154. 302  % If we want a "safer" system, disable some obvious ways to cause havoc.
  155. 303  SAFER not { (%END SAFER) .skipeof } if
  156. 304  /file
  157. 305  { dup (r) eq 2 index (%pipe*) .stringmatch not and
  158. 306      { file }
  159. 307      { /invalidfileaccess signalerror }
  160. 308     ifelse
  161. 309   } bind odef
  162. 310  /renamefile { /invalidfileaccess signalerror } odef
  163. 311  /deletefile { /invalidfileaccess signalerror } odef
  164. 312  %END SAFER
  165.  
  166.  
  167.      B. Installing version 3.33
  168.   
  169.         You may wish to install Aladdin Ghostscript version 3.33.
  170.         The latest version of ghostscript is version 3.33 and
  171.         is available at the locations noted below.  
  172.  
  173.         This version of ghostscript is provided by Aladdin Enterprises and 
  174.         is subject to their licensing agreements.  Please read the "Aladdin
  175.         Ghostscript Free Public License" (included in the source code
  176.         distribution) which differs from the "GNU Public License."
  177.  
  178.         Please note that this version is not the GNU version.  The latest GNU
  179.         version, which is version 2.6.2, does not fix this problem.
  180.              
  181.           ftp://ftp.cs.wisc.edu/pub/ghost/aladdin/ghostscript-3.33.tar.gz
  182.                 MD5=28b78ab052dff21639c4b97051323e49
  183.  
  184.           ftp://ftp.cs.wisc.edu/pub/ghost/aladdin/ghostscript-3.33jpeg.tar.gz
  185.                 MD5=b7dd9064dd57db8fccc306f5e4528d99
  186.  
  187.         Optionally, you may need the font files for this release.  They are
  188.         available at these locations:
  189.      
  190.          ftp://ftp.cs.wisc.edu/pub/aladdin/ghostscript-fonts-std-3.0.tar.gz
  191.                 MD5=fe7377bb155496828a328624ae80149d
  192.  
  193.          ftp://ftp.cs.wisc.edu/pub/aladdin/ghostscript-fonts-other-3.0.tar.gz
  194.                 MD5=afe46faf7fde6518ae004a7e8d9a4af4
  195.  
  196.      C. Making -dSAFER the default
  197.      
  198.         To make -dSAFER the default mode for ghostscript for all versions
  199.         of ghostscript starting with version 2.6, the file gs_init.ps must
  200.         again be changed.  The PostScript commands which check the actual
  201.         interpreted command are collected in one single if statement in the
  202.         gs_init.ps file. By commenting out the begin and end lines of this
  203.         if statement, the check is always applied meaning that the -dSAFER
  204.         option is always enabled.
  205.  
  206.         NOTE: If you make this change, all file and %pipe operations are
  207.         disabled and cannot be re-enabled.
  208.  
  209.         The lines which must be changed are:
  210.  
  211.               303  SAFER not { (%END SAFER) .skipeof } if
  212.         and
  213.               312  %END SAFER
  214.  
  215.         These two lines should be commented out and made to look like this:
  216.  
  217.               303  % SAFER not { (%END SAFER) .skipeof } if
  218.         and
  219.               312  % %END SAFER
  220.  
  221.         If you are using ghostscript 2.6.2, the code will look like the
  222.         following when both patches noted above are installed:
  223.  
  224. 302  % If we want a "safer" system, disable some obvious ways to cause havoc.
  225. 303  % SAFER not { (%END SAFER) .skipeof } if
  226. 304  /file
  227. 305  { dup (r) eq 2 index (%pipe*) .stringmatch not and
  228. 306      { file }
  229. 307      { /invalidfileaccess signalerror }
  230. 308     ifelse
  231. 309   } bind odef
  232. 310  /renamefile { /invalidfileaccess signalerror } odef
  233. 311  /deletefile { /invalidfileaccess signalerror } odef
  234. 312  % %END SAFER
  235.  
  236.  
  237. ---------------------------------------------------------------------------
  238. The CERT Coordination Center staff thanks the DFN-CERT and NASIRC response
  239. teams for providing a large portion of the technical content of this advisory,
  240. and we thank Wolfgang Ley for his assistance.
  241. ---------------------------------------------------------------------------
  242.  
  243. If you believe that your system has been compromised, contact the CERT
  244. Coordination Center or your representative in the Forum of Incident
  245. Response and Security Teams (FIRST).
  246.  
  247. If you wish to send sensitive incident or vulnerability information to
  248. CERT staff by electronic mail, we strongly advise that the email be
  249. encrypted.  The CERT Coordination Center can support a shared DES key, PGP
  250. (public key available via anonymous FTP on info.cert.org), or PEM (contact
  251. CERT staff for details).
  252.  
  253. Internet email: cert@cert.org
  254. Telephone: +1 412-268-7090 (24-hour hotline)
  255.            CERT personnel answer 8:30 a.m.-5:00 p.m. EST(GMT-5)/EDT(GMT-4),
  256.            and are on call for emergencies during other hours.
  257. Fax: +1 412-268-6989
  258.  
  259. Postal address:  CERT Coordination Center
  260.                  Software Engineering Institute
  261.                  Carnegie Mellon University
  262.                  Pittsburgh, PA 15213-3890
  263.                  USA
  264.  
  265. CERT advisories and bulletins are posted on the USENET newsgroup
  266. comp.security.announce. If you would like to have future advisories and
  267. bulletins mailed to you or to a mail exploder at your site, please send mail
  268. to cert-advisory-request@cert.org.
  269.  
  270. Past CERT publications, information about FIRST representatives, and
  271. other information related to computer security are available for anonymous
  272. FTP from info.cert.org.
  273.  
  274.  
  275. This material may be reproduced and distributed without permission provided it
  276. is used for noncommercial purposes and the CERT Coordination Center, DFN-CERT,
  277. and NASIRC are acknowledged.
  278.  
  279. CERT is a service mark of Carnegie Mellon University.
  280.  
  281.