{ Скрипт AVZ для обнаружения наиболее часто используемых уязвимостей. Версия 1.19 Автор: AndreyKa, участник форума virusinfo.info Скрипт может свободно распространяться, при условии сохранения данного комментария Постоянный адрес скрипта: http://dataforce.ru/~kad/ScanVuln.txt } var ICounter : Integer; 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 WinVuln; var AOSVer, ASP, AResult, ID : string; IMinVer, IOSVer, IEVer : integer; IMinSubVer: Extended; FS : TFileSearch; 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 begin IOSVer:=4; AddToLog('Жизненный цикл Windows 2000 закончился'); AddToLog('http://support.microsoft.com/lifecycle/?p1=3071'); AddToLog(''); end; if AOSVer = '5.1' then if ASP < 'Service Pack 3' then AddToLog('Установите Service Pack 3 для Windows XP') 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 if ASP < 'Service Pack 1' then begin AddToLog('Установите Service Pack 1 и 2 для Windows Vista'); if IsWOW64 then begin AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID=86d267bd-dfcd-47cf-aa76-dc0626dcdf10'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID=8ad69826-03d4-488c-8f26-074800c55bc3'); end else begin AddToLog('http://www.microsoft.com/downloads/details.aspx?familyid=F559842A-9C9B-4579-B64A-09146A0BA746&displaylang=ru'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID=891ab806-2431-4d00-afa3-99ff6f22448d'); end; AddToLog(''); end; if ASP = 'Service Pack 1' then IOSVer := 31; if ASP = 'Service Pack 2' then IOSVer := 32; end; if AOSVer = '6.1' then IOSVer := 40; if IOSVer = 0 then exit; // не удалось определить версию SP ОС или ОС не поддреживается if IsWOW64 then IOSVer := IOSVer + 100; AddToLog('Поиск критических уязвимостей'); IMinVer := 0; case IOSVer of 4 : begin IMinVer := 7203; ID := 'E22EB3AE-1295-4FE2-9775-6F43C5C2AED3'; end; 13 : begin IMinVer := 5694; ID := '0D5F9B6E-9265-44B9-A376-2067B73D6A03'; end; 22 : begin IMinVer := 4392; ID := 'F26D395D-2459-4E40-8C92-3DE1C52C390D'; end; 122: begin IMinVer := 4392; ID := 'C04D2AFB-F9D0-4E42-9E1F-4B944A2DE400'; end; end; if IMinVer <> 0 then if IsFileBuldLow('%System32%\Netapi32.dll', IMinVer) then begin AddToLog('Уязвимость службы сервера делает возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end; // http://www.microsoft.com/rus/technet/security/bulletin/MS10-054.mspx IMinVer := 0; case IOSVer of 4 : begin IMinVer := 7365; ID := '267ce982-54a0-418f-ad52-e4963610f714'; end; // MS10-012 13 : begin IMinVer := 6002; ID := '6E5E16F8-C140-4A1D-B898-8417A6BFD4D8'; end; 22 : begin IMinVer := 4733; ID := '230E8559-E6DF-49D5-ACB5-B0CD4BDE0BF4'; end; 122: begin IMinVer := 4733; ID := '03804F59-748E-4832-98E4-2D88564BD10A'; end; end; if IMinVer <> 0 then if IsFileBuldLow('%System32%\drivers\Srv.sys', IMinVer) then begin AddToLog('Уязвимости в протоколе SMB делают возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end; // http://www.microsoft.com/rus/technet/security/bulletin/MS10-013.mspx 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: begin IMinVer := 738; ID := '16787c93-2c95-4c13-8492-be1db9d18146'; end; 9: begin IMinVer := 913; ID := '59a8bc19-02bb-4800-bac1-464f59e1cb7b'; end; end; end; 13 : begin IMinVer := 5908; ID := '7ab53be3-3f42-4e61-a2bc-3ed41d8736ff'; end; 22 : begin IMinVer := 4625; ID := '983c5484-6321-4765-97ec-8d42d42d1f70'; end; 122: begin IMinVer := 4625; ID := '7dc20252-6091-407b-befc-c25e8f5d3fb0'; end; end; if IMinVer <> 0 then if IsFileBuldLow('%System32%\Quartz.dll', IMinVer) then begin AddToLog('Уязвимости в Microsoft DirectShow делают возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end; // Уязвимость элемента ActiveX средства просмотра снимков Microsoft Access делает возможным удаленное выполнение кода // http://www.microsoft.com/rus/technet/security/bulletin/MS08-041.mspx SetKillBit('{F0E42D50-368C-11D0-AD81-00A0C90DC8D9}'); SetKillBit('{F0E42D60-368C-11D0-AD81-00A0C90DC8D9}'); SetKillBit('{F2175210-368C-11D0-AD81-00A0C90DC8D9}'); // Уязвимости в веб-компонентах Microsoft Office делают возможным удаленное выполнение кода // http://www.microsoft.com/rus/technet/security/bulletin/MS09-043.mspx SetKillBit('{0002E543-0000-0000-C000-000000000046}'); SetKillBit('{0002E55B-0000-0000-C000-000000000046}'); SetKillBit('{0002E541-0000-0000-C000-000000000046}'); SetKillBit('{0002E559-0000-0000-C000-000000000046}'); SetKillBit('{0002E512-0000-0000-C000-000000000046}'); SetKillBit('{0002E510-0000-0000-C000-000000000046}'); SetKillBit('{0002E511-0000-0000-C000-000000000046}'); SetKillBit('{0002E533-0000-0000-C000-000000000046}'); SetKillBit('{0002E530-0000-0000-C000-000000000046}'); IMinVer := 0; AResult := RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\Internet Explorer','Version'); AResult := Copy(AResult, 1, 1); if ValidInt(AResult) then begin IEVer:=StrToInt(AResult); if IEVer = 8 then begin IMinSubVer := 6001.18939; case IOSVer of 13: ID := '1662780f-370a-425b-9917-c601eb54a375'; 22: ID := '772e765d-0502-4b0b-bde8-d4f62b96db64'; 122:ID := '863edf45-0d3b-4408-a47c-258dc4a4fd94'; end; end else begin case IOSVer of 4 : case IEVer of 5: begin IMinSubVer := 3888.1400; ID := '0a6c09e5-c655-41a0-a133-78d55267a527'; end; 6: begin IMinSubVer := 2800.1649; ID := 'e2f27eeb-54be-40be-a00e-72867090b8e7'; end; end; 13: case IEVer of 6: begin IMinSubVer := 2900.6003; ID := 'bc949915-4e16-4897-a295-2f99102548ab'; end; 7: begin IMinSubVer := 6000.17080; ID := '4b489f8c-ada0-4051-8284-0a941c04d2ed'; end; end; 22: case IEVer of 6: begin IMinSubVer := 3790.4732; ID := 'b0370e1e-dedf-4fe8-a06c-0e0f0a674205'; end; 7: begin IMinSubVer := 6000.17080; ID := '8753ae27-60a4-475a-b8bc-6a7764480295'; end; end; 122: case IEVer of 6: begin IMinSubVer := 3790.4732; ID := 'd92f5e69-43cf-4615-aa3b-41f9f40bb57b'; end; 7: begin IMinSubVer := 6000.17080; ID := 'fd3e9d06-1f8b-4ef7-84f6-61e85a1767b8'; end; end; end; end; if (IMinSubVer <> 0) and (ID <> '') then if IsFileSubVerLow('%System32%\Mshtml.dll', IMinSubVer) then begin AddToLog('MS10-053 Накопительное обновление безопасности для браузера Internet Explorer'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end; end; if (IOSVer=122) or (IOSVer<14) then if NoKillBit('{E0ECA9C3-D669-4EF4-8231-00724ED9288F}') then begin AddToLog('MS10-034 Накопительное обновление для системы безопасности, устанавливающее флаг блокировки для элемента ActiveX'); case IOSVer of 4: ID := 'd3955983-0079-476e-a488-99713097259c'; 13: ID := '8c3f2e81-c0ea-494a-a47c-4f8982effb49'; 122: ID := '4aa0ec4f-5502-4f2a-9732-975518c34444'; end; AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end; // http://www.microsoft.com/technet/security/bulletin/MS10-042.mspx IMinVer := 0; case IOSVer of 13 : begin IMinVer := 5997; ID := '7C2122BB-0ECF-4467-A3BA-6FB862F603C5'; end; 22 : begin IMinVer := 4726; ID := 'CD4363B2-D7A7-4FFF-8BCD-6FD02BD1AC07'; end; 122: begin IMinVer := 4726; ID := 'A6BAFD3B-C921-466D-BEE0-59A3FE126712'; end; end; if IMinVer <> 0 then begin if IsFileBuldLow('%SystemRoot%\PCHEALTH\HELPCTR\Binaries\Helpsvc.exe', IMinVer) then begin AddToLog('MS10-042 Уязвимость в Центре справки и поддержки Windows'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end else if not RegKeyExists('HKCR','HCP\shell') then RegKeyParamWrite('HKCR','HCP\shell\open\command','','REG_EXPAND_SZ','%SystemRoot%\PCHEALTH\HELPCTR\Binaries\HelpCtr.exe -FromHCP -url "%1"'); end; // http://securitytracker.com/alerts/2007/Oct/1018843.html SetKillBit('{FDC7A535-4070-4B92-A0EA-D9994BCC0DC5}'); // http://www.microsoft.com/rus/technet/security/bulletin/MS10-046.mspx IMinVer := 0; case IOSVer of 13 : begin IMinVer := 6018; ID := '12361875-B453-45E8-852B-90F2727894FD'; end; 22 : begin IMinVer := 4751; ID := '32FE91EF-5A8D-4095-90EE-2CA216696B09'; end; 122: begin IMinVer := 4751; ID := '923DE214-C4FA-41E6-8307-2C5A37F13E8E'; end; 31 : begin IMinVer := 18505; ID := '52748886-6280-4247-8CBD-F64DB229EE66'; end; 32 : begin IMinVer := 18287; ID := '52748886-6280-4247-8CBD-F64DB229EE66'; end; 131: begin IMinVer := 18505; ID := '37648E95-05C2-4802-9A0F-660200BAA229'; end; 132: begin IMinVer := 18287; ID := '37648E95-05C2-4802-9A0F-660200BAA229'; end; 40 : begin IMinVer := 16644; ID := '22E62B5C-E4C1-47D0-AE4A-8BD2D70D0A0A'; end; 140: begin IMinVer := 16644; ID := '9499F771-C388-4DE3-A5C7-8CC8B00B4395'; end; end; if IMinVer <> 0 then FS := TFileSearch.Create(nil); FS.FindFirst('%System32%\Shell32.dll'); if FS.FileTime < 1023000000 then begin AddToLog('MS10-046 Уязвимость оболочки Windows делает возможным удаленное выполнение кода'); AddToLog('http://www.microsoft.com/downloads/details.aspx?displaylang=ru&FamilyID='+ID); AddToLog(''); ICounter:=ICounter+1; end; FS.Free; 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 SetKillBit(CLSID: string); begin if NoKillBit(CLSID) then RegKeyIntParamWrite('HKLM','SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\'+CLSID,'Compatibility Flags', 1024); end; Procedure AdobeFlashVuln; var AResult : string; begin AResult := RegKeyStrParamRead('HKLM', 'SOFTWARE\Classes\CLSID\{D27CDB6E-AE6D-11cf-96B8-444553540000}\InprocServer32',''); AResult := GetFileVersion(AResult, 6); if IsFlashOld(AResult) then begin AddToLog('Уязвимости в Adobe Flash Player для Internet Explorer'); AddToLog('http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player_ax.exe'); AddToLog(''); ICounter:=ICounter+1; end; AResult := RegKeyStrParamRead('HKLM', 'SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer','Version'); if IsFlashOld(AResult) then begin AddToLog('Уязвимости в Adobe Flash Player для Firefox/Safari/Opera'); AddToLog('http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe'); AddToLog(''); ICounter:=ICounter+1; end; end; function IsFlashOld(AFlVer: string) : boolean; var AVer : string; begin Result := false; if AFlVer = '' then exit; AFlVer := StringReplace(AFlVer, ',', '.'); AVer := Copy(AFlVer, 1, 2); if AVer = '10' then begin Delete(AFlVer, 1, 5); if ValidFloat(AFlVer) then if StrToFloat(AFlVer) < 53.64 then Result:=true; end else Result := true; end; Procedure AdobeReaderVuln; var ARes, AVer, AMinVer, CVer, AKey, AExe : 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; AExe := RegKeyStrParamRead('HKCR','Software\Adobe\Acrobat\Exe',''); ARes := ExtractFilePath(NormalFileName(AExe))+'authplay-.dll'; if (CVer='9') and FileExists(ARes) then DeleteFile(ARes); if Pos('acrobat.exe',LowerCase(AExe)) > 0 then begin if AMinVer = '' then begin AddToLog('Установите Adobe Acrobat 9.3 или удалите старый.'); AddToLog(''); ICounter:=ICounter+1; end else begin ARes:=RegKeyStrParamRead('HKLM','SOFTWARE\Adobe\Adobe Acrobat\'+CVer+'.0\Installer','ENU_GUID'); AVer:=RegKeyStrParamRead('HKLM','SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+ARes,'DisplayVersion'); if AVer'9.52') then exit; AddToLog('Opera '+AVer+' устарела. Удалите её или установите новую'); AddToLog('http://www.opera.com/browser/download'); AddToLog(''); ICounter:=ICounter+1; end; Procedure QuickTimeVuln; var AResult, AVer :string; begin AResult:=RegKeyStrParamRead('HKCR','CLSID\{02BF25D5-8C17-4B23-BC80-D3488ABDDC6B}\InprocServer32',''); if AResult = '' then exit; AVer := GetFileVersion(AResult, 10); if AVer = '' then exit; if AVer<='458753'then begin AddToLog('QuickTime '+GetFileVersion(AResult, 3)+' уязвим. Удалите его или установите новую версию'); AddToLog('http://www.apple.com/quicktime/download'); AddToLog(''); ICounter:=ICounter+1; end; end; begin ICounter:=0; WinVuln; AdobeFlashVuln; AdobeReaderVuln; FireFoxVuln; JavaVuln; OperaVuln; QuickTimeVuln; if (ICounter=0) then AddToLog('Часто используемые уязвимости не обнаружены') else begin AddToLog('Обнаружено уязвимостей: '+IntToStr(ICounter)); SaveLog(GetAVZDirectory+'log\avz_log.txt'); if FileExists(GetAVZDirectory+'log\avz_log.txt') then AddToLog('Протокол сохранён в под-папке log') else begin SaveLog('c:\avz_log.txt'); AddToLog('Протокол сохранён в файле c:\avz_log.txt'); end; end; end.