CVE-2025-7844: wolfTPM library wrapper function `wolfTPM2_RsaKey_TpmToWolf` copies external data to a fixed-size stack buffer without length validation potentially causing stack-based buffer overflow

Published Aug 4, 2025
·
Updated

Exporting a TPM based RSA key larger than 2048 bits from the TPM could overrun a stack buffer if the default MAXRSAKEYBITS=2048 is used. If your TPM 2.0 module supports RSA key sizes larger than 2048 bit and your applications supports creating or importing an RSA private or public key larger than 2048 bits and your application calls wolfTPM2RsaKeyTpmToWolf on that key, then a stack buffer could be overrun. If the MAXRSAKEYBITS build-time macro is set correctly (RSA bits match what TPM hardware is capable of) for the hardware target, then a stack overrun is not possible.

Affected Software

1 affected component
wolfSSL wolfTPM

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Rebuild wolfTPM with the `MAX_RSA_KEY_BITS` build-time macro set correctly so the RSA key bit size range matches what the TPM 2.0 module can support for the deployment target.

    wolfTPM (wolfTPM2_RsaKey_TpmToWolf) MAX_RSA_KEY_BITS = Set to match the TPM hardware’s supported RSA key sizes for the specific build-time hardware target (do not leave default MAX_RSA_KEY_BITS=2048 if TPM supports >2048).
  2. Compensating control

    If TPM 2.0 supports RSA key sizes larger than 2048 and applications may create/import RSA keys >2048 and call `wolfTPM2_RsaKey_TpmToWolf` on them, use external controls to prevent those operations (e.g., disallow or block importing/processing RSA keys larger than 2048 bits until `MAX_RSA_KEY_BITS` is set appropriately and length validation is in place).

Event History

Aug 4, 2025
CVE Published
via MITRE·09:35 PM
Data Sourced
via MITRE·09:35 PM
DescriptionWeakness
Data Sourced
via NVD·10:15 PM
DescriptionSeverityWeakness
Jun 28, 57578
Event
via FIRST·01:54 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-7844?

CVE-2025-7844 has not been assigned a specific severity score but poses a risk of stack buffer overflow due to improperly managed RSA key sizes.

2

How do I fix CVE-2025-7844?

To mitigate CVE-2025-7844, ensure that you configure your TPM to not use RSA keys larger than 2048 bits or upgrade to a more secure implementation if available.

3

Which software is affected by CVE-2025-7844?

CVE-2025-7844 primarily affects the wolfSSL wolfTPM software when exporting RSA keys larger than 2048 bits.

4

What happens if I use larger RSA keys with CVE-2025-7844?

Using RSA keys larger than 2048 bits with CVE-2025-7844 may lead to a stack buffer overflow, potentially compromising system integrity.

5

Is there a workaround for CVE-2025-7844?

A workaround for CVE-2025-7844 is to limit the RSA key size to 2048 bits in affected applications until an official patch is released.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203