{ Скрипт AVZ для обнаружения наиболее часто используемых уязвимостей. Версия 1.07 Автор: AndreyKa, участник форума virusinfo.info Скрипт может свободно распространяться и использоваться, при условии сохранения данного комментария } function IsFileBuldLow(VulnFileName: string; IMinVer: integer) : boolean; var ARes : string; IPos, IBuild : Integer; begin ARes := GetFileVersion(VulnFileName, 6); IPos := Pos('.', ARes); while IPos > 0 do begin Delete(ARes, 1, IPos); IPos := Pos('.', ARes); end; Result := False; if ValidInt(ARes) then begin IBuild := StrToInt(ARes); if IBuild < IMinVer then Result := True end; end; function IsFileSubVerLow(VulnFileName:string; IMinSubVer:Extended):boolean; var ARes: string; IPos: Integer; begin ARes := GetFileVersion(VulnFileName, 6); IPos := Pos('.', ARes); Delete(ARes, 1, IPos); IPos := Pos('.', ARes); Delete(ARes, 1, IPos); Result := False; if ValidFloat(ARes) then if StrToFloat(ARes) < IMinSubVer then Result := True; end; Procedure ScanWinVuln; var AOSVer, ASP, AResult : string; IMinVer, IOSVer, IEVer : integer; IMinSubVer: Extended; begin if not IsNT then exit; // Определить версию ОС AOSVer := RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\Windows NT\CurrentVersion','CurrentVersion'); if AOSVer < '5.0' then exit; IOSVer := 0; ASP := RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\Windows NT\CurrentVersion','CSDVersion'); if AOSVer = '5.0' then if ASP <> 'Service Pack 4' then AddToLog('Установите Service Pack 4 для Windows 2000') else IOSVer := 4; if AOSVer = '5.1' then if ASP < 'Service Pack 2' then AddToLog('Установите Service Pack 3 для Windows XP') else if ASP = 'Service Pack 2' then IOSVer := 12 else if ASP = 'Service Pack 3' then IOSVer := 13; if AOSVer = '5.2' then if ASP < 'Service Pack 2' then AddToLog('Установите Service Pack 2 для Windows 2003') else if ASP = 'Service Pack 2' then IOSVer := 22; if AOSVer = '6.0' then begin IOSVer := 30; if ASP = 'Service Pack 1' then IOSVer := 31; if ASP = 'Service Pack 2' then IOSVer := 32; end; if IOSVer = 0 then exit; // не удалось определить версию SP ОС или ОС не поддреживается if IsWOW64 then IOSVer := IOSVer + 100; AddToLog('Поиск критических уязвимостей'); IMinVer := 0; case IOSVer of 4 : IMinVer := 7203; 12 : IMinVer := 3462; 13 : IMinVer := 5694; 22 : IMinVer := 4392; 122: IMinVer := 4392; end; if IMinVer <> 0 then if IsFileBuldLow('%System32%\Netapi32.dll', IMinVer) then begin AddToLog('Уязвимость службы сервера делает возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/rus/technet/security/bulletin/MS08-067.mspx'); end; IMinVer := 0; case IOSVer of 4 : IMinVer := 7222; 12 : IMinVer := 3491; 13 : IMinVer := 5725; 22 : IMinVer := 4425; 122: IMinVer := 4425; end; if IMinVer <> 0 then if IsFileBuldLow('%System32%\drivers\Srv.sys', IMinVer) then begin AddToLog('Уязвимости в протоколе SMB делают возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/rus/technet/security/bulletin/MS09-001.mspx'); end; IMinVer := 0; case IOSVer of 4:begin AResult := RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\DirectX','Version'); AResult := Copy(AResult, 3, 2); if ValidInt(AResult) then case StrToInt(AResult) of 7: IMinVer := 736; 8: IMinVer := 893; 9: IMinVer := 911; end; end; 12 : IMinVer := 3580; 13 : IMinVer := 5822; 22 : IMinVer := 4523; 122: IMinVer := 4523; end; if IMinVer <> 0 then if IsFileBuldLow('%System32%\Quartz.dll', IMinVer) then begin AddToLog('Уязвимости в Microsoft DirectShow делают возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/rus/technet/security/bulletin/MS09-028.mspx'); end; if NoKillBit('{0002E543-0000-0000-C000-000000000046}') or NoKillBit('{0002E55B-0000-0000-C000-000000000046}') or NoKillBit('{0002E512-0000-0000-C000-000000000046}') then begin AddToLog('Уязвимости в веб-компонентах Microsoft Office делают возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/rus/technet/security/bulletin/MS09-043.mspx'); end; IMinVer := 0; AResult := RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\Internet Explorer','Version'); AResult := Copy(AResult, 1, 1); if ValidInt(AResult) then IEVer:=StrToInt(AResult); if IEVer = 8 then IMinSubVer := 6001.18876; begin case IOSVer of 4 : case IEVer of 5: IMinSubVer := 3884.1600; 6: IMinSubVer := 2800.1644; end; 12: case IEVer of 6: IMinSubVer := 2900.3660; 7: IMinSubVer := 6000.16981; end; 13: case IEVer of 6: IMinSubVer := 2900.5921; 7: IMinSubVer := 6000.16981; end; 22: case IEVer of 6: IMinSubVer := 3790.4639; 7: IMinSubVer := 6000.16981; end; 30: case IEVer of 7: IMinSubVer := 6000.16982; 8: IMinSubVer := 6001.18882; end; 31: case IEVer of 7: IMinSubVer := 6001.18385; 8: IMinSubVer := 6001.18882; end; 32: case IEVer of 7: IMinSubVer := 6002.18167; 8: IMinSubVer := 6001.18882; end; end; end; if IMinSubVer <> 0 then if IsFileSubVerLow('%System32%\Mshtml.dll', IMinSubVer) then begin AddToLog('Накопительное обновление безопасности для браузера Internet Explorer'); AddToLog('http://www.microsoft.com/rus/technet/security/bulletin/MS10-002.mspx'); end; if (IOSVer=122) or (IOSVer<14) then if NoKillBit('{011B3619-FE63-4814-8A84-15A194CE9CE3}') or NoKillBit('{0002E531-0000-0000-C000-000000000046}') or NoKillBit('{0002E554-0000-0000-C000-000000000046}') or NoKillBit('{0002E55C-0000-0000-C000-000000000046}') or NoKillBit('{B1F78FEF-3DB7-4C56-AF2B-5DCCC7C42331}') or NoKillBit('{4F1E5B1A-2A80-42ca-8532-2D05CB959537}') or NoKillBit('{27A3D328-D206-4106-8D33-1AA39B13394B}') then begin AddToLog('Уязвимость в элементе ActiveX делает возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/rus/technet/security/bulletin/MS09-055.mspx'); end; end; Function NoKillBit(CLSID: string) : boolean; begin Result:=RegKeyExists('HKCR','CLSID\'+CLSID) and not RegKeyExists('HKLM','SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\'+CLSID); end; Procedure ScanAdobeFlashVuln; var AResult : string; begin AResult := RegKeyStrParamRead('HKLM', 'SOFTWARE\Microsoft\Active Setup\Installed Components\{D27CDB6E-AE6D-11cf-96B8-444553540000}','Version'); if IsFlashOld(AResult) then begin AddToLog('Уязвимости в Adobe Flash Player для Internet Explorer'); AddToLog('http://get.adobe.com/flashplayer'); end; AResult := RegKeyStrParamRead('HKLM', 'SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer','Version'); if IsFlashOld(AResult) then begin AddToLog('Уязвимости в Adobe Flash Player для Firefox/Safari/Opera'); AddToLog('http://get.adobe.com/flashplayer/otherversions'); end; end; function IsFlashOld(AFlVer: string) : boolean; var AVer : string; begin Result := false; if AFlVer = '' then exit; AVer := Copy(AFlVer, 1, 2); if AVer = '9.' then begin Delete(AFlVer, 1, 4); if ValidFloat(AFlVer) then if StrToFloat(AFlVer) < 260.0 then Result:=true; end else if AVer = '10' then begin Delete(AFlVer, 1, 5); if ValidFloat(AFlVer) then if StrToFloat(AFlVer) < 42.34 then Result:=true; end else Result := true; end; Procedure ScanAdobeReaderVuln; var ARes, AVer, AMinVer, CVer, AKey : string; begin ARes:=''; if RegKeyExists('HKLM', 'SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects\{06849E9F-C8D7-4D59-B87D-784B7D6BE0B3}') then ARes:='06849E9F-C8D7-4D59-B87D-784B7D6BE0B3' else if RegKeyExists('HKLM', 'SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects\{18DF081C-E8AD-4283-A596-FA578C2EBDC3}') then ARes:='18DF081C-E8AD-4283-A596-FA578C2EBDC3'; if ARes = '' then exit; ARes := RegKeyStrParamRead('HKCR','CLSID\{'+ARes+'}\InprocServer32',''); AVer := GetFileVersion(ARes, 6); AMinVer := ''; CVer := Copy(AVer, 1, 1); if ValidInt(CVer) then case StrToInt(CVer) of 8: AMinVer := '8.2'; 9: AMinVer := '9.3'; end else exit; if AMinVer = '' then AddToLog('Установите Adobe Acrobat Reader 9.3 или удалите старый.') else begin ARes:=RegKeyStrParamRead('HKLM','SOFTWARE\Adobe\Acrobat Reader\'+CVer+'.0\Installer','ENU_GUID'); AVer:=RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+ARes,'DisplayVersion'); if AVer