From: Konstantin Kostiuk Date: Fri, 3 Mar 2023 19:20:08 +0000 (+0200) Subject: qga/win32: Use rundll for VSS installation X-Git-Tag: v7.2.5~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b629412e9d2129897126244cdfcc0b0c06df8542;p=thirdparty%2Fqemu.git qga/win32: Use rundll for VSS installation The custom action uses cmd.exe to run VSS Service installation and removal which causes an interactive command shell to spawn. This shell can be used to execute any commands as a SYSTEM user. Even if call qemu-ga.exe directly the interactive command shell will be spawned as qemu-ga.exe is a console application and used by users from the console as well as a service. As VSS Service runs from DLL which contains the installer and uninstaller code, it can be run directly by rundll32.exe without any interactive command shell. Add specific entry points for rundll which is just a wrapper for COMRegister/COMUnregister functions with proper arguments. resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2167423 fixes: CVE-2023-0664 (part 2 of 2) Signed-off-by: Konstantin Kostiuk Reviewed-by: Yan Vugenfirer Reported-by: Brian Wiltse (cherry picked from commit 07ce178a2b0768eb9e712bb5ad0cf6dc7fcf0158) Signed-off-by: Michael Tokarev --- diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs index 34423836274..949ba07fd24 100644 --- a/qga/installer/qemu-ga.wxs +++ b/qga/installer/qemu-ga.wxs @@ -116,22 +116,22 @@ - + diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index b8087e5baaa..ff93b08a9e6 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -357,6 +357,15 @@ out: return hr; } +STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int) +{ + COMRegister(); +} + +STDAPI_(void) CALLBACK DLLCOMUnregister(HWND, HINSTANCE, LPSTR, int) +{ + COMUnregister(); +} static BOOL CreateRegistryKey(LPCTSTR key, LPCTSTR value, LPCTSTR data) { diff --git a/qga/vss-win32/qga-vss.def b/qga/vss-win32/qga-vss.def index 927782c31b3..ee97a814275 100644 --- a/qga/vss-win32/qga-vss.def +++ b/qga/vss-win32/qga-vss.def @@ -1,6 +1,8 @@ LIBRARY "QGA-PROVIDER.DLL" EXPORTS + DLLCOMRegister + DLLCOMUnregister COMRegister PRIVATE COMUnregister PRIVATE DllCanUnloadNow PRIVATE