views:

183

answers:

2

Does anyone have any thoughts on how to prevent malware attacks on standalone applications. Let's say this is a program on a Windows machine connected to the internet, this is the most common scenario.

I'm also wondering what type of attacks are possible. I believe .NET will do some type of static check on the code before it runs it, using a type of checksum. This would detect a statically attached malicious code snippet. Can this be gotten around?

What about dynamically injected code. Separate program spaces prevent this to some degree. What about infecting data files? Is it safer to store data in a database and only use service calls no file operations?

What about memory usage techniques to increase security? I know it's not a standalone case, but, the problem with DNS server corruption had to do with a predictable use of, I think, IP addresses. Should memory usage be made more unpredictable?

+2  A: 

I'm also wondering what type of attacks are possible.

What you can check for varies depending on your application. Here are some thoughts that may help you get started:

  • Assuming you have a image editor you will want to be sure that people don't exploit buffer overruns due to bugs in the image encoder/decoder libraries.

  • If you have a browser or a document viewer, you need to check every URL before allowing the user to browse to that URL -- you should disable javascript injection.

  • If you are dealing with sockets, see that you don't allow any arbitrary connections.

  • If you are reading/writing from system clipboard, double check the data and don't leave anything behind. Do proper cleanup.

  • Sign your own binaries and other distributables.

  • If your application deals with security:

  • use a good Crypto library

  • have a threat analysis
  • don't use static passwords

and many many more...

What about dynamically injected code.

This is almost always because of some bugs in your code. Run your code through a static analysis tool and check for buffer overruns and friends.

What about memory usage techniques to increase security?

In a multiuser scenario, your application is already sandboxed to run in each user's own process space. However, it doesn't make sense to sandbox different applications for a single user.

dirkgently
+1  A: 

Most importantly: Don't run as admin, or require that you be run as admin. Use CAS to deny yourself permissions you don't need. That way, if all else fails and you get completely owned, you've only screwed yourself, and not your entire PC.

GWLlosa