Overview

Two buffer overflow vulnerabilities were discovered in the Trusted Platform Module (TPM) 2.0 reference library specification, currently at Level 00, Revision 01.59 November 2019. An attacker who has access to a TPM-command interface can send maliciously-crafted commands to the module and trigger these vulnerabilities. This allows either read-only access to sensitive data or overwriting of normally protected data that is only available to the TPM (e.g., cryptographic keys).

Description

Trusted Platform Module (TPM) technology is a hardware-based solution that provides secure cryptographic functions to the operating systems on modern computers, making it resistant to tampering. As cloud computing and virtualization have become more popular in recent years, software-based TPM implementations have also gained popularity. TPM can be implemented in the form of Discrete, Integrated or Firmware TPM in its hardware form. The virtual TPM’s exists in Hypervisor form or in a purely software-based TPM implementation e.g., swtpm. The Trusted Computing Group (TCG) is responsible for maintaining the TPM specifications, which are actively contributed to by both hardware and software manufacturers. The TCG released the TPM 2.0 specifications in October 2014 and has since revised them multiple times. The latest version, Revision 01.59, was released in November 2019. Many TPM hardware and software manufacturers use these specifications to build firmware that complies with standards and provides a secure interface to sensitive cryptographic data. TPM is employed in a variety of devices, from specialized enterprise-grade hardware to Internet of Things (IoT) appliances.

The TPM Library Specification Architecture documents “Session-based encryption” that allows a cryptographic client application to perform various operations, including those that provide Parameter Encryption capabilities. Session-based encryption may be used to ensure confidentiality of these parameters. The operating system or the client software relies on the TPM to securely provide capabilities such as Cipher Feedback (CFB) for block cipher or streaming hash-based XOR obfuscation of the intended parameter payloads.

Quarkslab security researchers found two vulnerabilities in the way the TPM reference specification processes some of these parameters that are part of TPM commands. An Out Of Bound (OOB) read vulnerability in the CryptParameterDecryption() routine allowed a 2-byte read access to data that was not part of the current session. It was also possible to write 2-bytes past the end of the current command buffer resulting in corruption of memory.

An attacker with access to a device built with a vulnerable version of the TPM can trigger this bug by sending crafted commands to the TPM. The vulnerable TPM can thus be tricked to access data that is not part of the intended operation. As the OS relies on the TPM firmware for these functions, it may be difficult to detect or prevent such access using traditional host-based security capabilities.

Impact

An authenticated, local attacker could send maliciously crafted commands to a vulnerable TPM allowing access to sensitive data. In some cases, the attacker can also overwrite protected data in the TPM firmware. This may lead to a crash or arbitrary code execution within the TPM. Because the attacker’s payload runs within the TPM, it may be undetectable by other components of the target device.

Solution

Apply an update
The Trusted Computing Group (TCG) has released an update to their Errata for TPM2.0 Library Specification with instructions to address these vulnerabilities. To ensure the security of their systems, users should apply any updates provided by hardware and software manufacturers through their supply chain as soon as possible. Updating the firmware of TPM chips may be necessary, and this can be done through an OS vendor or the original equipment manufacturer (OEM). In some cases, the OEM may require resetting the TPM to its original factory default values as part of the update process.

Users in high-assurance computing environments should consider using TPM Remote Attestation to detect any changes to devices and ensure their TPM is tamper proofed. As these attacks involve TPM-based software, mechanisms such as user-password or PIN protection and tpm-totp do not protect against attacks leveraging the vulnerabilities discussed in this article.

Note: the TCG’s Errata covers a larger scope and addresses additional security issues beyond the two vulnerabilities discussed in this advisory.

Acknowledgements

Thanks to Francisco Falcon and Ivan Arce of Quarkslab who researched and reported these vulnerabilities, respectively. The TCG and their members worked closely with us and other vendors to coordinate the disclosure of these vulnerabilities.

This document was written by Vijay Sarvepalli.

Vendor Information


Read More