11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

38 Part I: Introduction to <strong>Threats</strong> <strong>and</strong> CountermeasuresPoor Key Generation or Key ManagementAttackers can decrypt encrypted data if they have access to the encryption key or c<strong>and</strong>erive the encryption key. Attackers can discover a key if keys are managed poorly orif they were generated in a non-r<strong>and</strong>om fashion.Countermeasures to address the threat of poor key generation <strong>and</strong> key managementinclude:● Use built-in encryption routines that include secure key management. DataProtection application programming interface (DPAPI) is an example of anencryption service provided on Windows 2000 <strong>and</strong> later operating systems wherethe operating system manages the key.● Use strong r<strong>and</strong>om key generation functions <strong>and</strong> store the key in a restrictedlocation — for example, in a registry key secured with a restricted ACL — if youuse an encryption mechanism that requires you to generate or manage the key.● Encrypt the encryption key using DPAPI for added security.● Expire keys regularly.Weak or Custom EncryptionAn encryption algorithm provides no security if the encryption is cracked or isvulnerable to brute force cracking. Custom algorithms are particularly vulnerable ifthey have not been tested. Instead, use published, well-known encryption algorithmsthat have withstood years of rigorous attacks <strong>and</strong> scrutiny.Countermeasures that address the vulnerabilities of weak or custom encryptioninclude:● Do not develop your own custom algorithms.●●Use the proven cryptographic services provided by the platform.Stay informed about cracked algorithms <strong>and</strong> the techniques used to crack them.Checksum SpoofingDo not rely on hashes to provide data integrity for messages sent over networks.Hashes such as Safe Hash Algorithm (SHA1) <strong>and</strong> Message Digest compressionalgorithm (MD5) can be intercepted <strong>and</strong> changed. Consider the following base 64encoding UTF-8 message with an appended Message Authentication Code (MAC).Plaintext: Place 10 orders.Hash: T0mUNdEQh13IO9oTcaP4FYDX6pU=

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!