A group of researchers from Ledger, which produces hardware wallets for cryptocurrency, discovered several vulnerabilities in HSM devices (), which could be used to extract keys or perform a remote attack to replace the firmware of the HSM device. Currently, the report on the issue is only available in French, while an English report is planned for August during the Blackhat USA 2019 conference. An HSM is a specialized external device designed for storing public and private keys used for creating digital signatures and encrypting data.
HSMs significantly enhance security by completely isolating keys from systems and applications, providing only an API to perform basic cryptographic primitives executed on the device side. HSMs are typically used in areas that require the highest level of protection, such as banks, cryptocurrency exchanges, and certification authorities for verifying and generating certificates and digital signatures.
The proposed attack methods allow an unauthenticated user to gain full control over the contents of the HSM, including extracting all cryptographic keys and administrator credentials stored on the device. The issues are caused by a buffer overflow in the internal command handler of PKCS#11 and a flaw in the implementation of cryptographic protection for the firmware, allowing bypassing the firmware verification through the PKCS#1v1.5 digital signature and initiating the upload of custom firmware to the HSM.
As a demonstration, the loading of a modified firmware was organized, into which a backdoor was added that remains active after subsequent installations of the standard firmware updates from the manufacturer. It is claimed that the attack can be carried out remotely (the attack method is not specified, but it likely involves altering the firmware being loaded or sending specially crafted certificates for processing).
The issue was identified during fuzz testing of the internal PKCS#11 command implementation offered in the HSM. The testing was organized by loading a custom module into the HSM using the standard SDL. As a result, a buffer overflow was discovered in the PKCS#11 implementation, which could be exploited not only from the internal HSM environment but also by accessing the PKCS#11 driver from the main operating system of the computer to which the HSM module is connected.
Subsequently, the buffer overflow was exploited to execute code on the HSM side and redefine access parameters. During the examination of the hardware, another vulnerability was found that allowed the loading of new firmware without a digital signature. Ultimately, a custom module was written and uploaded to the HSM that dumps all secrets stored within it.
The name of the manufacturer whose HSM devices have revealed vulnerabilities is not yet disclosed, but it is claimed that the problematic devices are used by some large banks and cloud service providers. It is reported that information about the issues was previously sent to the manufacturer and that they have already fixed the vulnerabilities in a recent firmware update. Independent researchers suggest that the problem may lie with devices from Gemalto, which in May released an update for Sentinel LDK that addresses vulnerabilities, the details of which are currently .
Source: opennet.ru
