CVE-2026-33317 Overview
CVE-2026-33317 is an out-of-bounds read vulnerability affecting OP-TEE, a Trusted Execution Environment (TEE) designed as a companion to a non-secure Linux kernel running on Arm Cortex-A cores using TrustZone technology. The vulnerability exists in the entry_get_attribute_value() function within ta/pkcs11/src/object.c, where missing input validation checks allow an attacker to perform out-of-bounds memory reads from the PKCS#11 Trusted Application (TA) heap, potentially causing a crash or information disclosure.
Critical Impact
When exploited, this vulnerability allows attackers with local access to read up to 7 bytes beyond the template buffer boundary and write beyond the buffer's end using PKCS#11 object attribute values, potentially compromising sensitive cryptographic data stored in the secure world.
Affected Products
- Linaro OP-TEE versions 3.13.0 through 4.10.0
- Systems running Arm Cortex-A cores with TrustZone using affected OP-TEE versions
- Devices utilizing PKCS#11 TA functionality within the affected OP-TEE versions
Discovery Timeline
- 2026-04-24 - CVE-2026-33317 published to NVD
- 2026-04-27 - Last updated in NVD database
Technical Details for CVE-2026-33317
Vulnerability Analysis
This vulnerability represents a classic boundary validation failure in secure world code, which is particularly concerning given OP-TEE's role in protecting sensitive cryptographic operations. The flaw resides in the entry_get_attribute_value() function that processes PKCS#11 attribute templates. When handling the PKCS11_CMD_GET_ATTRIBUTE_VALUE command, the function fails to properly validate template parameters before accessing memory, creating an opportunity for memory corruption.
The vulnerability is classified as CWE-125 (Out-of-bounds Read), indicating that the software reads data past the end or before the beginning of the intended buffer. In the context of a Trusted Execution Environment, this type of vulnerability is especially severe because it could allow leakage of sensitive data from the secure world to the normal world.
Root Cause
The root cause stems from insufficient bounds checking in the entry_get_attribute_value() function. Specifically, three validation gaps were identified:
- Missing template header validation: The code did not verify that the template header structure fits within the buffer before reading it
- Missing overflow checks: Arithmetic operations calculating buffer lengths lacked overflow protection, potentially leading to integer wraparound
- Missing output buffer size validation: The function did not confirm that the output buffer was large enough to hold the template with updated attribute values
These missing checks allowed a malformed template parameter to trigger reads of up to 7 bytes beyond the template buffer boundary and subsequent writes beyond the buffer end.
Attack Vector
The attack requires local access to the system and the ability to invoke PKCS#11 TA functions through the OP-TEE client interface. An attacker with low privileges in the normal world can craft a malicious template parameter with:
- A truncated or malformed attribute header that references memory outside the allocated template buffer
- An attribute size value that, when added to the current position, causes integer overflow
- Template data that triggers the buffer overread when processed by entry_get_attribute_value()
The following patches address the three validation gaps identified in the vulnerable code:
Patch 1: Template consistency validation
for (; cur < end; cur += len) {
struct pkcs11_attribute_head *cli_ref = (void *)cur;
struct pkcs11_attribute_head cli_head = { };
+ uintptr_t cli_end = 0;
void *data_ptr = NULL;
+ if ((char *)(cli_ref + 1) > end) {
+ rc = PKCS11_CKR_ARGUMENTS_BAD;
+ goto out;
+ }
/* Make copy of header so that is aligned properly. */
TEE_MemMove(&cli_head, cli_ref, sizeof(cli_head));
- len = sizeof(*cli_ref) + cli_head.size;
+ if (ADD_OVERFLOW(sizeof(*cli_ref), cli_head.size, &len) ||
+ ADD_OVERFLOW((uintptr_t)cur, len, &cli_end) ||
+ (char *)cli_end > end) {
+ rc = PKCS11_CKR_ARGUMENTS_BAD;
+ goto out;
+ }
/* Treat hidden attributes as missing attributes */
if (attribute_is_hidden(&cli_head)) {
Source: GitHub Commit Fix
Patch 2: Output buffer size validation
goto out;
}
+ /*
+ * We will update the template with relevant data, without resizing it.
+ * Upon completion, it will be copied to client output buffer.
+ */
+ if (out->memref.size < sizeof(*template) + template->attrs_size) {
+ rc = PKCS11_CKR_ARGUMENTS_BAD;
+ goto out;
+ }
/* Iterate over attributes and set their values */
/*
* 1. If the specified attribute (i.e., the attribute specified by the
Source: GitHub Commit Change
Patch 3: Attribute output size handling
attr_type_invalid = 1;
break;
case PKCS11_CKR_BUFFER_TOO_SMALL:
- if (data_ptr)
+ if (data_ptr) {
+ cli_head.size =
+ PKCS11_CK_UNAVAILABLE_INFORMATION;
buffer_too_small = 1;
+ }
break;
default:
rc = PKCS11_CKR_GENERAL_ERROR;
Source: GitHub Commit Update
Detection Methods for CVE-2026-33317
Indicators of Compromise
- Unexpected crashes or faults in the OP-TEE PKCS#11 Trusted Application during cryptographic operations
- Abnormal memory access patterns in OP-TEE secure world logs indicating out-of-bounds access
- Unusual invocations of PKCS11_CMD_GET_ATTRIBUTE_VALUE with malformed or oversized template parameters
- TEE panic events correlated with PKCS#11 attribute retrieval operations
Detection Strategies
- Monitor OP-TEE logs for PKCS11_CKR_ARGUMENTS_BAD error codes which may indicate exploitation attempts against patched systems
- Implement runtime memory bounds checking in TEE debugging environments to catch out-of-bounds access attempts
- Review system logs for repeated PKCS#11 TA invocations with unusual parameter sizes or patterns
- Deploy memory sanitizers (ASan/MSan) in development builds to detect memory access violations during testing
Monitoring Recommendations
- Enable verbose logging for PKCS#11 TA operations to capture detailed parameter information for forensic analysis
- Set up alerts for TEE panic events or secure world exceptions that may indicate exploitation attempts
- Monitor for applications making unusual numbers of PKCS11_CMD_GET_ATTRIBUTE_VALUE calls with varying template sizes
How to Mitigate CVE-2026-33317
Immediate Actions Required
- Update OP-TEE to version 4.11.0 or later when available, which will include all three security patches
- If immediate upgrade is not possible, apply the individual commits e031c4e562023fd9f199e39fd2e85797e4cbdca9, 16926d5a46934c46e6656246b4fc18385a246900, and 149e8d7ecc4ef8bb00ab4a37fd2ccede6d79e1ca to your OP-TEE build
- Review and audit all applications utilizing the PKCS#11 TA interface for proper input validation
- Restrict access to the OP-TEE client interface to only trusted applications and services
Patch Information
Three commits have been released to address this vulnerability and are anticipated to be included in OP-TEE version 4.11.0:
| Commit | Description |
|---|---|
| e031c4e5 | Adds output buffer size validation |
| 16926d5a | Adds template consistency and overflow checks |
| 149e8d7e | Fixes attribute output size handling |
For complete details, refer to the GitHub Security Advisory.
Workarounds
- Disable or restrict access to the PKCS#11 TA if not required for system operation until patching is complete
- Implement application-level input validation for all PKCS#11 template parameters before passing to the TA
- Use access control mechanisms to limit which applications can invoke PKCS#11 TA functions
- Consider deploying additional monitoring and logging around PKCS#11 operations to detect potential exploitation
# Verify OP-TEE version and check for vulnerability
# Check current OP-TEE version in your build configuration
grep -r "CFG_OPTEE_REVISION" /path/to/optee_os/
# If running affected versions 3.13.0-4.10.0, apply patches
cd /path/to/optee_os
git cherry-pick e031c4e562023fd9f199e39fd2e85797e4cbdca9
git cherry-pick 16926d5a46934c46e6656246b4fc18385a246900
git cherry-pick 149e8d7ecc4ef8bb00ab4a37fd2ccede6d79e1ca
# Rebuild and redeploy OP-TEE
make -j$(nproc) all
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


