# CVE-2016-8671: MatrixSSL cryptographic key recovery via pstm_exptmod miscalculation

Source: https://junglewise.ai/threats/cve-2016-8671-matrixssl-cryptographic-key-recovery-via-pstm-exptmod  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2017-01-13. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

CVE-2016-8671 · Severity: medium · CVSS 5.9 · Published 2017-01-13

MatrixSSL, a lightweight TLS/SSL library often used in embedded and IoT devices, contains a flaw in its cryptographic calculations. This vulnerability could allow a remote attacker to potentially recover secret encryption keys by exploiting mathematical errors during secure connections. If successful, an attacker could decrypt sensitive communications or impersonate trusted services.

Technologies: [Matrixssl](https://junglewise.ai/threats/technologies/matrixssl). Vendors: [Matrixssl](https://junglewise.ai/threats/vendors/matrixssl).

## Quick answers

**Is CVE-2016-8671 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2016-8671 being exploited in the wild.

**How severe is CVE-2016-8671?** Medium severity, with a CVSS score of 5.9, published 13 January 2017.

**Which products and versions are affected?** MatrixSSL MatrixSSL 3.8.6 and earlier.

**Is there a fix for CVE-2016-8671?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2016-8671 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2016-8671?** Check whether you run Matrixssl. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A vulnerability exists in the pstm_exptmod function within MatrixSSL's bignum implementation. The function fails to properly perform modular exponentiation for certain inputs, leading to incorrect mathematical results. This issue is an incomplete fix for a previous vulnerability (CVE-2016-6887) where the vendor attempted to mitigate the issue by restricting modulus sizes rather than fixing the underlying calculation logic. A remote attacker can exploit these miscalculations to potentially recover or predict secret key material. The attack requires a high degree of complexity (AC:H) to successfully derive keys from the resulting mathematical errors.

## Affected products

- MatrixSSL MatrixSSL 3.8.6 and earlier

## Timeline

- 2016-08-01: disclosed: Vulnerability reported to vendor
- 2016-10-15: advisory: Public disclosure by The Fuzzing Project
- 2017-01-13: other: NVD publication date

## References

- [http://www.openwall.com/lists/oss-security/2016/10/15/2](http://www.openwall.com/lists/oss-security/2016/10/15/2)
- [http://www.openwall.com/lists/oss-security/2016/10/15/8](http://www.openwall.com/lists/oss-security/2016/10/15/8)
- [http://www.securityfocus.com/bid/95439](http://www.securityfocus.com/bid/95439)
- [https://blog.fuzzing-project.org/54-Update-on-MatrixSSL-miscalculation-CVE-2016-8671%2C-incomplete-fix-for-CVE-2016-6887.html](https://blog.fuzzing-project.org/54-Update-on-MatrixSSL-miscalculation-CVE-2016-8671%2C-incomplete-fix-for-CVE-2016-6887.html)

## Related threats

- [MatrixSSL incorrect modular exponentiation in pstm_exptmod](https://junglewise.ai/threats/cve-2016-6887-matrixssl-incorrect-modular-exponentiation-in-pstm-exptmod)
- [MatrixSSL denial of service in pstm_reverse function](https://junglewise.ai/threats/cve-2016-6886-matrixssl-denial-of-service-in-pstm-reverse-function)
- [MatrixSSL denial of service in pstm_exptmod function](https://junglewise.ai/threats/cve-2016-6885-matrixssl-denial-of-service-in-pstm-exptmod-function)
