Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110289 - mail-filter/amavisd-new Insufficient sanitation when quarantining as BSMTP files
Summary: mail-filter/amavisd-new Insufficient sanitation when quarantining as BSMTP files
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Security
URL: http://marc.theaimsgroup.com/?l=amavi...
Whiteboard: C3 [noglsa] jaervosz
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-23 23:23 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2005-10-27 00:40 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-10-23 23:23:02 UTC
For sites that store quarantined or forwarded files as BSMTP files _and_ 
choose 
to include a sender name in the file name (by including a %s in the template), 
there is a security vulnerability in versions of amavisd-new 2.3.1, 2.3.2 
and 2.3.3, which could potentially allow sender to cause a file to be stored 
outside of intended location, or just cause mail quarantining to fail. 
A threat is limited to directories accessible by uid/gid under which the 
amavisd daemon is running, which could potentially affect other quarantined 
files or cause disruption in processing of other mail, but would not affect 
the security of a normally maintained operating system. 
 
The problem does not affect majority of sites, as most sites do not store 
files in BSMTP format, and even those that do seldom choose to include 
a %s in a file name template (I doubt there is more than one or two sites 
affected by this vulnerability). A telltale setting in amavisd.conf would 
be for example: $spam_quarantine_method = 'bsmtp:spam-%m-%s'; 
 
The patch below fixes the problem, and must be applied at affected sites. 
For other more common setups the patch is not needed (the code section 
is inactive, applying the patch won't hurt but is unnecessary). 
 
The fix will be included in the next release 2.4.0 (or in 2.3.4, although 
I do not expect there will be a 2.3.4 release). 
 
--- amavisd~        Thu Oct 20 20:10:04 2005 
+++ amavisd     Sun Oct 23 20:54:10 2005 
@@ -4720,3 +4720,3 @@ 
   my($s) = $msginfo->sender;  # defanged sender name for use in filename 
-  $s =~ tr/a-zA-Z0-9@._+-]/=/c; 
+  $s =~ tr/a-zA-Z0-9@._+-/=/c; 
   $s = substr($s,0,100)."..."  if length($s) > 100+3; 
@@ -6283,3 +6283,3 @@ 
             $s = substr($s,0,100)."..."  if length($s) > 100+3; 
-            $s =~ tr/a-zA-Z0-9@._+-]/=/c; $s =~ s/\@/_at_/g; 
+            $s =~ tr/a-zA-Z0-9@._+-/=/c; $s =~ s/\@/_at_/g; 
             $s = untaint($s)  if $s =~ /^(?:[a-zA-Z0-9%=._+-]+)\z/;  # 
untaint 
 
Thanks to Thomas Jarosch for discovering the problem. 
 
  Mark
Comment 1 Andrej Kacian (RETIRED) gentoo-dev 2005-10-23 23:47:23 UTC
I'll revbump amavisd-new with this patch. Has upstream been notified about this yet?
Comment 2 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-10-24 00:24:30 UTC
The Mark in the mail is the amavisd-new maintainer Mark Martinec, so yes:-) 
 
Let me know when the fix is in. 
Comment 3 Andrej Kacian (RETIRED) gentoo-dev 2005-10-24 02:23:41 UTC
amavisd-new-2.3.3-r2 (now in CVS) has the patch applied. x86 is already stable,
as I've been able to test on this arch.
Comment 4 Thierry Carrez (RETIRED) gentoo-dev 2005-10-24 04:23:05 UTC
Archs please test and mark 2.3.3-r2 stable.
Comment 5 Brent Baude (RETIRED) gentoo-dev 2005-10-24 07:35:59 UTC
marked ppc64 stable. thanks
Comment 6 Fernando J. Pereda (RETIRED) gentoo-dev 2005-10-24 14:07:48 UTC
Stable on alpha

Cheers,
Ferdy
Comment 7 Thierry Carrez (RETIRED) gentoo-dev 2005-10-26 02:50:39 UTC
Still missing amd64 and ppc64.
Comment 8 Brent Baude (RETIRED) gentoo-dev 2005-10-26 07:29:36 UTC
Sorry marked the wrong ebuild earlier.  amavisd-new-2.3.3-r2 now marked stable
in cvs
Comment 9 Brent Baude (RETIRED) gentoo-dev 2005-10-26 07:29:49 UTC
removing ppc64
Comment 10 Marcus D. Hanwell (RETIRED) gentoo-dev 2005-10-26 11:14:09 UTC
Stable on amd64. 
Comment 11 Stefan Cornelius (RETIRED) gentoo-dev 2005-10-26 11:30:59 UTC
ready for glsa vote, i tend to say no because of "[...] would not affect 
the security of a normally maintained operating system" and the need of a
specific config to be vulnerable.
Comment 12 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2005-10-26 12:20:49 UTC
I vote NO. 
Comment 13 Thierry Carrez (RETIRED) gentoo-dev 2005-10-27 00:40:07 UTC
Voting no too and closing.