CVE-2020-28012: Missing close-on-exec flag for privileged pipe
authorQualys Security Advisory <qsa@qualys.com>
Mon, 22 Feb 2021 05:53:55 +0000 (21:53 -0800)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Tue, 27 Apr 2021 22:40:47 +0000 (00:40 +0200)
(cherry picked from commit 72dad1e64bb3d1ff387938f59678098cab1f60a3)

doc/doc-txt/ChangeLog
src/src/rda.c

index e2843e3b669e59617f9853f8c44c011d2a665734..a3bf92816abf553f8c58402bdc12028041d5c5d4 100644 (file)
@@ -213,6 +213,9 @@ QS/01 Creation of (database) files in $spool_dir: only uid=0 or the uid of
 QS/02 PID file creation/deletion: only possible if uid=0 or uid is the Exim
       runtime user.
 
 QS/02 PID file creation/deletion: only possible if uid=0 or uid is the Exim
       runtime user.
 
+QS/03 When reading the output from interpreted forward files we do not
+      pass the pipe between the parent and the interpreting process to
+      executed child processes (if any).
 
 Exim version 4.94
 -----------------
 
 Exim version 4.94
 -----------------
index aed8abc246b54b5e1a764f0e13171c827f958542..ce6e7a36d910838ebaba5a430ca0a5edbf89e85f 100644 (file)
@@ -618,9 +618,14 @@ search_tidyup();
 if ((pid = exim_fork(US"router-interpret")) == 0)
   {
   header_line *waslast = header_last;   /* Save last header */
 if ((pid = exim_fork(US"router-interpret")) == 0)
   {
   header_line *waslast = header_last;   /* Save last header */
+  int fd_flags = -1;
 
   fd = pfd[pipe_write];
   (void)close(pfd[pipe_read]);
 
   fd = pfd[pipe_write];
   (void)close(pfd[pipe_read]);
+
+  if ((fd_flags = fcntl(fd, F_GETFD)) == -1) goto bad;
+  if (fcntl(fd, F_SETFD, fd_flags | FD_CLOEXEC) == -1) goto bad;
+
   exim_setugid(ugid->uid, ugid->gid, FALSE, rname);
 
   /* Addresses can get rewritten in filters; if we are not root or the exim
   exim_setugid(ugid->uid, ugid->gid, FALSE, rname);
 
   /* Addresses can get rewritten in filters; if we are not root or the exim