Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 178003
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Sune Kloppenborg Jeppesen <jaervosz@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 178003 depends on: Show dependency tree
Bug 178003 blocks: 154310 175023

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-05-11 07:56 0000
Buffer overflows in mutt_gecos_name

--- muttlib.c.orig      Thu Jun  8 13:51:03 2006
+++ muttlib.c   Thu May  3 13:41:28 2007
@@ -532,16 +532,19 @@ char *mutt_gecos_name (char *dest, size_t destlen, str

   pwnl = strlen (pw->pw_name);

-  for (idx = 0; dest[idx]; idx++)
+  for (idx = 0; dest[idx] && idx < destlen - 1; idx++)
   {
     if (dest[idx] == '&')
     {
-      memmove (&dest[idx + pwnl], &dest[idx + 1],
+      /* Don't move if destination is outside buffer. */
+      if (idx + pwnl < destlen)
+        memmove (&dest[idx + pwnl], &dest[idx + 1],
               MAX(destlen - idx - pwnl - 1, 0));
       memcpy (&dest[idx], pw->pw_name, MIN(destlen - idx - 1, pwnl));
       dest[idx] = toupper ((unsigned char) dest[idx]);
     }
   }
+  dest[idx] = '\0';

   return dest;
 }

Related changesets:
http://dev.mutt.org/hg/mutt/rev/47d08903b79b

------- Comment #1 From Sune Kloppenborg Jeppesen 2007-05-11 07:57:04 0000 -------
net-mail please advise and patch as necessary.

------- Comment #2 From Lubomir Rintel 2007-05-11 22:15:15 0000 -------
Sooo....

Basically an overflow can be caused when mutt tries to expand "&" in real name
gecos field to uppercase login, and real name string length plus login name
length is more than 256 characters.

This can be reached viea two vectors -- at startup, it expands the real name of
the user launching mutt. This is only under control of the user, so to exploit
it he would have to voluntarily malform his real name field, all he'll get
would be to execute code as himself. No security impact here.

Second "attack" vector is alias expansion. If mutt user has an alias for a
local user, in form 'alias aliasname username # and thus not "alias aliasname
User Name <username>"' mutt does exactly the same thing for username. It is
questionable how likely is it for a local user to exist in someone's alias file
and have a malicious realname though.

One more thing is that realname should be long enough to make it possible for
an ASCII shellcode to fit there, and thus will be even more unlikely to exist
without permission of the operator of a system (who can do anything anyways)
and even if it existed it would be very suspicious, and thus unlikely to make
it into anyone's alias table. Therefore security impact is either none, or
veeeery limited.

------- Comment #3 From Lubomir Rintel 2007-05-11 22:26:21 0000 -------
# USERNAME=$(perl -e 'print "a" x 31')
# useradd -c "$(perl -e 'print "x" x 250') &" $USERNAME
# echo alias billg $USERNAME >~/.muttrc
# mutt billg
Segmentation fault (core dumped)
#

31 seems to be a limit for a login name, at least on my box.
Never seen an ASCII shellcode that would fit there.

------- Comment #4 From Lubomir Rintel 2007-05-11 22:28:51 0000 -------
Wait a second... you can use more than one "&" in a realname field.
This removes the 31-character limit.

------- Comment #5 From Stefan Cornelius (RETIRED) 2007-07-13 16:15:50 0000 -------
hey net-mail .. unlike lkundrak i spent no time looking at it, but i would
sleep better with this patch applied. please provide a fixed ebuild.

------- Comment #6 From Fernando J. Pereda (RETIRED) 2007-08-08 09:44:14 0000 -------
It is easier if I get the mail myself :)

Anyway, mutt-1.5.16 should fix this. I just commited it to the tree.

- ferdy

------- Comment #7 From Pierre-Yves Rofes 2007-08-08 09:54:56 0000 -------
Thanks ferdy. we'll handle stabilization here.
Arches, please test and mark stable mail-client/mutt-1.5.16:
target keywords are "alpha amd64 hppa ia64 mips ppc ppc64 sparc x86 ~x86-fbsd"

