views:

2290

answers:

16

I've seen it happen reasonably often: I write an application in Delphi and when I compile it, the virus-scanner tells me that I've created a virus and then immediately deletes the executable again. It's annoying but reasonable easy to fix by doing a full rebuild, deleting the *.dcu files first and sometimes by simply waiting.

It happens with Delphi 6, 7, 2005 and 2007, as far as I know. And Symantec, Kaspersky, McAfee and NOD32 have all been guilty of reporting these false positives. I know it's because Delphi adds timestamps to its DCU files and these timestamps end up in the final executable and apparently appear to be part of some random virus signature.

I don't want to disable the virus-scanner, not even for a single folder or file. And I'm not really for a solution, but am wondering about the following:

  • Do these false positives also occur with other compilers?
  • Does it also happen with .NET executables?
  • Do others also notice similar problems with Delphi?
+2  A: 

I've never seen this, having done lots of C++ and .NET development with Visual Studio (from version 1.5 to 2010).

RichieHindle
The first infection by a C# virus is still in progress, so please give it some time. It needs a 250MB framework and administrator rights to install you know. :-)
Wouter van Nifterick
+2  A: 

I've only seen this happen with assemblers. For example, MASM32 actually warns people that it might trigger virus scanners since the EXEs are so small (and/or some viruses are written in assembly). My McAfee scanner flagged some of the example programs as viruses.

This should only happen for virus scanners that have a "looks suspicious" analysis mode.

Jeff Moser
+7  A: 

Sounds more like a heuristic screw-up to me. Do you have heuristics turned on (some scanners may refer to it as "virus-like code")? The chances that time stamps would equate to "a portion of some virus signature" seems too small to be happening all the time.

When I used to run a virus scanner, I never saw this problem with D6 or D7.

JimG
Yes, heuristics are on. Not that I mind, since the computer should be kept secure so I rather deal with the occasional false positive than to be the source of infection. I'm often working on software for the financial market and thus much of it is sensitive information.
Workshop Alex
+3  A: 

This is not that uncommon when using non-standard compilers or when doing fancy low-level stuff: I remember creating false positives when I dabbled in OS-development: AntiVir didn't like some of my flat binaries.

Recently, there's been a post about such a problem at the tinyCC mailing list regading AVG.

Christoph
Actually, I know that I only have to call a single windows API function in a DLL project to trigger alarm bells on almost every virusscanner. (The keyhook API is considered suspicious.) But to get around the false positives, I don't have to change the sourcecode. All I need to do is throw away the DCU files (Delphi Compiled Units) so it will rebuild these again, with different timestamps, thus apparently generating a different signature.
Workshop Alex
+63  A: 

Do these false positives also occur with other compilers?

Yes, this is has been a common problem in the past for AutoIt as addressed in this forum post "Are my AutoIt EXEs really infected?". In most cases including AutoIt it stems from poor heuristic practices. Since AutoIt uses the free and open UPX compressor it is often mistaken for malicious code that also uses UPX.

The best (and possibly only) thing you can do is report these mistakes so they can refine their heuristics or at least white list you app.

Below is a list of contact information for some popular anti-virus companies. They all claim to appreciate submissions as it helps them make their product better.

Turns out there is a great list of AV software at on wikipedia called 'List of antivirus software'. It is more complete then my list above.

Copas
Great list of AV creators!
Gamecat
Very good link indeed!
Workshop Alex
But they are only interested if you are the author. For years McAfee declared an .OBJ file on my system a potentially unwanted program--yet it had no problem with an .EXE incorporating it. I wasn't the author, though, and since it was an old, no-longer-supported version the author wasn't going to do anything.
Loren Pechtel
@Loren: Interesting, I wasn't aware they made such distinctions. Thanks for the heads up!
Copas
Another for your list (I don't have the rep to edit), VIPRE from Sunbelt Software, www.sunbeltsoftware.com
Argalatyr
@Argalatyr - Added Thanks!
Copas
@Copas: that's "Vipre", not "Viper" - since you're trying to set up a reference list
Argalatyr
@Argalatyr - Thanks again, the logo is not of a vipre its of a viper. That might be what caused the typo. :)
Copas
+3  A: 

Yes, my team has experienced this maybe half a dozen times in 2-3 years with Sophos in a corporate environment. So, very rarely, but it does happen.

Our IT cretin started off demanding I review all the 1.5M lines of code in our app to "make it go away", but he didn't get too far pursuing that line...

To be fair, he was initially concerned that our clients might also receive such a warning, but we've only ever seen it triggered when building an exe from the IDE on a developer's PC, never on a release build exe on a test box or elsewhere.

Personally, it happens so rarely we don't worry about it.

