Ledger researchers Gabriel Campana and Jean-Baptiste Bédrune of the crypto-hardware wallet Ledger announced at the annual French security conference SSTIC they had found a way to remotely hijack a hardware security module (HSM). They show how an attacker could gain complete access to the keys and secrets stored on the HSM.
Their paper, "Everybody be cool, this is a robbery!", is in French, but the researchers announced that they will be presenting at Black Hat in August in English.
As the authors pointed out in their Black Hat announcement, "HSMs are widely used by cryptocurrency exchanges to secure crypto assets, by banks to protect cryptographic keys and customer PINs, and by telecommunications operators to manage SIM secrets. Basically, HSMs generate, store and protect cryptographic keys and rely on software and hardware mechanisms to prevent secrets from being stolen."
As far as the revelations go, they also say in the presentation announcement that; "It will demonstrate several attack paths, some of them allowing unauthenticated attackers to take full control of the HSM. The presented attacks allow retrieving all HSM secrets remotely, including cryptographic keys and administrator credentials. Finally, we exploit a cryptographic bug in the firmware signature verification to upload a modified firmware to the HSM. This firmware includes a persistent backdoor that survives a firmware update."
Everyone be cool, this is one heckuva robbery!
The bilingual team at Cryptosense have translated a brief summary of the methods used, and published them in English.
Cryptosense summarized the attack this way:
"They started by using legitimate SDK access to their test HSM to upload a firmware module that would give them a shell inside the HSM. Note that this SDK access was used to discover the attacks, but is not necessary to exploit them.
They then used the shell to run a fuzzer on the internal implementation of PKCS#11 commands to find reliable, exploitable buffer overflows.
They checked they could exploit these buffer overflows from outside the HSM, i.e. by just calling the PKCS#11 driver from the host machine
They then wrote a payload that would override access control and, via another issue in the HSM, allow them to upload arbitrary (unsigned) firmware. It's important to note that this backdoor is persistent – a subsequent update will not fix it.
They then wrote a module that would dump all the HSM secrets, and uploaded it to the HSM."
The HSM module manufacturer (who is not named in the paper) has been notified, and some sort of patch is available from them.
What worries the Cryptosense team most is that a well-funded vulnerability research team at state-level intelligence agencies could have carried out similar work and already discovered this attack. Because it leaves an unfixable backdoor, such hijackers could currently be in deployment.
This HSM attack must cause rethinking and replanning of all HSM usage. If the very function of an HSM has been bypassed and can not be assured to function in the future, the reason to utilize it in the first place has been negated.
— Larry Loeb has written for many of the last century's major "dead tree" computer magazines, having been, among other things, a consulting editor for BYTE magazine and senior editor for the launch of WebWeek.