Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 638108 (CVE-2014-16844) - <mail-filter/procmail-3.22-r14: heap overflow in formail tool
Summary: <mail-filter/procmail-3.22-r14: heap overflow in formail tool
Status: RESOLVED FIXED
Alias: CVE-2014-16844
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL: https://cve.mitre.org/cgi-bin/cvename...
Whiteboard: B3 [noglsa cve]
Keywords:
: CVE-2017-16844 (view as bug list)
Depends on: 681978
Blocks: CVE-2014-3618 EAPI0Removal
  Show dependency tree
 
Reported: 2017-11-19 09:49 UTC by Attila Tóth
Modified: 2019-05-18 21:40 UTC (History)
11 users (show)

See Also:
Package list:
mail-filter/procmail-3.22-r14
Runtime testing required: No
stable-bot: sanity-check+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Tóth 2017-11-19 09:49:44 UTC
Jakub Wilk reported a heap-based buffer overflow vulnerability in procmail's formail utility when processing specially-crafted email headers. A remote attacker could use this flaw to cause formail to crash, resulting in a denial of service or data loss.

Reproducible: Always




Patch attached to the associated Debian bug [DSA 4041-1] works:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876511
https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=876511;filename=formisc.c.patch.txt;msg=10

Please take care of this on top of https://bugs.gentoo.org/522114. At least it is just a recent discovery, not 3 years old.
Comment 1 Christopher Díaz Riveros (RETIRED) gentoo-dev Security 2017-11-19 17:49:33 UTC
@Maintainers please call for stabilization when ready.

Thank you
Comment 2 Aaron Bauman (RETIRED) gentoo-dev 2019-03-23 23:51:12 UTC
*** Bug 638112 has been marked as a duplicate of this bug. ***
Comment 3 Larry the Git Cow gentoo-dev 2019-03-24 00:26:17 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31e0e8db9e641bbe158add9c6d4907f2c3eb2d57

commit 31e0e8db9e641bbe158add9c6d4907f2c3eb2d57
Author:     Aaron Bauman <bman@gentoo.org>
AuthorDate: 2019-03-24 00:22:31 +0000
Commit:     Aaron Bauman <bman@gentoo.org>
CommitDate: 2019-03-24 00:26:04 +0000

    mail-filter/procmail: revbump to fix longstanding vulnerabilities
    
    This patch is a combination of patches from the OSS ML and the Debian
    bug tracker.  Both patches and authors can be found in the below
    referenced bugs.
    
    Bug: https://bugs.gentoo.org/522114
    Bug: https://bugs.gentoo.org/638108
    Signed-off-by: Aaron Bauman <bman@gentoo.org>

 .../files/procmail-CVE-2014-3618-16844.patch       |  25 +++++
 mail-filter/procmail/procmail-3.22-r12.ebuild      | 123 +++++++++++++++++++++
 2 files changed, 148 insertions(+)
Comment 4 Aaron Bauman (RETIRED) gentoo-dev 2019-03-24 00:28:37 UTC
@arches, please stabilize
Comment 5 Larry the Git Cow gentoo-dev 2019-03-24 12:02:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2d543e5e060df0597801b48334e0c4d880d1f25

commit c2d543e5e060df0597801b48334e0c4d880d1f25
Author:     Richard Freeman <rich0@gentoo.org>
AuthorDate: 2019-03-24 12:02:27 +0000
Commit:     Richard Freeman <rich0@gentoo.org>
CommitDate: 2019-03-24 12:02:27 +0000

    mail-filter/procmail: amd64 stable
    
    Bug: https://bugs.gentoo.org/638108
    Signed-off-by: Richard Freeman <rich0@gentoo.org>
    Package-Manager: Portage-2.3.62, Repoman-2.3.11

 mail-filter/procmail/procmail-3.22-r12.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2019-03-24 19:55:41 UTC
ia64 stable
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2019-03-24 20:32:53 UTC
ppc stable
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2019-03-24 20:36:17 UTC
ppc64 stable
Comment 9 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-03-25 11:48:56 UTC
s390 stable
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2019-03-25 23:13:28 UTC
hppa stable
Comment 11 George L. Emigh 2019-03-26 21:35:05 UTC
Just an FYI.


I'm on amd64, mail-filter/procmail-3.22-r12 hangs on incoming mail with 1 cpu at 100%.

