VYPR
Unrated severityNVD Advisory· Published Feb 14, 2018· Updated Aug 5, 2024

CVE-2017-18187

CVE-2017-18187

Description

Integer overflow in mbed TLS PSK identity parsing before 2.7.0 allows bounds-check bypass, potentially leading to buffer over-read.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Integer overflow in mbed TLS PSK identity parsing before 2.7.0 allows bounds-check bypass, potentially leading to buffer over-read.

Vulnerability

In ARM mbed TLS versions before 2.7.0, the function ssl_parse_client_psk_identity() in library/ssl_srv.c contains an integer overflow vulnerability when parsing PSK identity length. The check if( *p + 2 > end ) and later if( n < 1 || n > 65535 || *p + n > end ) use pointer arithmetic with *p (unsigned char pointer). If *p is near the end of the buffer, adding a large value can wrap around, bypassing the bounds check and allowing the subsequent read to access memory beyond the buffer [1][3]. This affects all versions prior to 2.7.0 [2].

Exploitation

An attacker must be in a position to send a crafted TLS ClientKeyExchange message during a handshake where PSK (Pre-Shared Key) ciphersuite is used. No authentication is required; the attacker only needs network connectivity to the server. By providing a specially crafted PSK identity length that causes an integer overflow in the pointer arithmetic, the bounds check is bypassed, and the server reads an attacker-controlled length of data from the buffer, leading to an out-of-bounds read [3].

Impact

Successful exploitation can lead to a buffer over-read, potentially disclosing sensitive information from the server's memory. In worst-case scenarios, as noted in the Gentoo security advisory, this could lead to arbitrary code execution or denial of service [2]. The exact impact depends on the adjacent memory contents and the server's handling of the parsed identity.

Mitigation

The vulnerability is fixed in mbed TLS version 2.7.0. The fix changes the boundary checks to use subtraction instead of addition, preventing integer overflow: if( end - *p < 2 ) and if( n < 1 || n > 65535 || n > (size_t)( end - *p ) ) [3]. Users should upgrade to version 2.7.0 or later. Gentoo recommends upgrading to version 2.7.2 [2]. No workaround is known.

AI Insight generated on May 26, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

2

Patches

0

No patches discovered yet.

Vulnerability mechanics

Root cause

"An integer overflow in PSK identity parsing allows a bounds-check bypass."

Attack vector

An attacker can send a malformed Client Key Exchange message during the TLS handshake. This message contains a PSK identity length that, when combined with the current pointer position, results in an integer overflow. The overflowed value is then used to determine the size of data to be read, leading to a bounds-check bypass [ref_id=1].

Affected code

The vulnerability exists in the `ssl_parse_client_psk_identity` function located in `library/ssl_srv.c`. The specific lines of code affected by the patch are related to the calculation and checking of the PSK identity length against the available buffer space [ref_id=1].

What the fix does

The patch modifies the bounds check in `ssl_parse_client_psk_identity` to prevent an integer overflow. Previously, the check `*p + n > end` could be bypassed if `*p + n` overflowed to a small value. The new check `n > (size_t) ( end - *p )` correctly calculates the remaining buffer size and compares it against the identity length `n`, ensuring that the read does not exceed the available buffer space [ref_id=1].

Preconditions

  • inputThe attacker must be able to send a crafted Client Key Exchange message during the TLS handshake.
  • configThe server must be configured to use Pre-Shared Key (PSK) cipher suites.

Generated on Jun 3, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.