CVE-2021-46951: Vulnerability in Linux Linux
In the Linux kernel, the following vulnerability has been resolved: tpm: efi: Use local variable for calculating final log size When tpm_read_log_efi is called multiple times, which happens when one loads and unloads a TPM2 driver multiple times, then the global variable efi_tpm_final_log_size will at some point become a negative number due to the subtraction of final_events_preboot_size occurring each time. Use a local variable to avoid this integer underflow. The following issue is now resolved: Mar 8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Mar 8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy] Mar 8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20 Mar 8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4 Mar 8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206 Mar 8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f Mar 8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d Mar 8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073 Mar 8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5 Mar 8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018 Mar 8 15:35:12 hibinst kernel: FS: 0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000 Mar 8 15:35:12 hibinst kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Mar 8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0 Mar 8 15:35:12 hibinst kernel: Call Trace: Mar 8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7 Mar 8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0 Mar 8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260 Mar 8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy] Mar 8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370 Mar 8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0 Mar 8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
AI Analysis
Technical Summary
CVE-2021-46951 is a vulnerability identified in the Linux kernel's TPM (Trusted Platform Module) EFI (Extensible Firmware Interface) driver code. The issue arises from the use of a global variable, efi_tpm_final_log_size, which is used to calculate the final log size when reading TPM event logs via the tpm_read_log_efi function. When the TPM2 driver is loaded and unloaded multiple times, repeated calls to tpm_read_log_efi cause the global variable to be decremented repeatedly by final_events_preboot_size, eventually resulting in an integer underflow that causes efi_tpm_final_log_size to become negative. This underflow leads to incorrect memory operations, including a memcpy call with invalid parameters, which can cause kernel crashes or memory corruption. The vulnerability is triggered during TPM event log processing, specifically when the TPM2 driver is registered or unregistered multiple times, as indicated by the kernel stack trace showing a crash in __memcpy during tpm_read_log_efi execution. The root cause is the improper use of a global variable for size calculation instead of a local variable, which was fixed by changing the code to use a local variable to avoid the underflow. Although no known exploits are reported in the wild, the vulnerability can cause denial of service through kernel panics or potentially lead to memory corruption, which might be leveraged for privilege escalation or other attacks if combined with other vulnerabilities. The vulnerability affects Linux kernel versions identified by the commit hashes listed, and it is relevant to systems using TPM2 drivers, particularly in virtualized environments (e.g., QEMU) where TPM virtualization (vtpm) is used, as indicated by the kernel logs referencing vtpm_proxy_work. No CVSS score has been assigned to this vulnerability yet.
Potential Impact
For European organizations, the impact of CVE-2021-46951 primarily involves potential system instability and denial of service on Linux systems utilizing TPM2 drivers, especially in environments that load and unload these drivers frequently, such as virtualized infrastructures or cloud platforms. Organizations relying on TPM for hardware-based security functions, including secure boot, measured boot, and cryptographic key storage, may experience disruptions if the kernel crashes or memory corruption occurs. This could affect critical infrastructure, financial institutions, government agencies, and enterprises that depend on Linux servers for secure operations. While direct exploitation for privilege escalation is not confirmed, the possibility of memory corruption introduces a risk vector that could be chained with other vulnerabilities. The vulnerability may also impact development and testing environments where TPM drivers are frequently reloaded. Given the widespread use of Linux in European data centers, cloud providers, and embedded systems, unpatched systems could face operational disruptions and increased risk exposure.
Mitigation Recommendations
To mitigate CVE-2021-46951, European organizations should: 1) Apply the latest Linux kernel updates that include the patch fixing the integer underflow by using a local variable instead of a global one in the TPM EFI driver code. 2) Review and limit the frequent loading and unloading of TPM2 drivers where possible, especially in virtualized environments, to reduce the risk of triggering the vulnerability. 3) Monitor kernel logs for signs of crashes or memory corruption related to TPM event log processing and investigate any anomalies promptly. 4) For environments using TPM virtualization (vtpm), ensure that virtualization platforms and hypervisors are also updated to compatible versions that handle TPM driver interactions safely. 5) Implement robust kernel crash recovery and system monitoring to minimize downtime in case of exploitation. 6) Conduct thorough testing of kernel updates in staging environments before deployment to production to avoid unexpected disruptions. 7) Maintain an inventory of Linux systems using TPM2 drivers to prioritize patching and risk assessment.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Poland, Italy, Spain
CVE-2021-46951: Vulnerability in Linux Linux
Description
In the Linux kernel, the following vulnerability has been resolved: tpm: efi: Use local variable for calculating final log size When tpm_read_log_efi is called multiple times, which happens when one loads and unloads a TPM2 driver multiple times, then the global variable efi_tpm_final_log_size will at some point become a negative number due to the subtraction of final_events_preboot_size occurring each time. Use a local variable to avoid this integer underflow. The following issue is now resolved: Mar 8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Mar 8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy] Mar 8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20 Mar 8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4 Mar 8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206 Mar 8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f Mar 8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d Mar 8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073 Mar 8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5 Mar 8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018 Mar 8 15:35:12 hibinst kernel: FS: 0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000 Mar 8 15:35:12 hibinst kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Mar 8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0 Mar 8 15:35:12 hibinst kernel: Call Trace: Mar 8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7 Mar 8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0 Mar 8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260 Mar 8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy] Mar 8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370 Mar 8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0 Mar 8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
AI-Powered Analysis
Technical Analysis
CVE-2021-46951 is a vulnerability identified in the Linux kernel's TPM (Trusted Platform Module) EFI (Extensible Firmware Interface) driver code. The issue arises from the use of a global variable, efi_tpm_final_log_size, which is used to calculate the final log size when reading TPM event logs via the tpm_read_log_efi function. When the TPM2 driver is loaded and unloaded multiple times, repeated calls to tpm_read_log_efi cause the global variable to be decremented repeatedly by final_events_preboot_size, eventually resulting in an integer underflow that causes efi_tpm_final_log_size to become negative. This underflow leads to incorrect memory operations, including a memcpy call with invalid parameters, which can cause kernel crashes or memory corruption. The vulnerability is triggered during TPM event log processing, specifically when the TPM2 driver is registered or unregistered multiple times, as indicated by the kernel stack trace showing a crash in __memcpy during tpm_read_log_efi execution. The root cause is the improper use of a global variable for size calculation instead of a local variable, which was fixed by changing the code to use a local variable to avoid the underflow. Although no known exploits are reported in the wild, the vulnerability can cause denial of service through kernel panics or potentially lead to memory corruption, which might be leveraged for privilege escalation or other attacks if combined with other vulnerabilities. The vulnerability affects Linux kernel versions identified by the commit hashes listed, and it is relevant to systems using TPM2 drivers, particularly in virtualized environments (e.g., QEMU) where TPM virtualization (vtpm) is used, as indicated by the kernel logs referencing vtpm_proxy_work. No CVSS score has been assigned to this vulnerability yet.
Potential Impact
For European organizations, the impact of CVE-2021-46951 primarily involves potential system instability and denial of service on Linux systems utilizing TPM2 drivers, especially in environments that load and unload these drivers frequently, such as virtualized infrastructures or cloud platforms. Organizations relying on TPM for hardware-based security functions, including secure boot, measured boot, and cryptographic key storage, may experience disruptions if the kernel crashes or memory corruption occurs. This could affect critical infrastructure, financial institutions, government agencies, and enterprises that depend on Linux servers for secure operations. While direct exploitation for privilege escalation is not confirmed, the possibility of memory corruption introduces a risk vector that could be chained with other vulnerabilities. The vulnerability may also impact development and testing environments where TPM drivers are frequently reloaded. Given the widespread use of Linux in European data centers, cloud providers, and embedded systems, unpatched systems could face operational disruptions and increased risk exposure.
Mitigation Recommendations
To mitigate CVE-2021-46951, European organizations should: 1) Apply the latest Linux kernel updates that include the patch fixing the integer underflow by using a local variable instead of a global one in the TPM EFI driver code. 2) Review and limit the frequent loading and unloading of TPM2 drivers where possible, especially in virtualized environments, to reduce the risk of triggering the vulnerability. 3) Monitor kernel logs for signs of crashes or memory corruption related to TPM event log processing and investigate any anomalies promptly. 4) For environments using TPM virtualization (vtpm), ensure that virtualization platforms and hypervisors are also updated to compatible versions that handle TPM driver interactions safely. 5) Implement robust kernel crash recovery and system monitoring to minimize downtime in case of exploitation. 6) Conduct thorough testing of kernel updates in staging environments before deployment to production to avoid unexpected disruptions. 7) Maintain an inventory of Linux systems using TPM2 drivers to prioritize patching and risk assessment.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- Linux
- Date Reserved
- 2024-02-25T13:45:52.722Z
- Cisa Enriched
- true
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 682d9834c4522896dcbe9893
Added to database: 5/21/2025, 9:09:08 AM
Last enriched: 6/30/2025, 5:56:44 PM
Last updated: 8/12/2025, 3:33:03 AM
Views: 11
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.