------- Comment #8 From Gustavo Zacarias (RETIRED) 2007-08-08 12:56:05 0000 -------
 * Cannot find $EPATCH_SOURCE!  Value for $EPATCH_SOURCE is:
 *
 *   /usr/portage/mail-client/mutt/files/mutt-1.5.16-parallel-make.patch
 *   ( mutt-1.5.16-parallel-make.patch )

Oops!

------- Comment #9 From Fernando J. Pereda (RETIRED) 2007-08-08 16:07:46 0000 -------
Should be fixed now. Sorry.

------- Comment #10 From Jeroen Roovers 2007-08-09 01:34:38 0000 -------
[ebuild     U ] mail-client/mutt-1.5.16 [1.5.13-r1] USE="berkdb crypt gdbm
gnutls idn imap nls nntp sasl ssl -debug -gpgme -mbox -pop (-qdbm) -sidebar%
-smime -smtp% -vanilla (-buffysize%) (-cjk%*)" 0 kB [1]

[...]

>>> Unpacking mutt-1.5.16-gentoo-patches.tar.bz2 to /dev/shm/portage/mail-client
/mutt-1.5.16/work
 * Applying mutt-1.5.16-parallel-make.patch ...                           [ ok
]
 * Applying 01-collapse_flagged.patch ...                                 [ ok
]
 * Applying 02-compressed.patch ...                                       [ ok
]
 * Applying 03-imap_fcc_status.patch ...                                  [ ok
]
 * Applying 04-mbox_hook.patch ...                                        [ ok
]
 * Applying 05-pgp_timeout.patch ...                                      [ ok
]
 * Applying 06-nntp.patch ...

 * Failed Patch: 06-nntp.patch !
 *  (
/dev/shm/portage/mail-client/mutt-1.5.16/work/mutt-1.5.16-gentoo-patches/0
6-nntp.patch )

------- Comment #11 From Jeroen Roovers 2007-08-09 02:52:26 0000 -------
Stable for HPPA.

------- Comment #12 From Christian Faulhammer 2007-08-09 07:32:59 0000 -------
x86 stable

------- Comment #13 From Fernando J. Pereda (RETIRED) 2007-08-09 08:27:05 0000 -------
There was a problem in the nntp patch which I fixed in the -r1 patchset.

- ferdy

------- Comment #14 From Tobias Scherbaum 2007-08-09 10:16:55 0000 -------
ppc stable

------- Comment #15 From Raúl Porcel 2007-08-09 11:16:50 0000 -------
alpha/ia64 stable

------- Comment #16 From Gustavo Zacarias (RETIRED) 2007-08-09 13:18:21 0000 -------
sparc stable.

------- Comment #17 From Markus Rothe 2007-08-10 17:45:16 0000 -------
ppc64 stable

------- Comment #18 From Steve Dibb 2007-08-11 15:10:42 0000 -------
amd64 stable

------- Comment #19 From Raphael Marichez 2007-08-22 22:39:01 0000 -------
Hi,

according to comment #2 which very clearly explains the possible attack
vectors, i don't want to send a GLSA for that minor issue. It's a local buffer
overflow and has a security impact only if the user is really to dumb that he
will add a doubtlessly strange username in his alias file.

CVE-2007-1558 has not a high security impact imho, it's partial information
leakage.

So -> noglsa.

p-y? security? agree?

------- Comment #20 From Joshua Kinard 2007-08-23 05:09:03 0000 -------
mips stable.

------- Comment #21 From Pierre-Yves Rofes 2007-08-23 08:58:28 0000 -------
I agree that this particular issue isn't serious, but if you consider it with
the other two (temp file on bug #154310 and APOP issue on bug #175023), I think
we should have a glsa. And about the APOP issue, I disagree with you about the
impact of the information leakage. Assuming that most users use a non secure
password (likely to be a dictionnary word), disclosing the 3 first letters
makes the password much easier to find...

------- Comment #22 From Sune Kloppenborg Jeppesen 2007-08-23 17:23:11 0000 -------
Despite the other mutt bugs I tend to agree with Falco here. I don't even think
it is worth mentioning in the other GLSA.

------- Comment #23 From Matt Drew 2007-09-01 12:29:09 0000 -------
I agree, no glsa, this is not significant.

------- Comment #24 From Pierre-Yves Rofes 2007-09-01 21:36:43 0000 -------
okay so finally closing without GLSA.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug