Taint: enforce untainted ACL text line
authorJeremy Harris <jgh146exb@wizmail.org>
Sun, 25 Apr 2021 12:02:01 +0000 (13:02 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Sun, 25 Apr 2021 20:40:07 +0000 (21:40 +0100)
doc/doc-txt/ChangeLog
src/src/acl.c

index 916a4c47070706b9e516c65fdeec5b57e4ed5db9..68cec8531299d23b96a82a2877a204c80a666172 100644 (file)
@@ -241,6 +241,10 @@ JH/50 Bug 2672: QT elements in log lines, unless disabled, now exclude the
       The historical behaviour can be restored by disabling (a new) log_selector
       "queue_time_exclusive".
 
+JH/51 Taint-check ACL line.  Previously, only filenames (for out-of-line ACL
+      content) were specifically tested for.  Now, also cover epxansions
+      rerulting in acl names and inline ACL content.
+
 
 
 Exim version 4.94
index 2f20821c2ae4dabb086a597a126787ec2d86c3dd..ce8d2189f2331a39d2b376d40b9bdc6697cf669d 100644 (file)
@@ -4088,6 +4088,26 @@ while (isspace(*ss)) ss++;
 
 acl_text = ss;
 
+#ifdef notyet_taintwarn
+if (  !f.running_in_test_harness
+   &&  is_tainted2(acl_text, LOG_MAIN|LOG_PANIC,
+                         "attempt to use tainted ACL text \"%s\"", acl_text))
+  {
+  /* Avoid leaking info to an attacker */
+  *log_msgptr = US"internal configuration error";
+  return ERROR;
+  }
+#else
+if (is_tainted(acl_text) && !f.running_in_test_harness)
+  {
+  log_write(0, LOG_MAIN|LOG_PANIC,
+    "attempt to use tainted ACL text \"%s\"", acl_text);
+  /* Avoid leaking info to an attacker */
+  *log_msgptr = US"internal configuration error";
+  return ERROR;
+  }
+#endi
+
 /* Handle the case of a string that does not contain any spaces. Look for a
 named ACL among those read from the configuration, or a previously read file.
 It is possible that the pointer to the ACL is NULL if the configuration
@@ -4111,14 +4131,6 @@ if (Ustrchr(ss, ' ') == NULL)
   else if (*ss == '/')
     {
     struct stat statbuf;
-    if (is_tainted(ss))
-      {
-      log_write(0, LOG_MAIN|LOG_PANIC,
-       "attempt to open tainted ACL file name \"%s\"", ss);
-      /* Avoid leaking info to an attacker */
-      *log_msgptr = US"internal configuration error";
-      return ERROR;
-      }
     if ((fd = Uopen(ss, O_RDONLY, 0)) < 0)
       {
       *log_msgptr = string_sprintf("failed to open ACL file \"%s\": %s", ss,