Went back to mail-filter/procmail-3.22-r10 and all is good again.


(In reply to Larry the Git Cow from comment #5)

> 
>     mail-filter/procmail: amd64 stable
>
Comment 12 Aaron Bauman (RETIRED) gentoo-dev 2019-03-26 22:40:08 UTC
stopping stabilization.  This is the second report of procmail hanging (our own infra as well)
Comment 13 Rolf Eike Beer archtester 2019-03-27 19:29:26 UTC
sparc done
Comment 14 Larry the Git Cow gentoo-dev 2019-03-28 00:44:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=038c9f3140b69054f3de9cb4f1a6ccf292510952

commit 038c9f3140b69054f3de9cb4f1a6ccf292510952
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-28 00:44:20 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-28 00:44:20 +0000

    mail-filter/procmail: re-add security fix with crash fix
    
    Bug: https://bugs.gentoo.org/638108
    Package-Manager: Portage-2.3.62, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 .../procmail/files/procmail-3.22-crash-fix.patch   |  58 ++++++++++
 mail-filter/procmail/procmail-3.22-r13.ebuild      | 125 +++++++++++++++++++++
 2 files changed, 183 insertions(+)
Comment 15 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-03-28 07:00:51 UTC
amd64 stable
Comment 16 A Blamey 2019-03-28 09:32:03 UTC
I just had formail hang with -r13 - same as happened with -r12
Comment 17 Ed Santiago 2019-03-28 11:53:49 UTC
Has anyone considered that this part of procmail-CVE-2014-3618-16844.patch :

    -       do
    +       while(*start);

...might not exactly be having the desired effect? The lack of braces makes this code fragile and hard to maintain, but here's a way to visualize what this patch is doing:

    -    do { ... } while (condition);
    +    while (condition)
    +        ;        <------ that is, infinite loop
    +    { ...will never get here... }

The simple fix is to remove the semicolon. A better fix would add slight reformatting to make that code readable and maintainable.

Addressing the lack of error checking in realloc() in the second part of the patch is beyond the scope of this comment.
Comment 18 Richard Freeman gentoo-dev 2019-03-30 12:35:06 UTC
Indeed, upon closer examination the debian patch does not have the ;.  This was what I've been running without issue for the last 1.5 years against the previous ebuild.
Comment 19 Attila Tóth 2019-03-30 14:12:26 UTC
(In reply to Richard Freeman from comment #18)
> Indeed, upon closer examination the debian patch does not have the ;.  This
> was what I've been running without issue for the last 1.5 years against the
> previous ebuild.

I'm also using a version without the semicolon.
Comment 20 Larry the Git Cow gentoo-dev 2019-03-30 17:03:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff36e4f6862f3949e3bfedd7bb352cd9d0602ffe

commit ff36e4f6862f3949e3bfedd7bb352cd9d0602ffe
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-30 17:02:56 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-30 17:02:56 +0000

    mail-filter/procmail: replace patch for CVE-2014-3618
    
    Fixes an infinite loop.
    
    Bug: https://bugs.gentoo.org/638108
    Package-Manager: Portage-2.3.62, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 .../files/procmail-3.22-CVE-2014-3618.patch        | 18 ++++++++++++++++
 .../files/procmail-3.22-CVE-2017-16844.patch       | 13 +++++++++++
 .../files/procmail-CVE-2014-3618-16844.patch       | 25 ----------------------
 ...il-3.22-r13.ebuild => procmail-3.22-r14.ebuild} |  3 ++-
 4 files changed, 33 insertions(+), 26 deletions(-)
Comment 21 Thomas Deutschmann (RETIRED) gentoo-dev 2019-04-02 01:39:54 UTC
x86 stable
Comment 22 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-02 09:40:02 UTC
arm stable
Comment 23 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-02 09:40:28 UTC
alpha stable
Comment 24 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:35:57 UTC
ppc stable
Comment 25 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:36:15 UTC
ppc64 stable
Comment 26 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:36:39 UTC
sparc stable
Comment 27 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:36:59 UTC
hppa stable
Comment 28 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:37:40 UTC
ia64 stable
Comment 29 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:37:59 UTC
s390 stable
Comment 30 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2019-04-06 16:38:16 UTC
sh stable