Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 232642 (CVE-2008-2936) - mail-mta/postfix Insufficient mailbox owner/symlink checks (CVE-2008-2936, CVE-2008-2937)
Summary: mail-mta/postfix Insufficient mailbox owner/symlink checks (CVE-2008-2936, CV...
Status: RESOLVED FIXED
Alias: CVE-2008-2936
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Security
URL: http://article.gmane.org/gmane.mail.p...
Whiteboard: B1 [glsa]
Keywords:
: 242638 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-22 12:00 UTC by Robert Buchholz (RETIRED)
Modified: 2008-10-23 13:49 UTC (History)
12 users (show)

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


Attachments
patch for privilege escalation via hardlinked symlinks (postfix-link.patch,2.31 KB, patch)
2008-07-25 09:52 UTC, Matthias Geerdsen (RETIRED)
no flags Details | Diff
Diff between 2.4.6-r2 and 2.4.6-r3 (2.4.6-r2-2.4.6-r3.diff,692 bytes, text/plain)
2008-07-25 20:25 UTC, Tobias Scherbaum (RETIRED)
no flags Details
postfix-2.4.6-r3.ebuild (postfix-2.4.6-r3.ebuild,11.54 KB, text/plain)
2008-07-25 20:26 UTC, Tobias Scherbaum (RETIRED)
no flags Details
postfix-2.4.7-CVE-2008-2936.patch (postfix-2.4.7-CVE-2008-2936.patch,1.83 KB, patch)
2008-07-28 19:33 UTC, Robert Buchholz (RETIRED)
no flags Details | Diff
postfix-2.4.7-CVE-2008-2937.patch (postfix-2.4.7-CVE-2008-2937.patch,21.55 KB, patch)
2008-07-28 19:34 UTC, Robert Buchholz (RETIRED)
no flags Details | Diff
postfix-2.4.7-r1-overlay.tar.gz (postfix-2.4.7-r1-overlay.tar.gz,13.89 KB, application/octet-stream)
2008-07-28 19:35 UTC, Robert Buchholz (RETIRED)
no flags Details
postfix-2.5.3-r1.ebuild (postfix-2.5.3-r1.ebuild,11.76 KB, text/plain)
2008-08-03 14:46 UTC, Tobias Scherbaum (RETIRED)
no flags Details
postfix-2.5.3-CVE-2008-2936.patch (postfix-2.5.3-CVE-2008-2936.patch,1.84 KB, text/plain)
2008-08-03 14:46 UTC, Tobias Scherbaum (RETIRED)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Buchholz (RETIRED) gentoo-dev 2008-07-22 12:00:03 UTC
** Please note that this issue is confidential at the moment and no information
should be disclosed until it is made public **

Sebastian Krahmer of Suse reported that Postfix

(1) checks whether a mailbox is a symlink, but does no do so for root. This could allow privilege escalation by creating a hardlink to a root-owned symlink (such as /etc/init.d/net* on Gentoo), and delivering mail to the root user.

(2) does not check whether the mailbox already exists but is owned by a different user.
Comment 1 Matthias Geerdsen (RETIRED) gentoo-dev 2008-07-25 09:52:52 UTC
Created attachment 161331 [details, diff]
patch for privilege escalation via hardlinked symlinks

suitable for postfix >2.0
Comment 2 Matthias Geerdsen (RETIRED) gentoo-dev 2008-07-25 10:10:08 UTC
CVE-2008-2936 postfix priv esc
CVE-2008-2937 postfix (maybe others) spool file bad permissions

The attached patch is addressing CVE-2008-2936, the other issue will be handled via "the regular non-emergency release process" probably over this weekend.

Chtekk/dertobi123, could you already prepare an ebuild, simple epatch added to 2.4.6-r2 appears to work alright. I am not sure when the other issue will be fixed or at what time this patch will be released yet.

Adding robbat2 for infra, in case they might be interested in this.
Comment 3 Tobias Scherbaum (RETIRED) gentoo-dev 2008-07-25 20:24:11 UTC
(In reply to comment #2)
> The attached patch is addressing CVE-2008-2936, the other issue will be handled
> via "the regular non-emergency release process" probably over this weekend.

The patch applies and compiles fine for 2.4.*, but not for 2.5.2 - is there another patch for 2.5?
 
> Chtekk/dertobi123, could you already prepare an ebuild, simple epatch added to
> 2.4.6-r2 appears to work alright. I am not sure when the other issue will be
> fixed or at what time this patch will be released yet.

I'm attaching a diff between -r2 and -r3 plus the updated -r3 ebuild. Besides adding that epatch line I also changed the way the include and library path for postgres are determined, that fix is used in 2.5.2 since around ~6 weeks and shouldn't cause any issue when stabling 2.4.6-r3.
Comment 4 Tobias Scherbaum (RETIRED) gentoo-dev 2008-07-25 20:25:00 UTC
Created attachment 161366 [details]
Diff between 2.4.6-r2 and 2.4.6-r3
Comment 5 Tobias Scherbaum (RETIRED) gentoo-dev 2008-07-25 20:26:44 UTC
Created attachment 161368 [details]
postfix-2.4.6-r3.ebuild
Comment 6 Robert Buchholz (RETIRED) gentoo-dev 2008-07-27 12:01:40 UTC
Before cc'ing arch liaisons I would wait for a patch to the other CVE.
Comment 7 Tobias Scherbaum (RETIRED) gentoo-dev 2008-07-28 05:29:09 UTC
Postfix 2.5.3 has been released, the ChangeLog doesn't mention a fix for CVE-2008-2937.

As for CVE-2008-2936:

20080725

        Paranoia: defer delivery when a mailbox file is not owned
        by the recipient. Requested by Sebastian Krahmer, SuSE.
        Specify "strict_mailbox_ownership=no" to ignore ownership
        discrepancies.  Files: local/mailbox.c, virtual/mailbox.c.
Comment 8 Robert Buchholz (RETIRED) gentoo-dev 2008-07-28 19:33:59 UTC
Created attachment 161569 [details, diff]
postfix-2.4.7-CVE-2008-2936.patch

unified diff
Comment 9 Robert Buchholz (RETIRED) gentoo-dev 2008-07-28 19:34:44 UTC
Created attachment 161570 [details, diff]
postfix-2.4.7-CVE-2008-2937.patch

backported patch from 2.5.3
Comment 10 Robert Buchholz (RETIRED) gentoo-dev 2008-07-28 19:35:32 UTC
Created attachment 161572 [details]
postfix-2.4.7-r1-overlay.tar.gz

tar'ed up overlay
Comment 11 Robert Buchholz (RETIRED) gentoo-dev 2008-07-28 19:37:49 UTC
Tobias: I backported the patch and named them consistently. I'm not sure how you feel about 2.4.7 going stable, but it seemed easiest to me documentation-wise. If you could test/approve the attached overlay, we can cc arches.

Expected embargo date is Aug. 14
Comment 12 Tobias Scherbaum (RETIRED) gentoo-dev 2008-08-03 14:46:06 UTC
Created attachment 162101 [details]
postfix-2.5.3-r1.ebuild
Comment 13 Tobias Scherbaum (RETIRED) gentoo-dev 2008-08-03 14:46:34 UTC
Created attachment 162102 [details]
postfix-2.5.3-CVE-2008-2936.patch
Comment 14 Tobias Scherbaum (RETIRED) gentoo-dev 2008-08-03 14:51:25 UTC
(In reply to comment #11)
> Tobias: I backported the patch and named them consistently. I'm not sure how
> you feel about 2.4.7 going stable, but it seemed easiest to me
> documentation-wise. If you could test/approve the attached overlay, we can cc
> arches.
> 
> Expected embargo date is Aug. 14
> 

As discussed with Robert on IRC i'd prefer to go with 2.5.3(-r1 that is) instead of backporting the fixes to 2.4.7-r1 because the patch for CVE-2008-2937 changes postfix' behaviour.

I'd ask all arch teams to test 2.5.3-r1 but also 2.4.7-r1 so we a fallback option if problems in 2.5.3 show up (i don't expect so, there are no open bugs reported on 2.5.*) plus updating from 2.4 to 2.5 should be quite simple.
Comment 15 Robert Buchholz (RETIRED) gentoo-dev 2008-08-03 17:24:47 UTC
Arch Security Liaisons, please test the attached ebuild and report it stable on this bug.
Target keywords : "alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86"

CC'ing current Liaisons:
   alpha : yoswink
   amd64 : keytoaster
    hppa : jer
     ppc : dertobi123
   ppc64 : corsair
   sparc : fmccor
     x86 : tsunam
Comment 16 Ferris McCormick (RETIRED) gentoo-dev 2008-08-04 12:51:33 UTC
Sparc looks OK.
Built with USE flags:
USE='ldap mailwrapper mysql pam ssl'
Comment 17 Markus Rothe (RETIRED) gentoo-dev 2008-08-04 19:16:05 UTC
looks good on ppc64
Comment 18 Jeroen Roovers (RETIRED) gentoo-dev 2008-08-04 20:11:26 UTC
HPPA is OK for both.
Comment 19 Tobias Heinlein (RETIRED) gentoo-dev 2008-08-05 15:23:42 UTC
Fine on amd64.
Comment 20 Raúl Porcel (RETIRED) gentoo-dev 2008-08-06 13:02:41 UTC
Adding maekke for x86
Comment 21 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2008-08-06 17:02:30 UTC
I would not rate it A1 because of the very particular conditions needed to exploit this issue.

By the way, on Gentoo with /var/spool/mail having permissions 775 root:mail, it's only a (mail group) -> root privilege escalation. And, by default, the mail group contains no end-user. I'm even not sure Gentoo should be considered as affected.
Comment 22 Raúl Porcel (RETIRED) gentoo-dev 2008-08-06 17:15:39 UTC
Looks okay on alpha/ia64/x86
Comment 23 Robert Buchholz (RETIRED) gentoo-dev 2008-08-06 17:52:28 UTC
We could rerate it B1 due to the fact that it only affects mbox setups with users in the "mail" group or /var/mail being 01777. I would consider Gentoo affected because we do not discourage configurations that would be affected, even if they are not default.
Comment 24 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2008-08-13 13:50:11 UTC
(In reply to comment #23)
> We could rerate it B1 due to the fact that it only affects mbox setups with
> users in the "mail" group or /var/mail being 01777. 

OK for B1.

Comment 25 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2008-08-14 08:13:36 UTC
i'm ready to commit the stuff within a few hours. Every supported arch reported it's fine. Except ppc for which it has not been validated yet.

Thanks for your efficient work, everybody!
Comment 26 Tobias Scherbaum (RETIRED) gentoo-dev 2008-08-14 09:00:23 UTC
(In reply to comment #25)
> i'm ready to commit the stuff within a few hours. Every supported arch reported
> it's fine. Except ppc for which it has not been validated yet.
> 
> Thanks for your efficient work, everybody!
> 

*cough* of couse it has been validated for ppc :P so yeah, it's good to got for ppc ;)
Comment 27 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2008-08-14 12:22:22 UTC
opening to the public domain since it's now public
Comment 28 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2008-08-14 22:45:25 UTC
And GLSA 200808-12. Thanks for your good work everybody!
Comment 29 Robert Buchholz (RETIRED) gentoo-dev 2008-10-18 19:10:17 UTC
*** Bug 242638 has been marked as a duplicate of this bug. ***
Comment 30 hexa 2008-10-23 13:22:23 UTC
Hi,

i have 2.4.9 and glsa-check still reports it as vulnerable.

c1 etc # glsa-check -l | grep "\[N"
[A] means this GLSA was already applied,
[U] means the system is not affected and
[N] indicates that the system might be affected.

200808-12 [N] Postfix: Local privilege escalation vulnerability ( mail-mta/postfix )

c1 etc # equery l postfix
[ Searching for package 'postfix' in all categories among: ]
 * installed packages
[I--] [  ] mail-mta/postfix-2.4.9 (0)

Comment 31 Robert Buchholz (RETIRED) gentoo-dev 2008-10-23 13:49:12 UTC
corrected, thanks.