Simply checking these signatures will tell you if the file is valid or not, which is something many people fail to do. Simply write some code, or distribute a binary that logs keystrokes and sends them as email to a random hotmail account. One thing to note is that software such as autorpm has the option to check files signatures, make sure you use it. These are becoming popular because of the sheer number of UNIX hosts attached to the Internet, and the fact that many are not maintained properly. Worms now have the capacity to infect thousands of hosts and seize control of them, stopping them is usually a matter of maintaining software up to date and other basic security precautions.
Many programs require temporary files to store data, or for other purposes.
The only way to fix this type of problem permanently is to audit the code and make sure that no file creation is done improperly. If you want to audit code for problems, one way to find them is to use L0pht's watch tool, which will monitor a directory for creation of files, and can log them to syslog. Run this program as a daemon on a machine and you can easily find out if any file are being created improperly. This software will not compile out of the box on Linux however. These core dumps are sometimes created improperly, and like race conditions can be exploited to overwrite other files.