From c1c71d34fe3045ffeb109161fe681fd8def3f855 Mon Sep 17 00:00:00 2001 From: kalba-security Date: Thu, 30 Sep 2021 19:28:00 -0400 Subject: [PATCH] add nil check for the return value of add_printer_driver_ex, since this will return nil if the response can't be mapped to a win32 status code --- modules/auxiliary/admin/dcerpc/cve_2021_1675_printnightmare.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/auxiliary/admin/dcerpc/cve_2021_1675_printnightmare.rb b/modules/auxiliary/admin/dcerpc/cve_2021_1675_printnightmare.rb index 35699b42ba..77da756b44 100644 --- a/modules/auxiliary/admin/dcerpc/cve_2021_1675_printnightmare.rb +++ b/modules/auxiliary/admin/dcerpc/cve_2021_1675_printnightmare.rb @@ -337,6 +337,8 @@ class MetasploitModule < Msf::Auxiliary ) case add_printer_driver_ex(container) + when nil # prevent the module from erroring out in case the response can't be mapped to a Win32 error code + return Exploit::CheckCode::Unknown('Received unknown status code, implying the target is not vulnerable.') when ::WindowsError::Win32::ERROR_PATH_NOT_FOUND return Exploit::CheckCode::Vulnerable('Received ERROR_PATH_NOT_FOUND, implying the target is vulnerable.') when ::WindowsError::Win32::ERROR_BAD_NET_NAME