<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>123782</bug_id>
          
          <creation_ts>2006-02-22 20:56 0000</creation_ts>
          <short_desc>app-arch/zoo: buffer overflows</short_desc>
          <delta_ts>2006-03-06 13:28:37 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Security</product>
          <component>Vulnerabilities</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <status_whiteboard>B2 [glsa] DerCorny</status_whiteboard>
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>dercorny@gentoo.org</reporter>
          <assigned_to>security@gentoo.org</assigned_to>
          <cc>smithj@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>dercorny@gentoo.org</who>
            <bug_when>2006-02-22 20:56:34 0000</bug_when>
            <thetext>When feeding zoo a specially crafted archive, an attacker may be able
to trigger a stack overflow and seize control of the program.

fullpath()/misc.c accepts a pointer to a directory entry and returns the
combined directory name and filename.  fullpath() calls the function
combine()/misc.c, and assume that the length of the string returned is never
longer than 256 bytes.  In fact, the string returned can be made a little
longer than 512 bytes.

If the string is in fact longer than 256 bytes, a static variable can be
overflowed in the function fullpath()/misc.c .  This string is later used
in a strcpy() on a destination buffer of 256 bytes on the stack.

It is then easy to overwrite EIP and take control of the program.


III.    PATCH

diff -u -r -r zoo-2.10.old/misc.c zoo-2.10.orig/misc.c
--- zoo-2.10.old/misc.c 1991-07-05 12:00:00.000000000 -0400
+++ zoo-2.10.orig/misc.c        2006-01-29 17:20:35.000000000 -0500
@@ -135,11 +135,16 @@
 char *fullpath (direntry)
 struct direntry *direntry;
 {
-       static char result[PATHSIZE];
+       static char result[PATHSIZE+PATHSIZE+12]; // Room for enough space
        combine (result,
                                direntry-&gt;dirlen != 0 ?
direntry-&gt;dirname : &quot;&quot;,
                                (direntry-&gt;namlen != 0) ? direntry-&gt;lfname :
                                direntry-&gt;fname
                          );
+
+       if (strlen (result) &gt;= PATHSIZE) {
+               prterror (&apos;f&apos;, &quot;Combined dirname and filename too long\n&quot;);
+       }
+
        return (result);
 }</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dercorny@gentoo.org</who>
            <bug_when>2006-02-22 20:58:35 0000</bug_when>
            <thetext>yay, no maintainer ...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>smithj@gentoo.org</who>
            <bug_when>2006-02-23 13:15:44 0000</bug_when>
            <thetext>i&apos;ll take it</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>smithj@gentoo.org</who>
            <bug_when>2006-02-23 13:40:09 0000</bug_when>
            <thetext>x86 stable. other archs, please stabalize 2.10-r1</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>corsair@gentoo.org</who>
            <bug_when>2006-02-23 23:02:32 0000</bug_when>
            <thetext>One epatch source seems to be wrong. Here is the output:

 * Cannot find $EPATCH_SOURCE!  Value for $EPATCH_SOURCE is:
 *
 *   /var/tmp/portage/zoo-2.10-r1/work/zoo-2.10-gcc33-issues-fix.patch
 *   ( zoo-2.10-gcc33-issues-fix.patch )

epatch tries ${WORKDIR} instead of ${DISTDIR}.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>corsair@gentoo.org</who>
            <bug_when>2006-02-23 23:04:37 0000</bug_when>
            <thetext>this was already fixed in CVS. ppc64 stable now!</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gustavoz@gentoo.org</who>
            <bug_when>2006-02-24 06:17:43 0000</bug_when>
            <thetext>sparc stable.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2006-02-26 09:25:53 0000</bug_when>
            <thetext>Changing status</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dertobi123@gentoo.org</who>
            <bug_when>2006-02-26 10:51:51 0000</bug_when>
            <thetext>ppc stable</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>blubb@gentoo.org</who>
            <bug_when>2006-02-27 11:29:08 0000</bug_when>
            <thetext>amd64 stable, and it seems alpha is already done too:

  26 Feb 2006; Bryan </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>blubb@gentoo.org</who>
            <bug_when>2006-02-27 11:29:08 0000</bug_when>
            <thetext>amd64 stable, and it seems alpha is already done too:

  26 Feb 2006; Bryan Østergaard &lt;kloeri@gentoo.org zoo-2.10-r1.ebuild:
  Stable on alpha, bug 123782.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2006-03-06 13:28:37 0000</bug_when>
            <thetext>GLSA 200603-05</thetext>
          </long_desc>
      
    </bug>

</bugzilla>