开发者

VB.net quarantine techniques

开发者 https://www.devze.com 2023-02-13 13:14 出处:网络
I was thin开发者_运维知识库king of an efficient way to add quarantining abilities to my antivirus application:

I was thin开发者_运维知识库king of an efficient way to add quarantining abilities to my antivirus application:

  • copy the file into a specified directory and change its extension to none (*.).
  • save the file's binary code in an XML database.

Which way is better?

However, I have no idea how I will recompile the binary code once the user wants to restore the file.


A way to do this is to encrypt the binary file using an encryption engine and moving it into a quarantine folder, you could create a random password and encrypt the file with that password and store it somewhere (that password could also be encrypted with a master key). That is probably the easiest way of quarantining. To unquaranine, just write the complete opposite of the quarantining code. Enumerate the files into a list and filter it out, then when the user clicks on an item and presses unquarantine, it calls the unquarantine function with the filepath as the variable.


If I had to do this (and again, I wouldn't want to be in this situation in the first place, per my comment), I would use an in-process database engine with native support for encryption and large-format binary data. I think sql compact or sqlite both fit this.

I would not use xml, because it's plain-text and the binary data could be easily extracted, and I would not just change the extension, because the file could still easily be executed. Neither are much of a quarantine.

Note that the renaming option is probably the most "efficient" of what I've seen discussed so far, but when dealing with security software correctness should always be your first concern over efficiency. There are times when you can compromise correctness for performance (3D game rendering software does this all the time, to great effect), but security software is not in this category.

What you can do is optimize later. For example, anti-virus engines use heuristics (rules of thumb that will only hold most of the time) to make their software faster, they do this in a way that favors false positives that must then be more-closely checked rather than potentially missing a threat. This only works because the code that more-closely checks each item was written and battle-tested first.

0

精彩评论

暂无评论...
验证码 换一张
取 消