Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session_in/out not reset in mbedtls_ssl_session_reset() #1941

Closed
hanno-becker opened this issue Aug 13, 2018 · 1 comment
Closed

session_in/out not reset in mbedtls_ssl_session_reset() #1941

hanno-becker opened this issue Aug 13, 2018 · 1 comment

Comments

@hanno-becker
Copy link

Problem: mbedtls_ssl_session_reset(), specifically the underlying ssl_session_reset_int(), does not reset the pointers mbedtls_ssl_context::session_in and mbedtls_ssl_context:session_out, but it does free and NULLify the mbedtls_ssl_context::session to which they map after a successful handshake. This leaves them dangling and e.g. makes a subsequent call to mbedtls_ssl_get_max_frag_len() fail with a segmentation fault (see here for the failing access).

Further accesses: There is another entirely unrestricted access to session_out in mbedtls_ssl_get_record_expansion(), i.e. not even guarded by a check that session_out != NULL (moving the subsequent check transform_out != NULL prior to the access would solve the matter).
Apart from that, there don't seem to be further critical accesses to session_in/out: There is an access in ssl_encrypt_buf(), but this is guarded by transform_out != NULL, and transform_out is properly reset in mbedtls_ssl_sessoin_reset(). The same holds for the access in mbedtls_ssl_write_record(). There are similar accesses to session_in in ssl_decrypt_buf() and ssl_prepare_record_content() which are non-critical because they are guarded by a check that transform_in != NULL.

@ciarmcom
Copy link

ARM Internal Ref: IOTSSL-2467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants