Consultas SQL de Configuration Manager para KB relacionadas con el ransomware WannaCrypt.
El enfoque más simple y generalmente recomendado es implementar la última CU en Windows. 10 o servidor 2016 sistemas, implementar el último paquete acumulativo mensual en versiones anteriores a Windows 10 máquinas, y utilice los informes de cumplimiento de ConfigMgr integrados para determinar el cumplimiento general.
Guía oficial para el cliente sobre ataques de WannaCrypt: https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/
Actualización de seguridad MS17-010: https://technet.microsoft.com/en-us/library/security/ms17-010.aspx
Antes de Windows 10 máquinas:
ventanas 8.1 y servidor 2012 Las máquinas R2 que no informan que KB2919355 está instalado serán devueltas por la consulta. Esto se debe a que se requiere KB2919355 para que los KB posteriores se informen según corresponda.. Entonces, Estos sistemas pueden considerarse en riesgo y requieren más investigación..
Para Windows Vista, ventanas 7, ventanas 8.1, Servidor de windows 2008 R2 SP1, Servidor de windows 2008 SP2, Servidor de windows 2012, y servidor de Windows 2012 Consulta R2 a continuación, los sistemas devueltos serán aquellos que no tengan tampoco el Marcha, Resúmenes mensuales de abril o mayo instalados -Y- informan las siguientes actualizaciones específicas de "Solo seguridad" como "Obligatorias":
Windows Vista y Servidor 2008 SP2: KB4012598
ventanas 7 y servidor 2008 R2 SP1: KB4012212
Servidor de windows 2012: KB4012214
Servidor de windows 2012 R2 y ventanas 8.1: KB4012213
-- Para ventanas 7, Servidor 2008 R2 SP1, Servidor de windows 2012, Servidor 2012 R2 y ventanas 8.1, Windows Vista y Servidor 2008 SP2
-- This query lists machines that are reporting any of the 'Security Only' updates as 'Required'.
-- Si alguna máquina tiene marzo, Paquete acumulativo mensual de abril o mayo instalado, then they wouldn't report March 'Security Only' update as 'Required', pero busque las actualizaciones mensuales de todos modos.
-- Incluya también cualquier Windows 8.1 y servidor 2012 Máquinas R2 que no informan "KB2919355" como instalado.
DECLARAR @MarchSecurityOnly TABLA (ID del artículo NVARCHAR(20))
INSERTAR EN @MarchSecurityOnly VALORES ('4012212')
INSERTAR EN @MarchSecurityOnly VALORES ('4012213')
INSERTAR EN @MarchSecurityOnly VALORES ('4012214')
INSERTAR EN @MarchSecurityOnly VALORES ('4012598')
DECLARAR @MarchMonthly TABLA (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES @MarchMonthly ('4012215')
INSERTAR EN LOS VALORES @MarchMonthly ('4015549')
INSERTAR EN LOS VALORES @MarchMonthly ('4019264')
INSERTAR EN LOS VALORES @MarchMonthly ('4012216')
INSERTAR EN LOS VALORES @MarchMonthly ('4015550')
INSERTAR EN LOS VALORES @MarchMonthly ('4019215')
INSERTAR EN LOS VALORES @MarchMonthly ('4012217')
INSERTAR EN LOS VALORES @MarchMonthly ('4015551')
INSERTAR EN LOS VALORES @MarchMonthly ('4019216')
DECLARAR @KB2919355 NVARCHAR(10) = '2919355'-- Prerrequisito
SELECCIONAR
RS.Nombre0,
UI.ArticleID como ID de artículo,
UI.BulletinID como BulletinID,
UI.Título como título,
SN.StateDescripción AS Estado,
UCS.LastStatusCheckTime AS LastStateReceived,
UCS.LastStatusChangeTime AS LastStateChanged,
UI.CI_UniqueID COMO UniqueUpdateID
DESDE v_Update_ComplianceStatusReported UCS
ÚNASE a la interfaz de usuario de v_UpdateInfo EN UCS.CI_ID = UI.CI_ID
ÚNASE a v_R_System RS EN RS.ResourceType=5 Y RS.ResourceID = UCS.ResourceID
ÚNASE a v_StateNames SN EN SN.TopicType=500 Y SN.StateID=2 Y SN.StateID = UCS.Status
DONDE UI.ID del artículo EN (SELECCIONE el ID del artículo DE @MarchSecurityOnly)
Y RS.Name0 NO EN (
-- Se instala mensualmente
SELECCIONE distinto RS.Name0
DESDE v_Update_ComplianceStatusReported UCS
ÚNASE a la interfaz de usuario de v_UpdateInfo EN UCS.CI_ID = UI.CI_ID
ÚNASE a v_R_System RS EN RS.ResourceType=5 Y RS.ResourceID = UCS.ResourceID
ÚNASE a v_StateNames SN EN SN.TopicType=500 Y SN.StateID=3 Y SN.StateID = UCS.Status
DONDE UI.ID del artículo EN (SELECCIONE el ID del artículo DE @MarchMonthly)
)
UNIÓN
-- ventanas 8.1 y servidor 2012 Máquinas R2 que no informan KB2919355 como instalado.
SELECCIONAR
distinto RS.Name0,
UI.ArticleID como ID de artículo,
UI.BulletinID como BulletinID,
'KB2919355' as Title,
'Update is not Installed' AS State,
NULL COMO último estado recibido,
NULL COMO último estado cambiado,
'KB2919355' AS UniqueUpdateID
FROM v_Update_ComplianceStatusReported UCS
JOIN v_UpdateInfo UI ON UCS.CI_ID = UI.CI_ID
JOIN v_R_System RS ON RS.ResourceType=5 AND RS.ResourceID = UCS.ResourceID
JOIN v_StateNames SN ON SN.TopicType=500 AND SN.StateID = UCS.Status AND SN.StateID <> 3
JOIN v_GS_OPERATING_SYSTEM OS ON RS.ResourceID = OS.ResourceID AND OS.BuildNumber0 = '9600' -- ventanas 8.1 y servidor 2012 R2
DONDE UI.ID del artículo = @KB2919355
ventanas 10 y servidor 2016
para las ventanas 10 y servidor 2016 consultas, hay 2 escenarios que pueden aplicarse dependiendo de la configuración de un entorno al vencimiento de las actualizaciones reemplazadas en ConfigMgr. Para más información sobre esto, consulte la sección de reglas de sustitución en TechNet y este.
Guión 1: Clientes con regla de sustitución NO configurada en "Caducar inmediatamente":
Si las actualizaciones reemplazadas no han caducado y, por lo tanto, todavía están disponibles en ConfigMgr, Puede utilizar la siguiente consulta para ayudar a identificar Windows. 10 y servidor de Windows 2016 sistemas que no tienen instalada la CU de marzo o una CU posterior. Tenga en cuenta que para que se evalúen los datos de CU de marzo, Los meses que se deben esperar antes de que caduque una actualización. El valor en ConfigMgr debe establecerse en un valor lo suficientemente alto como para que la actualización de marzo no haya caducado.. La misma consideración se aplica a las actualizaciones posteriores.. Si esto no se aplica a su entorno, la información en Guión 2: Clientes con regla de sustitución establecida en "Caducar inmediatamente" (o no lo suficiente) se puede probar.
Para los siguientes Windows 10 y servidor 2016, la consulta a continuación devuelve sistemas que no tienen ninguna de las siguientes CU mensuales, lanzado en marzo o más tarde (hasta la fecha de esta publicación), instalado:
Win10 RTM: KB4012606, KB4019474, KB4015221, KB4016637
Win10 1511: KB4013198, KB4015219, KB4016636, KB4019473
Win10 1607/servidor 2016: KB4013429, KB4015217, KB4015438, KB4016635, KB4019472
-- ventanas 10 máquinas que no tienen la marcha (o cualquiera de las actualizaciones reemplazantes) instalado, and could be 'at risk'.
-- Estas consultas dependen del sistema operativo., since we are querying individual KB's, and need to compare those KB's against proper builds to prevent getting inaccurate results.
-- ventanas 10 RTM
DECLARE @BuildNumberRTM INT = '10240'
DECLARE @MarchWin10 TABLE (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES DE @MarchWin10 ('4012606') -- Acumulado de marzo
INSERTAR EN LOS VALORES DE @MarchWin10 ('4019474')
INSERTAR EN LOS VALORES DE @MarchWin10 ('4015221')
INSERTAR EN LOS VALORES DE @MarchWin10 ('4016637')
SELECCIONAR RS.Nombre0, OS.BuildNumber0 DE v_R_System RS
ÚNASE a v_GS_OPERATING_SYSTEM OS EN RS.ResourceID = OS.ResourceID Y OS.BuildNumber0 = @BuildNumberRTM
DONDE RS.Name0 NO ESTÁ (
SELECCIONAR RS.Nombre0
DESDE v_Update_ComplianceStatusReported UCS
ÚNASE a la interfaz de usuario de v_UpdateInfo EN UCS.CI_ID = UI.CI_ID
ÚNASE a v_R_System RS EN RS.ResourceType=5 Y RS.ResourceID = UCS.ResourceID
ÚNASE a v_StateNames SN EN SN.TopicType=500 Y SN.StateID=3 Y SN.StateID = UCS.Status
ÚNASE a v_GS_OPERATING_SYSTEM OS EN OS.ResourceID = RS.ResourceID Y OS.BuildNumber0 = @BuildNumberRTM
DONDE UI.ID del artículo EN (SELECCIONE el ID del artículo DE @ MarchWin10)
)
-- ventanas 10 1511
DECLARE @BuildNumber1511 INT = '10586'
DECLARE @MarchWin101511 TABLE (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES @MarchWin101511 ('4013198') -- Acumulado de marzo
INSERTAR EN LOS VALORES @MarchWin101511 ('4015219')
INSERTAR EN LOS VALORES @MarchWin101511 ('4016636')
INSERTAR EN LOS VALORES @MarchWin101511 ('4019473')
SELECCIONAR RS.Nombre0, OS.BuildNumber0 DE v_R_System RS
ÚNASE a v_GS_OPERATING_SYSTEM OS EN RS.ResourceID = OS.ResourceID Y OS.BuildNumber0 = @BuildNumber1511
DONDE RS.Name0 NO ESTÁ (
SELECCIONAR RS.Nombre0
DESDE v_Update_ComplianceStatusReported UCS
ÚNASE a la interfaz de usuario de v_UpdateInfo EN UCS.CI_ID = UI.CI_ID
ÚNASE a v_R_System RS EN RS.ResourceType=5 Y RS.ResourceID = UCS.ResourceID
ÚNASE a v_StateNames SN EN SN.TopicType=500 Y SN.StateID=3 Y SN.StateID = UCS.Status
ÚNASE a v_GS_OPERATING_SYSTEM OS EN OS.ResourceID = RS.ResourceID Y OS.BuildNumber0 = @BuildNumber1511
DONDE UI.ID del artículo EN (SELECCIONE el ID del artículo DE @MarchWin101511)
)
-- ventanas 10 1607
DECLARE @BuildNumber1607 INT = '14393'
DECLARE @MarchWin101607 TABLE (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES @MarchWin101607 ('4013429') -- Acumulado de marzo
INSERTAR EN LOS VALORES @MarchWin101607 ('4015217')
INSERTAR EN LOS VALORES @MarchWin101607 ('4015438')
INSERTAR EN LOS VALORES @MarchWin101607 ('4016635')
INSERTAR EN LOS VALORES @MarchWin101607 ('4019472')
SELECCIONAR RS.Nombre0, OS.BuildNumber0 DE v_R_System RS
ÚNASE a v_GS_OPERATING_SYSTEM OS EN RS.ResourceID = OS.ResourceID Y OS.BuildNumber0 = @BuildNumber1607
DONDE RS.Name0 NO ESTÁ (
SELECCIONAR RS.Nombre0
DESDE v_Update_ComplianceStatusReported UCS
ÚNASE a la interfaz de usuario de v_UpdateInfo EN UCS.CI_ID = UI.CI_ID
ÚNASE a v_R_System RS EN RS.ResourceType=5 Y RS.ResourceID = UCS.ResourceID
ÚNASE a v_StateNames SN EN SN.TopicType=500 Y SN.StateID=3 Y SN.StateID = UCS.Status
ÚNASE a v_GS_OPERATING_SYSTEM OS EN OS.ResourceID = RS.ResourceID Y OS.BuildNumber0 = @BuildNumber1607
DONDE UI.ID del artículo EN (SELECCIONE el ID del artículo DE @MarchWin101607)
)
Guión 2: Clientes con regla de sustitución establecida en "Caducar inmediatamente" (o no lo suficiente):
Dado que las CU se reemplazan cada mes, y caducó debido a que la opción Reglas de sustitución de ConfigMgr estaba configurada en "Caducar inmediatamente", los datos de cumplimiento no están disponibles en la actualización caducada (en este escenario), Vas a, sin embargo, tener datos de cumplimiento sobre la CU más nueva disponible, por lo que el camino más sencillo a seguir sería implementar la última CU e informar sobre ella.
Opciones alternativas (para ventanas 10 y servidor 2016):
Opciones alternativas a las anteriores, que puede ayudar a determinar las máquinas "en riesgo", informando sobre la CU vencida, son como sigue:
A. Ampliar el inventario de hardware para incluir Win32_QuickFixEngineering, y utilizar estos datos para identificar máquinas "en riesgo". Si alguna máquina no tiene marzo, CU instalada en abril o mayo, están 'en riesgo'. TENGA EN CUENTA que si aún no tiene esto habilitado, habilítelo ahora, Debería esperar a que todos los clientes informen el inventario de hardware..
-- Los clientes con la clase Win32_QuickFixEngineering habilitada para HINV pueden usar estas consultas.
-- ventanas 10 máquinas que no tienen la marcha (o cualquiera de las actualizaciones reemplazantes) installed and could be 'at risk'.
-- Estas consultas dependen del sistema operativo., since we are querying individual KB's, and need to compare those KB's against proper builds to prevent getting inaccurate results.
-- La consulta limita los resultados de las máquinas que tienen al menos una fila en la clase v_GS_Quick_Fix_Engineering para garantizar que haya algunos datos HINV para la máquina para esta clase..
-- ventanas 10 RTM
DECLARE @BuildNumberRTM INT = '10240'
DECLARACIÓN @MarchWin10 TABLA (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES DE @MarchWin10 ('4012606') -- Acumulado de marzo
INSERTAR EN LOS VALORES DE @MarchWin10 ('4019474')
INSERTAR EN LOS VALORES DE @MarchWin10 ('4015221')
INSERTAR EN LOS VALORES DE @MarchWin10 ('4016637')
SELECCIONAR RS.Nombre0, OS.BuildNumber0, QFE.HotFixID0, CONTAR(QFEALL.HotFixID0) AS TotalHotfixes DE v_R_System RS
ÚNASE a v_GS_OPERATING_SYSTEM OS EN OS.ResourceID = RS.ResourceID Y OS.BuildNumber0 = @BuildNumberRTM
ÚNASE a v_GS_QUICK_FIX_ENGINEERING QFEALL EN QFEALL.ResourceID = RS.ResourceID
UNIRSE A LA IZQUIERDA v_GS_QUICK_FIX_ENGINEERING QFE EN QFE.ResourceID = RS.ResourceID Y QFE.HotFixID0 EN (SELECT 'KB' + ID del artículo DE @MarchWin10)
DONDE QFE.HotFixID0 ES NULO
GRUPO POR RS.Nombre0, OS.BuildNumber0, QFE.HotFixID0
TENER CUENTA(QFEALL.HotFixID0) > 0
-- ventanas 10 1511
DECLARE @BuildNumber1511 INT = '10586'
DECLARE @MarchWin101511 TABLE (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES @MarchWin101511 ('4013198') -- Acumulado de marzo
INSERTAR EN LOS VALORES @MarchWin101511 ('4015219')
INSERTAR EN LOS VALORES @MarchWin101511 ('4016636')
INSERTAR EN LOS VALORES @MarchWin101511 ('4019473')
SELECCIONAR RS.Nombre0, OS.BuildNumber0, QFE.HotFixID0, CONTAR(QFEALL.HotFixID0) AS TotalHotfixes DE v_R_System RS
ÚNASE a v_GS_OPERATING_SYSTEM OS EN OS.ResourceID = RS.ResourceID Y OS.BuildNumber0 = @BuildNumber1511
ÚNASE a v_GS_QUICK_FIX_ENGINEERING QFEALL EN QFEALL.ResourceID = RS.ResourceID
UNIRSE A LA IZQUIERDA v_GS_QUICK_FIX_ENGINEERING QFE EN QFE.ResourceID = RS.ResourceID Y QFE.HotFixID0 EN (SELECT 'KB' + ID del artículo DE @MarchWin101511)
DONDE QFE.HotFixID0 ES NULO
GRUPO POR RS.Nombre0, OS.BuildNumber0, QFE.HotFixID0
TENER CUENTA(QFEALL.HotFixID0) > 0
-- ventanas 10 1607
DECLARE @BuildNumber1607 INT = '14393'
DECLARE @MarchWin101607 TABLE (ID del artículo NVARCHAR(20))
INSERTAR EN LOS VALORES @MarchWin101607 ('4013429') -- Acumulado de marzo
INSERTAR EN LOS VALORES @MarchWin101607 ('4015217')
INSERTAR EN LOS VALORES @MarchWin101607 ('4015438')
INSERTAR EN LOS VALORES @MarchWin101607 ('4016635')
INSERTAR EN LOS VALORES @MarchWin101607 ('4019472')
SELECCIONAR RS.Nombre0, OS.BuildNumber0, QFE.HotFixID0, CONTAR(QFEALL.HotFixID0) AS TotalHotfixes DE v_R_System RS
ÚNASE a v_GS_OPERATING_SYSTEM OS EN OS.ResourceID = RS.ResourceID Y OS.BuildNumber0 = @BuildNumber1607
ÚNASE a v_GS_QUICK_FIX_ENGINEERING QFEALL EN QFEALL.ResourceID = RS.ResourceID
UNIRSE A LA IZQUIERDA v_GS_QUICK_FIX_ENGINEERING QFE EN QFE.ResourceID = RS.ResourceID Y QFE.HotFixID0 EN (SELECT 'KB' + ID del artículo DE @MarchWin101607)
DONDE QFE.HotFixID0 ES NULO
GRUPO POR RS.Nombre0, OS.BuildNumber0, QFE.HotFixID0
TENER CUENTA(QFEALL.HotFixID0) > 0
B. Cree un elemento de configuración y una línea base que consulte el mes de marzo., CU de abril y mayo de Win32_QuickFixEngineering e informes de cumplimiento. Aquí hay un script de PowerShell de muestra escrito por Umair Khan que se puede usar en una línea base de DCM.:
$InstalledKBList = Get-Wmiobject -clase Win32_QuickFixEngineering -espacio de nombres "raízcimv2" | seleccionar-objeto -Propiedad HotFixID | Fuera de cuerda
[formación]$QuieroLlorarList =
"KB4012598",
"KB4012212",
"KB4012215",
"KB4012213",
"KB4012216",
"KB4012214",
"KB4012217",
"KB4012606",
"KB4013198",
"KB4013429",
"KB4015219",
"KB4015221",
"KB4016636",
"KB4015438",
"KB4015550",
"KB4015551",
"KB4016637",
"KB4019473",
"KB4016635",
"KB4018466",
"KB4015552",
"KB4019215",
"KB4019216",
"KB4019474",
"KB4019472",
"KB4019264"
$Cumple = 0;
para cada ($elemento en $WannaCryList)
{
si ($InstaladoKBList -match $elem)
{
# Salida de escritura "$elemento encontrado"
$Cumple = 1
romper
}
}
$Obediente