Spoofing a Hardware Security Module
Total Page:16
File Type:pdf, Size:1020Kb
DEVELOPING AND CONNECTING ISSA CYBERSECURITY LEADERS GLOBALLY Spoofing a Hardware Security Module By Jeff Stapleton – ISSA member, St. Louis Chapter This article compares valid key management techniques using a cryptographic hardware security module (HSM) with commonly used untrustworthy software-based crypto methods that basically spoof the HSM. Two hardware-based techniques are contrasted with three hybrid-based methods. Security issues for the software-based methods are discussed, and an alternative standards- based scheme is introduced. Abstract This article compares valid key management tech- niques using a cryptographic hardware security module (HSM) with commonly used untrustworthy software-based crypto methods that basically spoof the HSM. Software-based cryptography is generally Figure 1 – Hardware cheaper and easier to implement but at higher risk data encryption of key compromise whereas hardware-based cryp- tography has vastly lower risks but at greater costs and com- key encryption. The HSM spoofing problem arises when the plexity. Attempts at combining software-based crypto with data encryption is performed in software but the key man- hardware-based key management often introduces poor key agement is attempted in cryptographic hardware. Three un- management solutions. Two hardware-based techniques are trustworthy key management methods are contrasted with contrasted with three hybrid-based methods. Security issues the valid techniques: faux key, KMIP unwrapped keys, and for the software-based methods are discussed, and an alter- PKCS#12 password based key derivation functions [2]. The se- native standards-based scheme is introduced. curity weaknesses are explained and an alternate method is in- troduced: database encryption key management (DBEKM) [3]. his article compares valid key management tech- Hardware data encryption niques using a cryptographic hardware security mod- ule (HSM) [1] with commonly used untrustworthy The first HSM key management method discussed is cryp- Tmethods that essentially spoof an HSM. Software-based cryp- tographic hardware-based data encryption shown figure 1, tography is generally cheaper and easier to implement but where an HSM contains the data encryption key within its at higher risk of key compromise, whereas hardware-based cryptographic boundary. To preserve the security of the data cryptography has vastly lower risks but at greater costs and key, the cryptographic algorithm (e.g., AES [4]) used for de- complexity. Attempts at combining software-based crypto cryption and encryption is executed within the cryptograph- with hardware-based key management often introduce poor ic boundary. key management solutions with subtle but serious risks. For data decryption with the cleartext key inside the HSM: Two valid HSM key management methods are described to 1. The application system makes a call to the HSM with the establish a baseline: hardware data encryption and hardware ciphertext. June 2018 | ©2018 ISSA • www.issa.org • [email protected] • All rights reserved. ISSA Journal – 33 Spoofing a Hardware Security Module | Jeff Stapleton 2. The HSM decrypts the ciphertext using the key. 3. The HSM returns the cleartext data back to the application. The application can then process the cleartext and for data encryption: 1. The application system makes a call to the HSM with the cleartext. 2. The HSM encrypts the cleartext using the key. 3. The HSM returns the ciphertext back to the ap- plication. Figure 2 – Hardware key management with data Thus, the application reads ciphertext from storage, encryption decrypts the ciphertext using the HSM, process- es the cleartext, encrypts the cleartext using the HSM, and To maintain the security of the master key, the cryptograph- writes the ciphertext back to storage. The data key and the ic algorithm used for key decryption is executed within the cryptographic algorithm reside within the cryptographic cryptographic boundary. To preserve the security of the data boundary of the HSM. key, the cryptographic algorithm used for data decryption The advantage of hardware-based data encryption is that the and data encryption is likewise executed within the cryp- cryptographic key has strong protection per the HSM physi- tographic boundary. cal and logical controls. One disadvantage is that networked For data decryption with the encrypted key stored outside the HSM have traffic latency that may affect the decrypt and- en HSM: crypt function calls. Cabled HSM have much higher traffic 1. The application system makes a call to the HSM. speeds as do onboard HSM that use the system bus for com- munications. Another disadvantage is the generally higher a. The HSM receives the encrypted data key from the ap- cost of an HSM especially when many architecture designs plication, where it is decrypted using the master key require redundant HSM for application and system availabil- residing within the HSM. ity. b. The HSM receives the data ciphertext from the appli- cation. Hardware Key management with data encryption 2. The HSM decrypts the data ciphertext using the data key. The second HSM key management method discussed is cryp- tographic hardware-based key management with data en- 3. The HSM returns the cleartext data back to the applica- cryption, shown in figure 2, where the data encryption key tion. is stored outside the HSM as an encrypted key. The data key The application can then process the cleartext and for data is encrypted using a master key contained within the HSM. encryption: Click here for On-Demand Conferences www.issa.org/?OnDemandWebConf Breach Report Analysis A Cure for the Common SOC Recorded Live: May 22, 2018 Recorded Live: February 14, 2018 Why Automation is Essential to Vulnerability 2017 Year in Review & Predictions for 2018 Management Recorded Live: January 23, 2018 Recorded Live: May 10, 2018 Mobile Device Security IoT/Mobile Security Recorded Live: September 26, 2017 Recorded Live: April 24, 2018 Blockchain & Other Mythical Technology Untraceable Currency Recorded Live: March 27, 2018 Recorded Live: August 22, 2017 Security Awareness Strategies Here Come the Regulators Recorded Live: March 21, 2018 Recorded Live: July 25, 2017 Privacy vs. Security Building Security in a Business Culture Recorded Live: February 27, 2018 Recorded Live: June 27, 2017 A WEALTH OF RESOURCES FOR THE INFORMATION SECURITY PROFESSIONAL | June 2018 34 – ISSA Journal ©2018 ISSA • www.issa.org • [email protected] • All rights reserved. Spoofing a Hardware Security Module | Jeff Stapleton 4. The application system makes a call to the HSM with the cleartext data. Note that if the data key no longer resides within the HSM from the pre- vious call, then the encrypted data key needs to be passed to the HSM (not shown). 5. The HSM encrypts the cleartext using the data key. 6. The HSM returns the ciphertext back to the ap- plication. Similar to figure 1, the application reads ciphertext Figure 3 – Software data encryption from storage, decrypts the ciphertext using the HSM, pro- ers offer some limited capabilities. The data encryption key cesses the cleartext, encrypts the cleartext using the HSM, might be stored as cleartext bits scattered on disk using a pat- and writes the ciphertext to storage. However, for figure 2 tern supposedly only known to the operating system; this is the master key and data key along with the cryptographic called key obfuscation. Alternatively, the data encryption key algorithms reside within the cryptographic boundary of the might be encrypted using a system symmetric or asymmetric HSM. The HSM functionally separates data decryption from key encryption key (KEK), where the KEK is obfuscated. The key decryption such that cleartext keys cannot be exported obfuscation storage locations are likewise protected using outside its cryptographic boundary. operating system controls and system access controls restrict The advantage of hardware-based key management with data access to the disk storage. encryption is the same for hardware-based data encryption: The advantages of software-based data encryption includes the key has strong protection per the HSM physical and log- lower costs and often less complexity when programing ap- ical controls. Likewise, the disadvantages are traffic latency plications to use cryptographic libraries. Getting an applica- and higher costs. Interestingly, the cryptographic hardware tion to interface with the communications and cryptographic and the application system typically have about the same functions of an HSM can be challenging. However, the major computational power, meaning that cryptographic algo- disadvantage of software-based cryptography is the higher rithms run about the same speed, so either will yield about risk of a key compromise. Further, detecting a key compro- the same throughput. mise is difficult; the key is not missing, rather an adversary Software data encryption has obtain a copy of the key that can be used for data decryp- tion, alteration, or substitution. Software-based data encryption, in contract to hard- ware-based cryptography, is shown in figure 3 where the Faux key method server memory contains the data encryption key. No HSM The first hybrid-based key management method called faux is available to protect the key; only operating system controls key is shown in figure 4, where the data encryption key is and system access controls restrict access to the server mem- stored outside the HSM as an encrypted faux key. The faux ory segment that contains the key and the cryptographic al- key