|
Developing Applications Using The SoftwareShield System > Anti-Hacker Guide > CRC Checking CRC CheckingA CRC (cyclic redundancy check) is a numeric value computed from some source (file, string, digest, etc). Unlike encryption, a CRC value is always the same size regardless of the source size. A CRC is also commonly referred to as a hash or a checksum. There are numerous sources on the internet for information on what a CRC is, so the algorithms wont be discussed in depth here. Regardless - it may be preferable from a security standpoint for you to develop your own CRC algorithm variation based on a well-known cryptographically secure one. (A sample program is provided to help you get started - see below). A CRC can be used to help slow down hackers by computing a CRC checksum of some file (your EXE or a DLL) and comparing the computed value with a stored value from a known and trusted source. If any of the instructions have been changed, the CRC checksum will not match. This can be used by your software team in a couple ways to slow down the crackers: Trojan Server AttackA cracker may try to replace the SSCProt.dll with a Trojan COM server with the exact same interface but whose functions always returns true values.Note that if you are using IronWrapping, this attack is inviable as the SSCProt.dll is embedded and virtualized right inside the encrypted host executable. Thus, even if there was a registered copy of the SSCProt.dll on the machine elsewhere and it was replaced with a Trojan, this attack would fail because the IronWrapped application will only ever use the embedded COM server. If you are not using IronWrapping, you can use a CRC value to attempt to defeat this attack: The basic premise is:
Binary Instruction Replacement AttackNote that the best way - by far - to protect your software is to use IronWrapping. If you own the IronWrap edition, and will be using IronWrapping in your software, you should not be concerned with Binary Instruction Replacement Attacks (patches). This is because, the protections that IronWrapping provides, when applied at maximum strength, are at least 1000 times more powerful than any technique you could implement yourself from descriptions in this section. When you are not using IronWrapping, a cracker may simply replace the protection calls in your program to do nothing - ignoring the COM server altogether. In fact - this is a very common attack used by most crackers. You can use a CRC value to attempt to defeat this attack. All 32-bit executables have a CRC checksum field in their programs PE header. You can force your compiler to generate this checksum. Then, using the Win32 API MapFileAndCheckSumA() you can get both the computed checksum and the stored one. Then simply compare them. This of course only works if the cracker doesn't change the stored one, but can sometimes be effective. There are many more sophisticated approaches to using CRCs in your program to detect the integrity of both itself and external modules (dlls) but they are beyond the scope of this help file. You may even wish to consider computing the checksum on just a small section of the file itself instead of the whole thing - this makes the crackers job more difficult. Don't just have EXEs and DLLs check themselves, have them check each other.
|