home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / general / cert0127.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  10.8 KB  |  273 lines

  1.  
  2. -----BEGIN PGP SIGNED MESSAGE-----
  3.  
  4. =============================================================================
  5. CERT(sm) Advisory CA-96.22
  6. Original issue date: October 8, 1996
  7. Last revised: November 13, 1996
  8.               Noted that yy_readline_get does not require the patch included
  9.               in the original advisory. Removed the patch from Sec. III.
  10.  
  11.               A complete revision history is at the end of this file.
  12.  
  13. Topic: Vulnerabilities in bash
  14. - ------------------------------------------------------------------------------
  15.                 The original technical content for this advisory
  16.                 was published by the IBM-ERS response team and
  17.                 is used here with their permission.
  18.  
  19. This advisory describes two problems with the GNU Project's Bourne Again
  20. SHell (bash): one in yy_string_get() and one in yy_readline_get().
  21.  
  22. The vulnerability in yy_string_get() allows the character with value 255
  23. decimal to be used as a command separator. When used in environments where
  24. users provide strings to be used as commands or arguments to commands, bash
  25. can be tricked into executing arbitrary commands.
  26.  
  27. When the advisory was first published, was not clear whether the problem with
  28. yy_readline_get() resulted in an exploitable vulnerability. As of November
  29. 1996, it appears that the problem is not exploitable in yy_readline_get.
  30.  
  31. The problems affect bash versions 1.14.6 and earlier.
  32.  
  33. The CERT/CC team recommends that you upgrade to bash 1.14.7 as soon as
  34. possible, as discussed in Section III.A below. Section III.B contains a
  35. patch for 1.14.7, which we recommend using to address the yy_readline_get()
  36. problem.
  37.  
  38. We will update this advisory as we receive additional information.
  39. Please check advisory files regularly for updates that relate to your site.
  40.  
  41. - ----------------------------------------------------------------------------
  42.  
  43. I. Description
  44.  
  45.    A. Introduction
  46.  
  47.       The GNU Project's Bourne Again SHell (bash) is a drop-in replacement
  48.       for the UNIX Bourne shell (/bin/sh). It offers the same syntax as the
  49.       standard shell, and it also includes additional functionality such as
  50.       job control, command line editing, and history.
  51.  
  52.       Although bash can be compiled and installed on almost any UNIX
  53.       platform, its most prevalent use is on "free" versions of UNIX such as
  54.       Linux, where it has been installed as "/bin/sh" (the default shell for
  55.       most uses).
  56.  
  57.       The bash source code is freely available from many sites on the
  58.       Internet.
  59.  
  60.    B. Vulnerability Details
  61.  
  62.       1. Vulnerability in yy_string_get()
  63.  
  64.          There is a variable declaration error in the "yy_string_get()"
  65.          function in the "parse.y" module of the "bash" source code. This
  66.          function is responsible for parsing the user-provided command line
  67.          into separate tokens (commands, special characters, arguments, etc.).
  68.          The error involves the variable "string", which has been declared to
  69.          be of type "char *".
  70.  
  71.          The "string" variable is used to traverse the character string
  72.          containing the command line to be parsed. As characters are
  73.          retrieved from this pointer, they are stored in a variable of type
  74.          "int". On systems/compilers where the "char" type defaults to
  75.          "signed char" this value will be sign-extended when it is assigned
  76.          to the  "int" variable. For character code 255 decimal (-1 in two's
  77.          complement form), this sign extension results in the value (-1)
  78.          being assigned to the integer.
  79.  
  80.          However, (-1) is used in other parts of the parser to indicate the
  81.          end of a command. Thus, the character code 255 decimal (377 octal)
  82.          will serve as an unintended command separator for commands given to
  83.          bash via the "-c" option. For example,
  84.  
  85.          bash -c 'ls\377who'
  86.  
  87.          (where "\377" represents the single character with value 255 decimal)
  88.          will execute two commands, "ls" and "who".
  89.  
  90.     Note about yy_readline_get()
  91.          A similar problem exists with the "yy_readline_get()" function, which
  92.          is also in the file "parse.y" and which is used to read commands in
  93.          interactive shells (ones that print a prompt and read from the
  94.          keyboard, a shell script, or a pipe).
  95.  
  96.          However, it appears that this problem does not produce an exploitable
  97.          vulnerability.
  98.  
  99. II.  Impact
  100.  
  101.      This unexpected command separator can be dangerous, especially on systems
  102.      such as Linux where bash has been installed as "/bin/sh," when a program
  103.      executes a command with a string provided by a user as an argument using
  104.      the "system()" or "popen()" functions (or by calling "/bin/sh -c string"
  105.      directly).
  106.  
  107.      This is especially true for the CGI programming interface in World Wide
  108.      Web servers, many of which do not strip out characters with value 255
  109.      decimal. If a user sending data to the server can specify the character
  110.      code 255 in a string that is passed to a shell, and that shell is bash,
  111.      the user can execute any arbitrary command with the user-id and
  112.      permissions of the user running the server (frequently "root").
  113.  
  114.      The bash built-in commands "eval," "source," and "fc" are also
  115.      potentially vulnerable to this problem.
  116.  
  117. III. Solution
  118.  
  119.      Install the most current version of bash. On 27 August 1996, Version
  120.      1.14.7 of bash was released;  It is available from
  121.  
  122.         ftp://slc2.ins.cwru.edu/pub/dist/bash-1.14.7.tar.gz
  123.  
  124.      This version addresses the vulnerability in yy_string_get.
  125.        
  126.      When this advisory was first released, we included a patch for 
  127.      yy_readline_get. It now appears that the patch is unnecessary as the
  128.      problem is not exploitable in yy_readline_get. Upgrading to the current
  129.      version of bash is sufficient.  
  130.  
  131. ..............................................................................
  132. Appendix A
  133.  
  134. The following is vendor-supplied information.
  135. For the most up-to-date information, contact your vendor.
  136.  
  137. IBM Corporation
  138. ===============
  139. AIX does not ship with the bash shell.
  140.  
  141. IBM and AIX are registered trademarks of International
  142. Business Machines Corporation.
  143.  
  144.  
  145. Silicon Graphics, Inc.
  146. ======================
  147. SGI has distributed bash (version 1.14.6) as part of the Freeware 1.0
  148. CDROM.  This collection of software has been compiled for IRIX as a
  149. service to our customers, but is furnished without formal SGI support.
  150.  
  151. The problem identified by IBM in bash is present in the version of bash
  152. on the Freeware 1.0 CDROM.  This CDROM included both the source code
  153. for bash an compiled versions of it.
  154.  
  155. SGI urges customers to recompile bash after making the changes in
  156. parse.y suggested by IBM.
  157.  
  158. As a service similar to that of the original Freeware 1.0 CDROM, SGI
  159. intends to make available a compiled version of bash and its source in
  160. the near future.  This action does not necessarily imply a commitment to any
  161. future support actions for the programs found on the Freeware 1.0
  162. CDROM.
  163.  
  164.  
  165. Linux
  166. =====        
  167. Patches for the following Linux versions are available.
  168.  
  169. SuSE 4.2
  170.     ftp://ftp.suse.de/suse_update/suse42/a1/bash.tgz
  171.  
  172. Red Hat 3.0.3
  173.     ftp://ftp.redhat.com/pub/redhat/updates/3.0.3/{architecture}/bash-1.14.6.8.{architecture}.rpm
  174.  
  175.  
  176. Yggdrasil
  177.     Patched bash source and binary tar files are now  FTPable from
  178.  
  179.         ftp://ftp.yggdrasil.com/pub/support/fall95
  180.  
  181. WGS Linux Pro
  182.     ftp://ftp.wgs.com/pub/linux/redhat/updates/3.0.3/i386/bash-1.14.6-8.i386.rpm
  183.  
  184. Caldera - Have built the new bash-1.14.7 code from prep.ai.mit.edu
  185.     -/pub/gnu. Tested only insofar as to ascertain that the security bug
  186.     is fixed.  Binary and source RPMs live in ftp -
  187.  
  188.     ftp://ftp.caldera.com/pub/cnd-1.0/updates/bash-1.14.7-1.i386.rpm
  189.     ftp://ftp.caldera.com/pub/cnd-1.0/updates/bash-1.14.7-1.src.rpm
  190.  
  191. - ----------------------------------------------------------------------------
  192. The CERT Coordination Center thanks IBM-ERS for permission to reproduce the
  193. technical content in their IBM Emergency Response Service Security
  194. Vulnerability Alerts ERS-SVA-E01-1006:004.1 and ERS-SVA-E01-1006:004.2.
  195. These alerts are copyrighted 1996 International Business Machines Corporation.
  196. - ----------------------------------------------------------------------------
  197.  
  198. If you believe that your system has been compromised, contact the CERT
  199. Coordination Center or your representative in the Forum of Incident Response
  200. and Security Teams (see ftp://info.cert.org/pub/FIRST/first-contacts).
  201.  
  202.  
  203. CERT/CC Contact Information
  204. - ---------------------------
  205. Email    cert@cert.org
  206.  
  207. Phone    +1 412-268-7090 (24-hour hotline)
  208.                 CERT personnel answer 8:30-5:00 p.m. EST(GMT-5) / EDT(GMT-4)
  209.                 and are on call for emergencies during other hours.
  210.  
  211. Fax      +1 412-268-6989
  212.  
  213. Postal address
  214.          CERT Coordination Center
  215.          Software Engineering Institute
  216.          Carnegie Mellon University
  217.          Pittsburgh PA 15213-3890
  218.          USA
  219.  
  220. Using encryption
  221.    We strongly urge you to encrypt sensitive information sent by email. We can
  222.    support a shared DES key or PGP. Contact the CERT/CC for more information.
  223.    Location of CERT PGP key
  224.          ftp://info.cert.org/pub/CERT_PGP.key
  225.  
  226. Getting security information
  227.    CERT publications and other security information are available from
  228.         http://www.cert.org/
  229.         ftp://info.cert.org/pub/
  230.  
  231.    CERT advisories and bulletins are also posted on the USENET newsgroup
  232.         comp.security.announce
  233.  
  234.    To be added to our mailing list for advisories and bulletins, send your
  235.    email address to
  236.         cert-advisory-request@cert.org
  237.  
  238. - -----------------------------------------------------------------------------
  239. Copyright 1996 Carnegie Mellon University
  240. This material may be reproduced and distributed without permission provided
  241. it is used for noncommercial purposes and the copyright statement is
  242. included.
  243.  
  244. CERT is a service mark of Carnegie Mellon University.
  245. - -----------------------------------------------------------------------------
  246.  
  247. This file: ftp://info.cert.org/pub/cert_advisories/CA-96.22.bash_vuls
  248.            http://www.cert.org
  249.                click on "CERT Advisories"
  250.  
  251.  
  252. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  253. Revision history
  254.  
  255. Nov. 13, 1996   Noted that yy_readline_get does not require the patch included
  256.                 in the original advisory. Removed the patch from Sec. III.
  257.  
  258. Oct. 14, 1996    Added Appendix A - vendor information.
  259.  
  260.  
  261.  
  262.  
  263. -----BEGIN PGP SIGNATURE-----
  264. Version: 2.6.2
  265.  
  266. iQCVAwUBMook5nVP+x0t4w7BAQHqXAQAmZvYO3Yq57sCh7zPU98YXEnTAnIr2pta
  267. RkyNfjSBkDlMhdiHD/nyNL0Hn1kCQK0oCXv6o27rgEb+B9ZfLvXj0O5DiNhaMB1Q
  268. d+6b0H6o8iQ6WdEbU/3774LgFD1CpTp0MiZTwwMoNAfZ4/DD+zWGI4lO/5l2dU49
  269. MGMkjqFgHoc=
  270. =SbL0
  271. -----END PGP SIGNATURE-----
  272.  
  273.