Interesting malware...affecting the Delphi Compiler?

Published: 2009-08-21
Last Updated: 2009-08-21 16:49:14 UTC
by Rick Wanner (Version: 1)
3 comment(s)

A number of anti-virus vendors are reporting new malware that takes a slightly different approach than the norm.

BitDefender and Kaspersky refer to the virus as Win32.Induc.A. 

What is different about this virus is that it compromises systems running the Delphi compiler.  Once the compiler itself is compromised all resulting code generated by the compiler is also infected.  The virus is relatively simple in that it only wants to propogate, no other payload has been utilized.

A funny side effect is that  in the few days since this virus has been detected in the wild, a number of trojans have been discovered to be affected with the virus.  Obviously they were compiled with an infected Delphi compiler.

According to the people over at BitDefender the easiest way to detect if your Delphi instance is infected is to "check if their compilers' Lib folder contains a SysConst.bak file (the most obvious sign of infection) and to rename it to SysConst.dcu if it exists, overwriting the compromised file, then recompile their applications."

Special thanks to reader Artyom for pointing us to this story.

Update:

A commenter dusted some cobwebs out of my brain by pointing to a paper I read as a lowly undergrad some 25 years ago.  Ken Thompson of Bell Labs fame presented a paper to the Turing Award Lecture entitled "Reflections on Trusting Trust".  In this paper Mr. Thompson mentions the concept of compromising the Unix login binary by first infecting the compiler.

-- Rick Wanner - rwanner at isc dot sans dot org

Keywords: delphi compiler
3 comment(s)

Comments

I immediately flashed back to Ken Thompson's famous "Reflections on Trusting Trust" speech, in which he described compromising the login binary on a UNIX system by first compromising the compiler:
http://cm.bell-labs.com/who/ken/trust.html
Maybe I misunderstood the virus's MO (http://www.sophos.com/blogs/sophoslabs/?p=6117), but I thought it copied SysConst.pas to SysConst.bak, then added content to SysConst.pas, and compiled that infected source file to SysConst.dcu. If one renames SysConst.bak to SysConst.dcu, won't SysConst.pas still be infected? Perhaps copying SysConst.bak to SysConst.pas is what was meant?
Wub, virus copies original SysConst.dcu to SysConst.bak and compiles new (infected) SysConst.dcu from SysConst.pas. The SysConst.pas doesn't contain any additional code after infection - the only file that is modified is SysConst.dcu . So just copy (it's better to copy than to rename, 'cause virus checks for the presence of the SysConst.bak) your SysConst.bak to SysConst.dcu replacing the infected one. Just make sure that your SysConst.dcu is really infected - there is always a chance that SysConst.bak was created by some legitimate third-party patch or software.

Diary Archives