exim.git
3 years agoCVE-2020-28015+28021: New-line injection into spool header file
Qualys Security Advisory [Mon, 22 Feb 2021 05:26:53 +0000 (21:26 -0800)]
CVE-2020-28015+28021: New-line injection into spool header file

(cherry picked from commit 31b1a42d0bd29cb05f85e56d3343b13bef20a2bd)
(cherry picked from commit fcddccd650178ceeec3655c6c40f420164a8706e)

3 years agoCVE-2020-28026: Line truncation and injection in spool_read_header()
Heiko Schlittermann (HS12-RIPE) [Tue, 30 Mar 2021 20:03:49 +0000 (22:03 +0200)]
CVE-2020-28026: Line truncation and injection in spool_read_header()

This also fixes:

2/ In src/spool_in.c:

 462   while (  (len = Ustrlen(big_buffer)) == big_buffer_size-1
 463         && big_buffer[len-1] != '\n'
 464         )
 465     {   /* buffer not big enough for line; certs make this possible */
 466     uschar * buf;
 467     if (big_buffer_size >= BIG_BUFFER_SIZE*4) goto SPOOL_READ_ERROR;
 468     buf = store_get_perm(big_buffer_size *= 2, FALSE);
 469     memcpy(buf, big_buffer, --len);

The --len in memcpy() chops off a useful byte (we know for sure that
big_buffer[len-1] is not a '\n' because we entered the while loop).

Based on a patch done by Qualys.

(cherry picked from commit f0c307458e1ee81abbe7ed2d4a8d16b5cbd8a799)
(cherry picked from commit 4daba4bec729a57fb0863af786a1395e70794c76)

3 years agoCVE-2020-28022: Heap out-of-bounds read and write in extract_option()
Heiko Schlittermann (HS12-RIPE) [Mon, 29 Mar 2021 21:12:02 +0000 (23:12 +0200)]
CVE-2020-28022: Heap out-of-bounds read and write in extract_option()

Based on Phil Pennock's commit c5017adf.

(cherry picked from commit 9e941e1807b624b255c9ec0f41a0b3a89e144de3)
(cherry picked from commit 33d4c87653ddbbea9fd8cb8eb2ff78c149850006)

3 years agoCVE-2020-28017: Integer overflow in receive_add_recipient()
Heiko Schlittermann (HS12-RIPE) [Mon, 29 Mar 2021 21:05:58 +0000 (23:05 +0200)]
CVE-2020-28017: Integer overflow in receive_add_recipient()

Based on Phil Pennock's commit e3b441f7.

(cherry picked from commit 18a19e18242edc5ab2082fa9c41cd6210d1b6087)
(cherry picked from commit 605716b999a4ca6c7d5777ab7463058e9b055dc2)

3 years agoSECURITY: Refuse negative and large store allocations
Heiko Schlittermann (HS12-RIPE) [Mon, 29 Mar 2021 21:02:34 +0000 (23:02 +0200)]
SECURITY: Refuse negative and large store allocations

Based on Phil Pennock's commits b34d3046 and e6c1606a.  Done by Qualys.

(cherry picked from commit 09d36bd64fc5bf71d8882af35c41ac4e8599acc1)
(cherry picked from commit f9c58fb385343b8e3fa13988efcbd30ae3285ea7)

3 years agoCVE-2020-28013: Heap buffer overflow in parse_fix_phrase()
Heiko Schlittermann (HS12-RIPE) [Mon, 29 Mar 2021 20:44:47 +0000 (22:44 +0200)]
CVE-2020-28013: Heap buffer overflow in parse_fix_phrase()

Based on Phil Pennock's 8a50c88a, done by Qualys

(cherry picked from commit 8161c16ec7320ac6164954bade23179a0ed095eb)
(cherry picked from commit 71585e8fcb8704a9f431f5a8d019280cccaad069)

3 years agoCVE-2020-28011: Heap buffer overflow in queue_run()
Qualys Security Advisory [Mon, 22 Feb 2021 03:22:33 +0000 (19:22 -0800)]
CVE-2020-28011: Heap buffer overflow in queue_run()

(cherry picked from commit 6e1fb878e95f8e6f838ffde5258c7a969c981865)
(cherry picked from commit 08102cbe8102f99b31655aa0e926c45b427efe6d)

3 years agoCVE-2020-28010: Heap out-of-bounds write in main()
Heiko Schlittermann (HS12-RIPE) [Mon, 29 Mar 2021 20:16:28 +0000 (22:16 +0200)]
CVE-2020-28010: Heap out-of-bounds write in main()

Based on Phil Pennock's 0f57feb4. Done by Qualys, modified by me.

(cherry picked from commit b0982c2776048948ebae48574b70fa487684cb8c)
(cherry picked from commit dbc3ab675c2e5e2a07ed13dc5ede4daa018600e7)

3 years agoCVE-2020-28018: Use-after-free in tls-openssl.c
Qualys Security Advisory [Mon, 22 Feb 2021 03:05:56 +0000 (19:05 -0800)]
CVE-2020-28018: Use-after-free in tls-openssl.c

(cherry picked from commit 6290686dd59d8158d100c67e8f96df27158a6fc5)
(cherry picked from commit a53a7fcfb8216764e4420d8d263356b4ed7d5cef)

3 years agoCVE-2020-28025: Heap out-of-bounds read in pdkim_finish_bodyhash()
Qualys Security Advisory [Mon, 22 Feb 2021 02:54:16 +0000 (18:54 -0800)]
CVE-2020-28025: Heap out-of-bounds read in pdkim_finish_bodyhash()

(cherry picked from commit cad30cd3fb96196e908e0d66b1b45fdf377c850c)
(cherry picked from commit 1c261b90f627f0489f7dfcf1e66b46cce67f477d)

3 years agoCVE-2020-28014, CVE-2021-27216: PID file handling
Heiko Schlittermann (HS12-RIPE) [Thu, 25 Mar 2021 21:48:09 +0000 (22:48 +0100)]
CVE-2020-28014, CVE-2021-27216: PID file handling

Arbitrary PID file creation, clobbering, and deletion.
Patch provided by Qualys.

(cherry picked from commit 974f32939a922512b27d9f0a8a1cb5dec60e7d37)
(cherry picked from commit 43c6f0b83200b7082353c50187ef75de3704580a)

3 years agoAdd priv.c: reworked version of priv dropping code
Heiko Schlittermann (HS12-RIPE) [Wed, 10 Mar 2021 22:37:29 +0000 (23:37 +0100)]
Add priv.c: reworked version of priv dropping code

(cherry picked from commit 82b545236e6dc82b7af34528c532811bfc74ea19)
(cherry picked from commit be31ef213f118abe5fc68732f5492b6b16d28b87)

3 years agoCVE-2020-28008: Assorted attacks in Exim's spool directory
Heiko Schlittermann (HS12-RIPE) [Sun, 14 Mar 2021 11:16:57 +0000 (12:16 +0100)]
CVE-2020-28008: Assorted attacks in Exim's spool directory

We patch dbfn_open() by introducing two functions priv_drop_temp() and
priv_restore() (inspired by OpenSSH's functions temporarily_use_uid()
and restore_uid()), which temporarily drop and restore root privileges
thanks to seteuid(). This goes against Exim's developers' wishes ("Exim
(the project) doesn't trust seteuid to work reliably") but, to the best
of our knowledge, seteuid() works everywhere and is the only way to
securely fix dbfn_open().

(cherry picked from commit 18da59151dbafa89be61c63580bdb295db36e374)
(cherry picked from commit b05dc3573f4cd476482374b0ac0393153d344338)

3 years agoCVE-2020-28019: Failure to reset function pointer after BDAT error
Jeremy Harris [Thu, 4 Mar 2021 21:19:08 +0000 (22:19 +0100)]
CVE-2020-28019: Failure to reset function pointer after BDAT error

Based on Phil Pennock's commits 4715403e and 151ffd72, and Jeremy
Harris's commits aa171254 and 9aceb5c2.

(cherry picked from commit 0a3fbb7e3be375bc93b8e359c6aff333c7c2d76f)
(cherry picked from commit 99d057fad97a2def9f000ebccda83e4008112819)

3 years agoSECURITY: smtp_out: Leave a clean input buffer, even in case of read error
Heiko Schlittermann (HS12-RIPE) [Wed, 2 Dec 2020 21:28:02 +0000 (22:28 +0100)]
SECURITY: smtp_out: Leave a clean input buffer, even in case of read error

Credits: Qualys

  7/ In src/smtp_out.c, read_response_line(), inblock->ptr is not updated
  when -1 is returned. This does not seem to have bad consequences, but is
  maybe not the intended behavior.

(cherry picked from commit f7ac5a7d1e817bf60f161e7a1d40b65d66da607f)
(cherry picked from commit 13f9998ebb937970d1d9d18f205a6e03e14105b4)

3 years agoSECURITY: Avoid modification of constant data
Heiko Schlittermann (HS12-RIPE) [Thu, 26 Nov 2020 17:16:59 +0000 (18:16 +0100)]
SECURITY: Avoid modification of constant data

Credits: Qualys

    6/ In src/pdkim/pdkim.c, pdkim_update_ctx_bodyhash() is sometimes called
    with a global orig_data and hence canon_data, and the following line can
    therefore modify data that should be constant:

     773   canon_data->len = b->bodylength - b->signed_body_bytes;

    For example, the following proof of concept sets lineending.len to 0
    (this should not be possible):

    (sleep 10; echo 'EHLO test'; sleep 3; echo 'MAIL FROM:<>'; sleep 3; echo 'RCPT TO:postmaster'; sleep 3; echo 'DATA'; date >&2; sleep 30; printf 'DKIM-Signature:a=rsa-sha1;c=simple/simple;l=0\r\n\r\n\r\nXXX\r\n.\r\n'; sleep 30) | nc -n -v 192.168.56.102 25

    (gdb) print lineending
    $1 = {data = 0x55e18035b2ad "\r\n", len = 2}
    (gdb) print &lineending.len
    $3 = (size_t *) 0x55e180385948 <lineending+8>
    (gdb) watch *(size_t *) 0x55e180385948

    Hardware watchpoint 1: *(size_t *) 0x55e180385948
    Old value = 2
    New value = 0
    (gdb) print lineending
    $5 = {data = 0x55e18035b2ad "\r\n", len = 0}

(cherry picked from commit 9fce76f56459dde7489eb21ce1ff822e04e10f43)
(cherry picked from commit 667fb25b8f0dc3fbac57bce4051e345555fa776a)

3 years agoSECURITY: Avoid memory corruption in dkim handling
Heiko Schlittermann (HS12-RIPE) [Wed, 25 Nov 2020 22:19:57 +0000 (23:19 +0100)]
SECURITY: Avoid memory corruption in dkim handling

Credits: Qualys

    6/ In src/pdkim/pdkim.c, pdkim_update_ctx_bodyhash() is sometimes called
    with a global orig_data and hence canon_data, and the following line can
    therefore modify data that should be constant:

     773   canon_data->len = b->bodylength - b->signed_body_bytes;

    For example, the following proof of concept sets lineending.len to 0
    (this should not be possible):

    (sleep 10; echo 'EHLO test'; sleep 3; echo 'MAIL FROM:<>'; sleep 3; echo 'RCPT TO:postmaster'; sleep 3; echo 'DATA'; date >&2; sleep 30; printf 'DKIM-Signature:a=rsa-sha1;c=simple/simple;l=0\r\n\r\n\r\nXXX\r\n.\r\n'; sleep 30) | nc -n -v 192.168.56.102 25

    (gdb) print lineending
    $1 = {data = 0x55e18035b2ad "\r\n", len = 2}
    (gdb) print &lineending.len
    $3 = (size_t *) 0x55e180385948 <lineending+8>
    (gdb) watch *(size_t *) 0x55e180385948

    Hardware watchpoint 1: *(size_t *) 0x55e180385948
    Old value = 2
    New value = 0
    (gdb) print lineending
    $5 = {data = 0x55e18035b2ad "\r\n", len = 0}

(cherry picked from commit ea850e27714ccda2090d781ebe89b410bc38c2c6)
(cherry picked from commit 4e784efa28b25683c81a857b464777df593cabee)

3 years agoSECURITY: Avoid decrement of dkim_collect_input if already at 0
Heiko Schlittermann (HS12-RIPE) [Wed, 25 Nov 2020 21:58:58 +0000 (22:58 +0100)]
SECURITY: Avoid decrement of dkim_collect_input if already at 0

Credits: Qualys

    5/ receive_msg() calls dkim_exim_verify_finish(), which sets
    dkim_collect_input to 0 and calls pdkim_feed_finish(), which calls
    pdkim_header_complete(), which decreases dkim_collect_input to UINT_MAX,
    which reactivates the DKIM code.

    As a result, pdkim_feed() is called again (through receive_getc at the
    end of receive_msg()), but functions like pdkim_finish_bodyhash() and
    exim_sha_finish() have already been called (in pdkim_feed_finish()).
    This suggests a use-after-free.

    But it seems that a use-after-free would happen only with
    EVP_DigestFinal() (in exim_sha_finish()), which does not seem to be
    reachable via DKIM (no SHA3). But we checked OpenSSL only, not GnuTLS.

    Here is a proof of concept that triggers the bug (which came very close
    to a security vulnerability):

    (sleep 10; echo 'EHLO test'; sleep 3; echo 'MAIL FROM:<>'; sleep 3; echo 'RCPT TO:postmaster'; sleep 3; echo 'BDAT 42 LAST'; date >&2; sleep 30; printf 'not a valid header line\r\nDKIM-Signature:\r\nXXX'; sleep 30) | nc -n -v 192.168.56.102 25

    (gdb) print &dkim_collect_input
    $2 = (unsigned int *) 0x55e180386d90 <dkim_collect_input>
    (gdb) watch *(unsigned int *) 0x55e180386d90

    Hardware watchpoint 1: *(unsigned int *) 0x55e180386d90
    Old value = 0
    New value = 4294967295
    #0  0x000055e18031f805 in pdkim_header_complete (ctx=ctx@entry=0x55e181b9e8e0) at pdkim.c:1006
    #1  0x000055e18032106c in pdkim_feed_finish (ctx=0x55e181b9e8e0, return_signatures=0x55e180386d78 <dkim_signatures>, err=err@entry=0x7ffe443e1d00) at pdkim.c:1490
    #2  0x000055e1802a3280 in dkim_exim_verify_finish () at dkim.c:328
    #3  0x000055e1802c9d1d in receive_msg (extract_recip=extract_recip@entry=0) at receive.c:3409

(cherry picked from commit e3674091056ac05eb7ef1c504accce790c434bd7)
(cherry picked from commit 8b39dd074e3ec70cbda70a52cef5b71ecbf69499)

3 years agoSECURITY: Check overrun rcpt_count integer
Heiko Schlittermann (HS12-RIPE) [Wed, 25 Nov 2020 21:26:53 +0000 (22:26 +0100)]
SECURITY: Check overrun rcpt_count integer

Credits: Qualys

    4/ In src/smtp_in.c:

    4966     case RCPT_CMD:
    4967       HAD(SCH_RCPT);
    4968       rcpt_count++;
    ....
    5123       if (rcpt_count > recipients_max && recipients_max > 0)

    In theory this recipients_max check can be bypassed, because the int
    rcpt_count can overflow (become negative). In practice this would either
    consume too much memory or generate too much network traffic, but maybe
    it should be fixed anyway.

(cherry picked from commit 04139ca809fbe56d8fe9c55a77640ea9fa93b8f1)
(cherry picked from commit db96ca55137d7684a9afdf9d118feed9116906b7)

3 years agoSECURITY: Fix safeguard against upward traversal in msglog files.
Heiko Schlittermann (HS12-RIPE) [Sat, 21 Nov 2020 21:41:28 +0000 (22:41 +0100)]
SECURITY: Fix safeguard against upward traversal in msglog files.

Credits: Qualys

    3/ In src/deliver.c:

     333 static int
     334 open_msglog_file(uschar *filename, int mode, uschar **error)
     335 {
     336 if (Ustrstr(filename, US"/../"))
     337   log_write(0, LOG_MAIN|LOG_PANIC,
     338     "Attempt to open msglog file path with upward-traversal: '%s'\n", filename);

    Should this be LOG_PANIC_DIE instead of LOG_PANIC? Right now it will log
    the /../ attempt but will open the file anyway.

(cherry picked from commit 742c27f02d83792937dcb1719b380d3dde6228bf)
(cherry picked from commit 1e9a340c05d7233969637095a8a6378b14de2976)

3 years agoSECURITY: Don't miss the very last byte when reading long lines from -H
Heiko Schlittermann (HS12-RIPE) [Sat, 21 Nov 2020 21:18:56 +0000 (22:18 +0100)]
SECURITY: Don't miss the very last byte when reading long lines from -H

Credits: Qualys

    2/ In src/spool_in.c:

     462   while (  (len = Ustrlen(big_buffer)) == big_buffer_size-1
     463         && big_buffer[len-1] != '\n'
     464         )
     465     {   /* buffer not big enough for line; certs make this possible */
     466     uschar * buf;
     467     if (big_buffer_size >= BIG_BUFFER_SIZE*4) goto SPOOL_READ_ERROR;
     468     buf = store_get_perm(big_buffer_size *= 2, FALSE);
     469     memcpy(buf, big_buffer, --len);

    The --len in memcpy() chops off a useful byte (we know for sure that
    big_buffer[len-1] is not a '\n' because we entered the while loop).

(cherry picked from commit 58454ea01c2e817481770954edf09ad82f3cd417)
(cherry picked from commit 2d9f1837bdd6c5946cb9cd997544eefc8cc14fc4)

3 years agoSECURITY: off-by-one in smtp transport (read response)
Heiko Schlittermann (HS12-RIPE) [Sat, 21 Nov 2020 21:03:03 +0000 (22:03 +0100)]
SECURITY: off-by-one in smtp transport (read response)

Credits: Qualys

    1/ In src/transports/smtp.c:

    2281       int n = sizeof(sx->buffer);
    2282       uschar * rsp = sx->buffer;
    2283
    2284       if (sx->esmtp_sent && (n = Ustrlen(sx->buffer)) < sizeof(sx->buffer)/2)
    2285         { rsp = sx->buffer + n + 1; n = sizeof(sx->buffer) - n; }

    This should probably be either:

    rsp = sx->buffer + n + 1; n = sizeof(sx->buffer) - n - 1;

    or:

    rsp = sx->buffer + n; n = sizeof(sx->buffer) - n;

    (not sure which) to avoid an off-by-one.

(cherry picked from commit d2c44ef5dd94f1f43ba1d1a02bc4594f4fba5e38)
(cherry picked from commit 4045cb01a590ec480f45f80967cd9c59fe23a5d0)

3 years agoStart documenting the things we changed incompatibly.
Phil Pennock [Mon, 2 Nov 2020 07:39:38 +0000 (02:39 -0500)]
Start documenting the things we changed incompatibly.

(cherry picked from commit 8dad4da53bad2ed3b29fa6a3b9ef59bfec73dc0e)
(cherry picked from commit 125f0d4afbc858cf514c29326a3016c2d9d7bdc1)

3 years agoInline four often-called new functions
Phil Pennock [Mon, 2 Nov 2020 07:23:14 +0000 (02:23 -0500)]
Inline four often-called new functions

The BDAT state switchers should happen so often during SMTP reception that a
compiler hint to inline seems wise.

The length filter checks happen on every start-up, which for Exim is often
enough that I think an inline these is warranted too.

(cherry picked from commit 6e3d0e3f1c8228ef19a3d1ba61f131cef3172ceb)
(cherry picked from commit 6ca5fcba34070f4495a0188f16eb2e4d78f3430a)

3 years agoFixes for compilation
Jeremy Harris [Sat, 31 Oct 2020 14:36:55 +0000 (14:36 +0000)]
Fixes for compilation

(cherry picked from commit 85a90771a373aaaced64b92d7176a8a310490b9e)
(cherry picked from commit da683a61556bbbebdffcbebf2668da58da59f898)

3 years agoSECURITY: rework BDAT receive function handling
Phil Pennock [Fri, 30 Oct 2020 03:21:36 +0000 (23:21 -0400)]
SECURITY: rework BDAT receive function handling

(cherry picked from commit dd1b9b753bb7c42df2b8f48d726b82928b67940b)
(cherry picked from commit 96fb195ebc2eb6790e6ad6dde46d478aee62198d)

3 years agoSECURITY: fix SMTP verb option parsing
Phil Pennock [Fri, 30 Oct 2020 02:40:59 +0000 (22:40 -0400)]
SECURITY: fix SMTP verb option parsing

A boundary case in looking for an opening quote before the closing quote could
walk off the front of the buffer.

(cherry picked from commit 515d8d43a18481d23d7cf410b8dc71b4e254ebb8)
(cherry picked from commit 467948de0c407bd2bbc2e84abbbf09f35b035538)

3 years agoSECURITY: Avoid integer overflow on too many recipients
Phil Pennock [Fri, 30 Oct 2020 01:48:05 +0000 (21:48 -0400)]
SECURITY: Avoid integer overflow on too many recipients

(cherry picked from commit 323ff55e67b44e95f9d3cfaba155e385aa33c4bd)
(cherry picked from commit 3a54fcd1e303bf1cc49beca7ceac35d7448860a9)

3 years agoSECURITY: default recipients_max to 50,000
Phil Pennock [Fri, 30 Oct 2020 01:38:25 +0000 (21:38 -0400)]
SECURITY: default recipients_max to 50,000

A default of "unlimited" can have unfortunate consequences when people start
putting many millions of recipients on a message.

(cherry picked from commit 1d7780722a66cea8da5fa4ae0775e85d185fbf7e)
(cherry picked from commit a6e1f69d82adcfd3caab8f228d96750dfddc8f07)

3 years agoSECURITY: a second negative store guard
Phil Pennock [Fri, 30 Oct 2020 01:30:04 +0000 (21:30 -0400)]
SECURITY: a second negative store guard

(cherry picked from commit 706864e934c70941ce7a327f97b7649a1e5f5556)
(cherry picked from commit 9f06dcd6848052f2524658bf871c60a8d48c7dbe)

3 years agoSECURITY: refuse too small store allocations
Phil Pennock [Fri, 30 Oct 2020 00:49:49 +0000 (20:49 -0400)]
SECURITY: refuse too small store allocations

Negative sizes are definitely bad.
Optimistically, I'm saying that zero is bad too.  But perhaps we have something
doing that, expecting to be able to grow.  In which case we'll have to amend
this.

(cherry picked from commit 1c9afcec0043e2fb72607b2addb0613763705549)
(cherry picked from commit 6f5d7e5af8eff688c36f81334e4f063689561963)

3 years agoSECURITY: fix Qualys CVE-2020-PFPZA
Phil Pennock [Fri, 30 Oct 2020 00:42:40 +0000 (20:42 -0400)]
SECURITY: fix Qualys CVE-2020-PFPZA

(cherry picked from commit 29d7a8c25f182c91d5d30f124f9e296dce5c018e)
(cherry picked from commit 0a6a7a3fd8464bae9ce0cf889e8eeb0bf0bab756)

3 years agoSECURITY: fix Qualys CVE-2020-PFPSN
Phil Pennock [Thu, 29 Oct 2020 23:00:51 +0000 (19:00 -0400)]
SECURITY: fix Qualys CVE-2020-PFPSN

(cherry picked from commit 93b6044e1636404f3463f3e1113098742e295542)
(cherry picked from commit 4e59a5d5c448e1fcdcbead268ffe6561adf0224d)

3 years agoSECURITY: fix Qualys CVE-2020-SLCWD
Phil Pennock [Thu, 29 Oct 2020 15:47:58 +0000 (11:47 -0400)]
SECURITY: fix Qualys CVE-2020-SLCWD

(cherry picked from commit bf5f9d56fadf9be8d947f141d31f7e0e8fa63762)
(cherry picked from commit 6d2cfb575c95c1b81597d6b9eb2904cd695d7e4a)

3 years agoSECURITY: pick up more argv length checks
Phil Pennock [Thu, 29 Oct 2020 22:40:37 +0000 (18:40 -0400)]
SECURITY: pick up more argv length checks

(cherry picked from commit f28a6a502c7973d8844d11d4b0990d4b0359fb3f)
(cherry picked from commit 7a7136ba7f5c2db33c7e320ffd4675335c4557e5)

3 years agoSECURITY: length limits on many cmdline options
Phil Pennock [Thu, 29 Oct 2020 22:11:35 +0000 (18:11 -0400)]
SECURITY: length limits on many cmdline options

We'll also now abort upon, rather than silently truncate, a driver name
(router, transport, ACL, etc) encountered in the config which is longer than
the 64-char limit.

(cherry picked from commit ff8bef9ae2370db4a7873fe2ce573a607fe6999f)
(cherry picked from commit a8bd24b96c2027fd839f95a9e6b3282453ae288e)

3 years agoRe-ran the conversion of all DH parameters
Phil Pennock [Fri, 18 Sep 2020 14:25:42 +0000 (10:25 -0400)]
Re-ran the conversion of all DH parameters

I get different results now to those I got before.

Now, using gen_pkcs3 linked against OpenSSL 1.1.1f-1ubuntu2 on Focal Fossa, I
get the results below.  The ffdhe2048 value now matches that at
<https://ssl-config.mozilla.org/ffdhe2048.txt>.

I ran the same code yesterday for just the ffdhe2048 item and got code which
seemed to me then to match what was already in the C file.  Something hinky is
going on, perhaps with my sanity.

(the commit IDs changee because of heavy rebasing (heiko))

(cherry picked from commit 76ed8115182e2daaadb437ec9655df8000796ec5)
(cherry picked from commit 0aafa26a5d3d528e79476c91537c28936154fe04)

3 years agogen_pkcs3: Terminate string before calling BH_hex2bn()
Simon Arlott [Thu, 24 Sep 2020 22:03:14 +0000 (23:03 +0100)]
gen_pkcs3: Terminate string before calling BH_hex2bn()

Signed-off-by: Phil Pennock <pdp@exim.org>
(cherry picked from commit 1cf66e5872d517b620c308af634e4e26e3547f06)
(cherry picked from commit 48d8c54ecf9493c709d4305850877b6062f285a7)

3 years agoDefault config: reject on too many bad RCPT
Phil Pennock [Fri, 30 Oct 2020 02:14:45 +0000 (22:14 -0400)]
Default config: reject on too many bad RCPT

An example exploit failed against my system, because I had this sanity guard in
place; it's not a real security fix since a careful attacker could find enough
valid recipients to hit that problem, but it highlights that this is a useful
enough pattern that we should encourage its wider use.

(cherry picked from commit 2a636a39fff29b7c3da1798767a510dfed982a62)
(cherry picked from commit 346f96bad326893f9c1fa772a5b8ac35b1f8f7bd)

3 years agoHandle SIGINT as we do with SIGTERM
Heiko Schlittermann (HS12-RIPE) [Thu, 18 Mar 2021 06:56:59 +0000 (07:56 +0100)]
Handle SIGINT as we do with SIGTERM

(cherry picked from commit cdc5c672e1c309294626cd5ed90acdccb05baaa1)
(cherry picked from commit f9c8211fb0ad0dd362f471978a5e0abc5dfa71b4)

3 years agoEnforce pid_file_path start at "/"
Heiko Schlittermann (HS12-RIPE) [Thu, 18 Mar 2021 06:59:21 +0000 (07:59 +0100)]
Enforce pid_file_path start at "/"

(cherry picked from commit 60f2a8e797d9ebaea1e3eac4ad28ff64e11bab40)
(cherry picked from commit 6b3d553c733475a1033c8b7a241e6506d7ed73b1)

3 years agotestsuite: tidy logs/4520 and confs/4520
Heiko Schlittermann (HS12-RIPE) [Mon, 29 Mar 2021 16:17:55 +0000 (18:17 +0200)]
testsuite: tidy logs/4520 and confs/4520

This fixed 4520 failure en-passant, but I'm sure it's a timing issue
here (the order of the mainlog output lines didn't exactly match the
logs/4520)

(cherry picked from commit 95306ca61531d9d79c5dac808a5a571158acd29c)
(cherry picked from commit 0439d2e0566d64c84feaf1434e0e4a3fd8ce29b3)

3 years agotidy
Heiko Schlittermann (HS12-RIPE) [Tue, 16 Mar 2021 22:44:29 +0000 (23:44 +0100)]
tidy

(cherry picked from commit 7973b58af7db0fb8fddb54b366dcf43c7ce131ec)
(cherry picked from commit b7e726f6ae4c6f19e7efc4e6b10ec35e5b01368c)

3 years agoUse separate line in Received: header for timestamp
Jeremy Harris [Tue, 25 May 2021 00:35:43 +0000 (01:35 +0100)]
Use separate line in Received: header for timestamp

3 years agoDocs: assorted fixes
u34 [Sun, 9 May 2021 09:34:07 +0000 (11:34 +0200)]
Docs: assorted fixes

Closes 2752
Closes 2753
Closes 2658
Closes 2659
Closes 2712
Closes 2720
Closes 2721
Closes 2722
Closes 2746
Closes 2748
Closes 2749

3 years agoDocs: typo
Heiko Schlittermann (HS12-RIPE) [Sun, 18 Oct 2020 19:28:18 +0000 (21:28 +0200)]
Docs: typo

3 years agoFix host_name_lookup (Close 2747)
Heiko Schlittermann (HS12-RIPE) [Sun, 16 May 2021 17:11:19 +0000 (19:11 +0200)]
Fix host_name_lookup (Close 2747)

Thanks to Nico R for providing a reproducing configuration.

        host_lookup             = *
        message_size_limit      = ${if def:sender_host_name {32M}{32M}}
        acl_smtp_connect        = acl_smtp_connect
        acl_smtp_rcpt           = acl_smtp_rcpt

        begin acl
          acl_smtp_connect:
                warn ratelimit = 256 / 1m / per_conn
                accept

          acl_smtp_rcpt:
                accept hosts = 127.0.0.*

        begin routers
        null:
          driver          = accept
          transport       = null

        begin transports
        null:
          driver          = appendfile
          file            = /dev/null

Tested with

        swaks -f mailbox@example.org -t mailbox@example.org --pipe 'exim -bh 127.0.0.1 -C /opt/exim/etc/exim-bug.conf'

The IP must have a PTR to "localhost." to reproduce it.

(cherry picked from commit 20812729e3e47a193a21d326ecd036d67a8b2724)

3 years agoNamed Queues: fix immediate-delivery. Bug 2743
Jeremy Harris [Wed, 12 May 2021 14:01:12 +0000 (15:01 +0100)]
Named Queues: fix immediate-delivery.  Bug 2743

3 years agoOpenBSD: remove redundant platform define
Jeremy Harris [Tue, 11 May 2021 12:51:22 +0000 (13:51 +0100)]
OpenBSD: remove redundant platform define

3 years agoTLS DANE to multiple recipients w/ different DNSSec status
Heiko Schlittermann (HS12-RIPE) [Tue, 11 May 2021 08:48:17 +0000 (10:48 +0200)]
TLS DANE to multiple recipients w/ different DNSSec status

3 years agoFix DANE + SNI handling (Bug 2265)
Heiko Schlittermann (HS12-RIPE) [Mon, 3 May 2021 13:53:28 +0000 (15:53 +0200)]
Fix DANE + SNI handling (Bug 2265)

Broken in d8e99d6047e709b35eabb1395c2046100d1a1dda
Thanks to JGH and Wolfgang Breyha for contributions.

(cherry picked from commit e8ac8be0a3d56ba0a189fb970c339ac6e84769be)

3 years agoDNS: Better handling of SOA when negative-caching lookups
Jeremy Harris [Sat, 8 May 2021 22:07:34 +0000 (23:07 +0100)]
DNS: Better handling of SOA when negative-caching lookups

3 years agowip
Jeremy Harris [Wed, 5 May 2021 19:14:47 +0000 (20:14 +0100)]
wip

3 years agoDebug: output dmarc library version
Jeremy Harris [Tue, 4 May 2021 15:08:18 +0000 (16:08 +0100)]
Debug: output dmarc library version

3 years agoFix ${ipv6norm:}
Jeremy Harris [Tue, 4 May 2021 12:06:31 +0000 (13:06 +0100)]
Fix ${ipv6norm:}

3 years agoDocs: typo. Closes 2713
Heiko Schlittermann (HS12-RIPE) [Tue, 27 Apr 2021 07:31:49 +0000 (09:31 +0200)]
Docs: typo. Closes 2713

3 years agotidying
Jeremy Harris [Sun, 14 Mar 2021 12:54:11 +0000 (12:54 +0000)]
tidying

3 years agoTestsuite: tidying
Jeremy Harris [Sun, 25 Apr 2021 16:24:31 +0000 (17:24 +0100)]
Testsuite: tidying

3 years agoTaint: enforce untainted ACL text line
Jeremy Harris [Sun, 25 Apr 2021 12:02:01 +0000 (13:02 +0100)]
Taint: enforce untainted ACL text line

3 years agoFix time usage on non-subtick-resolution platforms
Simon Arlott [Wed, 21 Apr 2021 16:11:13 +0000 (17:11 +0100)]
Fix time usage on non-subtick-resolution platforms

3 years agoDocs: note caching of auto-generated server certificate
Jeremy Harris [Sun, 18 Apr 2021 21:37:10 +0000 (22:37 +0100)]
Docs: note caching of auto-generated server certificate

3 years agoExperimental: ESMTP LIMITS extension
Jeremy Harris [Sun, 18 Apr 2021 00:51:28 +0000 (01:51 +0100)]
Experimental: ESMTP LIMITS extension

3 years agoTestsuite: output changes arising
Jeremy Harris [Sat, 17 Apr 2021 23:34:32 +0000 (00:34 +0100)]
Testsuite: output changes arising

Somewhere recently (possibly 3f06b9b4c7) we stopped overwriting errno;
the "Permission denied" seen now in 4520 for the ${bogus} expansion is
as expected.

3 years agoLog queue_time and queue_time_overall exclusive of receive time. Bug 2672
Jeremy Harris [Sun, 11 Apr 2021 15:39:06 +0000 (16:39 +0100)]
Log queue_time and queue_time_overall exclusive of receive time.  Bug 2672

3 years ago taint: allow appendfile create_file option to specify a de-tainting safe path
Jeremy Harris [Wed, 14 Apr 2021 21:21:05 +0000 (22:21 +0100)]
taint: allow appendfile create_file option to specify a de-tainting safe path

3 years agoSet mainlog_name and rejectlog_name unconditionally.
Heiko Schlittermann (HS12-RIPE) [Mon, 12 Apr 2021 06:41:44 +0000 (08:41 +0200)]
Set mainlog_name and rejectlog_name unconditionally.

3 years agoLogging: better tracking of continued-connection use
Jeremy Harris [Sat, 10 Apr 2021 18:36:17 +0000 (19:36 +0100)]
Logging: better tracking of continued-connection use

3 years agoPass proxy addresses/ports to continued trasnports. Bug 2710
Jeremy Harris [Wed, 7 Apr 2021 20:34:42 +0000 (21:34 +0100)]
Pass proxy addresses/ports to continued trasnports.  Bug 2710

3 years agoDocs: add warning note on ${listnamed:} operator
Jeremy Harris [Mon, 5 Apr 2021 20:23:10 +0000 (21:23 +0100)]
Docs: add warning note on ${listnamed:} operator

3 years agoDocs: mention *_environment in "Misc" section"
Heiko Schlittermann (HS12-RIPE) [Mon, 5 Apr 2021 06:24:19 +0000 (08:24 +0200)]
Docs: mention *_environment in "Misc" section"

3 years agoDisable server-side close timing sophistication on MacOS
Jeremy Harris [Mon, 5 Apr 2021 12:41:50 +0000 (13:41 +0100)]
Disable server-side close timing sophistication on MacOS

Broken-by: 001bf8f587
3 years agoDocs: add example for DKIM dual-signing
Jeremy Harris [Mon, 5 Apr 2021 12:06:42 +0000 (13:06 +0100)]
Docs: add example for DKIM dual-signing

3 years agoTLS: harden error-detection in TLS proxy process
Jeremy Harris [Sat, 3 Apr 2021 19:56:50 +0000 (20:56 +0100)]
TLS: harden error-detection in TLS proxy process

3 years agoMake smtp_accept_max_per_connection expanded
Jeremy Harris [Fri, 19 Mar 2021 20:42:25 +0000 (20:42 +0000)]
Make smtp_accept_max_per_connection expanded

3 years agotestsuite: fix runtest (File::Copy used in another place)
Heiko Schlittermann (HS12-RIPE) [Sat, 3 Apr 2021 08:55:03 +0000 (10:55 +0200)]
testsuite: fix runtest (File::Copy used in another place)

3 years agobuild: Allow environment EXIM_RELEASE_VERSION
Heiko Schlittermann (HS12-RIPE) [Fri, 2 Apr 2021 10:37:15 +0000 (12:37 +0200)]
build: Allow environment EXIM_RELEASE_VERSION

This should easy automated testing where no .git directory
is available (as is happens with git worktrees)

Setting this environment variable makes the reversion script
using it instead of searching for version.sh or using `git describe`.

3 years agoDocs: clarify list-separator requirements
Jeremy Harris [Fri, 2 Apr 2021 11:11:11 +0000 (12:11 +0100)]
Docs: clarify list-separator requirements

3 years agotypoes
Jeremy Harris [Wed, 31 Mar 2021 09:44:07 +0000 (10:44 +0100)]
typoes

3 years agotestsuite: provide cp() if File::Copy is too old.
Heiko Schlittermann (HS12-RIPE) [Thu, 1 Apr 2021 09:33:01 +0000 (11:33 +0200)]
testsuite: provide cp() if File::Copy is too old.

3 years agotestsuite: use File::Copy "cp" to copy the permissions (x-bit)
Heiko Schlittermann (HS12-RIPE) [Wed, 31 Mar 2021 20:46:27 +0000 (22:46 +0200)]
testsuite: use File::Copy "cp" to copy the permissions (x-bit)

3 years agotestsuite: add --fail-any option to runtest
Heiko Schlittermann (HS12-RIPE) [Sun, 28 Mar 2021 17:05:10 +0000 (19:05 +0200)]
testsuite: add --fail-any option to runtest

This option makes runtest's exit status !0 on any failure in any test.
(Useful in -c mode and git-bisect)

3 years agoMemory handling: fix size backoff on store-reset
Jeremy Harris [Sun, 28 Mar 2021 00:56:14 +0000 (00:56 +0000)]
Memory handling: fix size backoff on store-reset

3 years agoMemory debug: do not try to save allocation bytes used for debug as ACL can modify...
Jeremy Harris [Sat, 27 Mar 2021 23:49:50 +0000 (23:49 +0000)]
Memory debug: do not try to save allocation bytes used for debug as ACL can modify debugging status

3 years agotestsuite: make runtest exit(!0) on failure in continue mode
Heiko Schlittermann (HS12-RIPE) [Sat, 27 Mar 2021 11:52:18 +0000 (12:52 +0100)]
testsuite: make runtest exit(!0) on failure in continue mode

This makes it possible to use `runtest -c <xx>` for `git bisect run …`

3 years agotestsuite: tidy runtest
Heiko Schlittermann (HS12-RIPE) [Sat, 27 Mar 2021 11:51:40 +0000 (12:51 +0100)]
testsuite: tidy runtest

3 years agoGnuTLS: use a less bogus-looking temporary filename for DH-parameters
Jeremy Harris [Sat, 27 Mar 2021 17:00:13 +0000 (17:00 +0000)]
GnuTLS: use a less bogus-looking temporary filename for DH-parameters

3 years agoAvoid all tail-end pipelining on retries
Jeremy Harris [Tue, 23 Mar 2021 19:43:43 +0000 (19:43 +0000)]
Avoid all tail-end pipelining on retries

3 years agoBuild: use PHDRS set in the toplevel Makefile
Heiko Schlittermann (HS12-RIPE) [Thu, 25 Mar 2021 11:58:50 +0000 (12:58 +0100)]
Build: use PHDRS set in the toplevel Makefile

They're passed as HDRS, but the lookups/Makefile referenced the PHDRS
(which was empty)

E.g. touch src/functions.h didn't force a rebuild of the lookups.a

3 years agoAvoid building routines calling other not incuded in utilities link stage
Jeremy Harris [Tue, 23 Mar 2021 00:39:54 +0000 (00:39 +0000)]
Avoid building routines calling other not incuded in utilities link stage

This should fix a Solaris build error probably inserted by 92583637b2

3 years agoAvoid clearing first_delivery flag on the initial half of a 2-phase queue run
Jeremy Harris [Mon, 22 Mar 2021 21:47:42 +0000 (21:47 +0000)]
Avoid clearing first_delivery flag on the initial half of a 2-phase queue run

3 years agoBuiltin macros for Experimental features
Jeremy Harris [Fri, 19 Mar 2021 00:44:58 +0000 (00:44 +0000)]
Builtin macros for Experimental features

3 years agoDNS: explicit alloc/free of workspace
Jeremy Harris [Sun, 21 Mar 2021 00:02:07 +0000 (00:02 +0000)]
DNS: explicit alloc/free of workspace

3 years agoMemory debug: track max pool order, fix nonpool accounting
Jeremy Harris [Sat, 20 Mar 2021 22:41:50 +0000 (22:41 +0000)]
Memory debug: track max pool order, fix nonpool accounting

3 years agoMemory handling: exponentially-increasing alloc size
Jeremy Harris [Sun, 14 Mar 2021 17:45:27 +0000 (17:45 +0000)]
Memory handling: exponentially-increasing alloc size

3 years agoDKIM: Force use of tainted mem for headers
Jeremy Harris [Sun, 14 Mar 2021 17:37:11 +0000 (17:37 +0000)]
DKIM: Force use of tainted mem for headers

3 years agoAvoid needless alloc for null header
Jeremy Harris [Sun, 14 Mar 2021 15:51:18 +0000 (15:51 +0000)]
Avoid needless alloc for null header

3 years agoDKIM: verify using separate pool-pair, reset per message
Jeremy Harris [Sun, 14 Mar 2021 17:25:11 +0000 (17:25 +0000)]
DKIM: verify using separate pool-pair, reset per message

3 years agotestsuite output changes resulting
Jeremy Harris [Fri, 19 Mar 2021 16:13:51 +0000 (16:13 +0000)]
testsuite output changes resulting

Broken-by: 649c209e19
3 years ago Linux and the BSDs have getifaddrs(). Use it and save a bunch of complex coding.
Jeremy Harris [Wed, 17 Mar 2021 14:33:46 +0000 (14:33 +0000)]
Linux and the BSDs have getifaddrs().  Use it and save a bunch of complex coding.

3 years agotestsuite output changes resulting
Jeremy Harris [Wed, 17 Mar 2021 00:03:50 +0000 (00:03 +0000)]
testsuite output changes resulting

Broken-by: 649c209e19