FreeBSD VuXML: Documenting security issues in FreeBSD and the FreeBSD Ports Collection

Mbed TLS -- Potential double-free after an out of memory error

Affected packages
mbedtls < 2.16.12
2.17.0 <= mbedtls < 2.28.0

Details

VuXML ID c1b2b492-6999-11ec-a50c-001cc0382b2f
Discovery 2021-12-14
Entry 2021-12-30

Manuel Pégourié-Gonnard reports:

If mbedtls_ssl_set_session() or mbedtls_ssl_get_session() were to fail with MBEDTLS_ERR_SSL_ALLOC_FAILED (in an out of memory condition), then calling mbedtls_ssl_session_free() and mbedtls_ssl_free() in the usual manner would cause an internal session buffer to be freed twice, due to two structures both having valid pointers to it after a call to ssl_session_copy().

An attacker could potentially trigger the out of memory condition, and therefore use this bug to create memory corruption, which could then be further exploited or targetted.

References

CVE Name CVE-2021-44732
URL https://tls.mbed.org/tech-updates/security-advisories/mbedtls-security-advisory-2021-12