I feel like I’m missing something. I know that HSM can give you 100% bulletproof protection of your keys, encrypted data, etc. But what prevent the attacker from stealing your sensitive data right after you accessed HSM and got your secrets copied to the users memory? Or for example, just use the same API to access the module? How does the application authentication works? If it is based on something simple, like a password, why the attacker cannot just steal the password from the memory, login into the HSM and get what he wants? Also, if the kernel if compromised, I assume it can listen or tamper any communication between a process and the HSM, right?
Share
You’re right to be concerned about this – an HSM is not a panacea, and compromised servers that have the ability to authenticate to and use an HSM are a real risk, as ably demonstrated by Diginotar.
Different HSMs offer different authentication options, e.g. physical tokens (such as smart cards), physical pin entry, logical tokens (in memory keys), custom solutions defined by the user, etc etc.
Ideally when implementing a solution with an HSM, the sensitive keys are never exposed outside the HSM – you get the HSM to use the key (e.g. do the signing / encryption), rather than getting the HSM to give you the key.
HSMs allow you to protect keys such that there is no way to export them from the HSM (even if you have all the credentials of the users / administrators).
Yes; there might be a cryptographically protected channel between the application and HSM, but ultimately a machine with a compromised kernel should be considered an attacker controlled machine – anything the machine can do legitimately, the attacker can use illegitimately.