Conor Boyd
I'm not worried about this too. It's just annoying since it means some additional delay when building a new executable. It's a bit worse on our automatic build server, though. The compilation goes okay but since the executable is deleted immediately, it just chokes to death on such occasions. But again, it's extremely rare. (And on the build server, a new build run just fixes it again.)
Workshop Alex
+3  A: 

I've had it happen to me with deployed code. The next update to the scanner solved the problem. Some cretin wrote a virus using the same compiler and the signature was part of the runtime library, not actually in the hostile code.

Loren Pechtel
This is similar to the problem AutoIt often has. I feel your pain, with deployed code it is very difficult to (fully) convince the customer that it is a false positive.
Copas
It's in-house for me, I'm known to the people running it.
Loren Pechtel
+2  A: 

In some apps, if I use RtlVclOptimize.pas, the Avira antivirus tell that I have created a virus.

Junior-RO
That's interesting, because Avira doesn't warn me about a virus in all our applications. Maybe it is the combination with other units.
Andreas Hausladen
+2  A: 

plus to what others'v said, modern anti-virus programs rise virus-alert if your programs uses some "suspicious" APIs too ( like URLdownloadFile or other API hooking related ones). if you google "delphi RAT FUD API undetectable" you'll find many interesting topics .

avar
+1  A: 

Some antivirus programs even flag a batch file as a virus and can't be convinced that it isn't. Quite annoying, if that file is part of a third party library and the virus warning is triggered every time TortoiseSVN checks it out. I ended up disabling the virus scanner, deleting the file and doing a commit. (Without disabling the scanner, I could not even do that :-( )

dummzeuch
+1  A: 

A couple of years back, everytime we updated the GNU Linker from mingw sources and started distributing it with our compiler, we got some reports that virusscanners classified ld.exe as virus. (.exes writing .exes ...)

Marco van de Voort
+1  A: 

I would not call it a "false positive", because, strictly speaking, it is not false and the antivirus software is not "guilty" of anything in any way.

I am 99% sure, that this is the heuristic analysis acting up (I bet it detects your executable as something along the lines of win32.virus.generic - note the generic, this is a sign, that this is not in its signature db, but rather was detected by the heuristics) and, with being heuristic and all, it does not give you any kind of guarantee, that whatever it finds is malicious, it just kind of makes it known to you, that the executable is suspicious from its point of view.

The easiest solution to this would be just adding an exception for your file by name (it is always the same name, correct?). If you are uncomfortable with this, you should, probably, make your antivirus software prompt you before taking action so you can make it skip your file manually.

In general, I've found coding in windows with antivirus software somewhat irritating (don't do it much nowadays, but still), especially if the said software is in "paranoid mode". Irritating as it is, though, it is unavoidable (IMO).

shylent
Actually, the problem can occur with ANY source that gets compiled in Delphi so the filename varies. Making an exception for the executable would increase the risk in a very small amount, but I'd need to do that to get around a very rare problem. Especially since there's a simple work-around, it's not a real problem. Just annoying when it happens. And as I said, our systems work on financial applications so we're paranoid all the time. ;-) Annoying, but required.
Workshop Alex
How can it not be a false positive? The AV software falsely identifies it as malware. The meaning of "false positive" depends on the result, not whether the process is reasonable or not. Lots of reasonable processes yield false positives.
David Thornley
+1  A: 

It happened to me too. Hooking keyboard will trigger almost any heuristic scanning AV software to report a key logger. There are probably many other system calls which will trigger it too. Solution - try to redesign your code or contact the AV manufacturer to include your software into exception list.

Had that problem too. Had a Delphi unit that was used in an executable, and it implemented a keyhook. Then the unit was used in a DLL to run under Outlook and it appeared to be working. But it set off quite a few virusscanners except the Kaspersky scanner that I used back then! Then again, it was even worse, since the DLL installed the keyhook in every process. That's not possible when the API is called from an executable.
Workshop Alex
+1  A: 

I remember another weird one:

A file was being flagged as suspect. The only thing is the file was an .OBJ! An .EXE that contained the code the .OBJ contained wasn't considered a problem.

Loren Pechtel
+2  A: 

There is indeed Delphi virus in the wild, see http://www.sophos.com/blogs/sophoslabs/?p=6117

Dmitry
+1  A: 

If you have problems with false positives, there is VirusTotal online service that can help you check your file against number of antivirus engines.
It's free service and currently it can run antivirus check with almost 40 antivirus engines.

zendar
That wouldn't be practical when my AV software reports a virus in some executable that I just compiled. I know it's not a virus, unless I wrote one myself. The problem is that the AV is blocking my compilation process when a false positive is detected. It's annoying.
Workshop Alex
I know. VirusTotal is just a place that can tell you which Antivirus engines falsely see your software as virus and you can then contact them and ask them to fix the problem.
zendar