]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_9_10_patch] quote service registry paths
authorEvan Hunt <each@isc.org>
Tue, 30 May 2017 20:44:31 +0000 (13:44 -0700)
committerEvan Hunt <each@isc.org>
Tue, 30 May 2017 20:44:31 +0000 (13:44 -0700)
4532. [security] The BIND installer on Windows used an unquoted
                        service path, which can enable privilege escalation.
(CVE-2017-3141) [RT #45229]

(cherry picked from commit 967a3b9419a3c12b8c0870c86d1ee3840bcbbad7)
(cherry picked from commit c28e44f3f8bc46c6bf1c15cc06af0c42fcd7e924)
(cherry picked from commit 91dfaf39a9a9852929294bdc2cc5260563adf32d)

CHANGES
README
bin/win32/BINDInstall/BINDInstallDlg.cpp
doc/arm/notes.xml

diff --git a/CHANGES b/CHANGES
index 3f3423891316b20e9750d680334e3b776e54f864..63603faf9ccf5ec31f5f9c4308baf3d8ee8062a5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4532.  [security]      The BIND installer on Windows used an unquoted
+                        service path, which can enable privilege escalation.
+                       (CVE-2017-3141) [RT #45229]
+
 4531.  [security]      Some RPZ configurations could go into an infinite
                        query loop when encountering responses with TTL=0.
                        (CVE-2017-3140) [RT #45181]
diff --git a/README b/README
index 5281db6c58122d5462ec8654910ef13845e328b5..47e03d7e40ce12e82e6e35ca7635bcc9acf61d5b 100644 (file)
--- a/README
+++ b/README
@@ -53,8 +53,8 @@ BIND 9
 
 BIND 9.9.10-P1
 
-        This version contains a fix for the security flaw
-        disclosed in CVE-2017-3140.
+        This version contains a fix for the security flaws
+        disclosed in CVE-2017-3140 and CVE-2017-3141.
 
 BIND 9.9.10
        
index 6ca5f15556a8e4a13cac187cf18d223c0ac22a72..e14feab37701920c556760dcefafbba3c9f086b8 100644 (file)
@@ -59,6 +59,7 @@
 #include "DirBrowse.h"
 #include <winsvc.h>
 #include <shlobj.h>
+#include <shlwapi.h>
 #include <named/ntservice.h>
 #include <isc/bind_registry.h>
 #include <isc/ntgroups.h>
@@ -615,8 +616,16 @@ void CBINDInstallDlg::OnInstall() {
                                        (LPBYTE)(LPCTSTR)buf, buf.GetLength());
 
                        buf.Format("%s\\BINDInstall.exe", m_binDir);
+
+                       CStringA installLocA(buf);
+                       const char *str = (const char *) installLocA;
+                       char pathBuffer[2 * MAX_PATH];
+                       strncpy(pathBuffer, str, sizeof(pathBuffer) - 1);
+                       pathBuffer[sizeof(pathBuffer) - 1] = 0;
+                       PathQuoteSpaces(pathBuffer);
+
                        RegSetValueEx(hKey, "UninstallString", 0, REG_SZ,
-                                       (LPBYTE)(LPCTSTR)buf, buf.GetLength());
+                                     (LPBYTE)(LPCTSTR)pathBuffer, strlen(pathBuffer));
                        RegCloseKey(hKey);
                }
 
@@ -1011,10 +1020,17 @@ CBINDInstallDlg::RegisterService() {
        CString namedLoc;
        namedLoc.Format("%s\\bin\\named.exe", m_targetDir);
 
+       CStringA namedLocA(namedLoc);
+       const char *str = (const char *) namedLocA;
+       char pathBuffer[2 * MAX_PATH];
+       strncpy(pathBuffer, str, sizeof(pathBuffer) - 1);
+       pathBuffer[sizeof(pathBuffer) - 1] = 0;
+       PathQuoteSpaces(pathBuffer);
+
        SetCurrent(IDS_CREATE_SERVICE);
        hService = CreateService(hSCManager, BIND_SERVICE_NAME,
                BIND_DISPLAY_NAME, SERVICE_ALL_ACCESS, dwServiceType, dwStart,
-               SERVICE_ERROR_NORMAL, namedLoc, NULL, NULL, NULL, StartName,
+               SERVICE_ERROR_NORMAL, pathBuffer, NULL, NULL, NULL, StartName,
                m_accountPassword);
 
        if (!hService && GetLastError() != ERROR_SERVICE_EXISTS)
@@ -1053,6 +1069,13 @@ CBINDInstallDlg::UpdateService(CString StartName) {
        CString namedLoc;
        namedLoc.Format("%s\\bin\\named.exe", m_targetDir);
 
+       CStringA namedLocA(namedLoc);
+       const char *str = (const char *) namedLocA;
+       char pathBuffer[2 * MAX_PATH];
+       strncpy(pathBuffer, str, sizeof(pathBuffer) - 1);
+       pathBuffer[sizeof(pathBuffer) - 1] = 0;
+       PathQuoteSpaces(pathBuffer);
+
        SetCurrent(IDS_OPEN_SERVICE);
        hService = OpenService(hSCManager, BIND_SERVICE_NAME,
                               SERVICE_CHANGE_CONFIG);
@@ -1064,7 +1087,7 @@ CBINDInstallDlg::UpdateService(CString StartName) {
                return;
        } else {
                if (ChangeServiceConfig(hService, dwServiceType, dwStart,
-                       SERVICE_ERROR_NORMAL, namedLoc, NULL, NULL, NULL,
+                       SERVICE_ERROR_NORMAL, pathBuffer, NULL, NULL, NULL,
                        StartName, m_accountPassword, BIND_DISPLAY_NAME)
                        != TRUE) {
                        DWORD err = GetLastError();
index a954cfc4315be577d08084e3272e179913a736a9..98edd1b288f6cc3650e4d54c2ee529ef3bad3375 100644 (file)
@@ -24,8 +24,8 @@
       This document summarizes changes since BIND 9.9.10:
     </para>
     <para>
-      BIND 9.9.10-P1 addresses the security issue described in
-      CVE-2017-3140.
+      BIND 9.9.10-P1 addresses the security issues described in
+      CVE-2017-3140 and CVE-2017-3141.
     </para>
 
   </section>
 
   <section xml:id="relnotes_security"><info><title>Security Fixes</title></info>
     <itemizedlist>
+      <listitem>
+       <para>
+         The BIND installer on Windows used an unquoted service path,
+         which can enable privilege escalation. This flaw is disclosed
+         in CVE-2017-3141. [RT #45229]
+       </para>
+      </listitem>
       <listitem>
        <para>
          With certain RPZ configurations, a response with TTL 0