Due to a recent update on Javascript code a full page refresh on your browser might be needed.
Bug 1731324 (CVE-2019-13115) - CVE-2019-13115 libssh2: integer overflow in kex_method_diffie_hellman_group_exchange_sha256_key_exchange in kex.c leads to out-of-bounds write
Summary: CVE-2019-13115 libssh2: integer overflow in kex_method_diffie_hellman_group_e...
Keywords:
Status: NEW
Alias: CVE-2019-13115
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1731325 1732662 1732663 1732664 1732666
Blocks: 1731326
TreeView+ depends on / blocked
 
Reported: 2019-07-19 06:12 UTC by Dhananjay Arunesh
Modified: 2019-09-29 15:17 UTC (History)
3 users (show)

Fixed In Version: libssh2 1.9.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Dhananjay Arunesh 2019-07-19 06:12:16 UTC
A vulnerability was discovered in libssh2 before 1.9.0, kex_method_diffie_hellman_group_exchange_sha256_key_exchange in kex.c has an integer overflow that could lead to an out-of-bounds write in the way packets are read from the server. A remote attacker who compromises a SSH server may be able to execute code on the client system when a user connects to the server. This is related to an _libssh2_check_length mistake, and is different from the various issues fixed in 1.8.1, such as CVE-2019-3855.

Reference:
https://libssh2.org/changes.html
https://github.com/libssh2/libssh2/pull/350
https://github.com/libssh2/libssh2/compare/02ecf17...42d37aa
https://blog.semmle.com/libssh2-integer-overflow/

Comment 1 Dhananjay Arunesh 2019-07-19 06:13:05 UTC
Created libssh2 tracking bugs for this issue:

Affects: fedora-all [bug 1731325]

Comment 3 Huzaifa S. Sidhpurwala 2019-07-24 04:51:35 UTC
External References:

https://blog.semmle.com/libssh2-integer-overflow/

Comment 4 Huzaifa S. Sidhpurwala 2019-07-24 05:06:47 UTC
This is an out-of-bounds read flaw in libssh2, which can be triggered by a malicious MITM SSH server. The flaw can be triggered during the initial Diffie-Hellman key change, therefore no authentication is required by the attacker. This flaw can cause applications compiled with libssh2 to crash. 

However, I believe that a more carefully chosen offset could lead to an information disclosure as it appears that the memory which is read is subsequently returned to the server. The exploitability will depend on the heap layout. 

In libssh2 versions after 1.8.2 the flaw exists in the function  _libssh2_check_length(). Older versions however have no bounds checking at all, and the flaw manifests itself at: https://github.com/libssh2/libssh2/blob/02ecf17a6d5f9837699e8fb3aad0c804caa67eeb/src/kex.c#L1675

The problem is that p_len contains an untrusted value, so the subsequent reads from s could be out-of-bounds.

Comment 9 Kamil Dudka 2019-07-24 13:02:11 UTC
(In reply to Huzaifa S. Sidhpurwala from comment #2)
> Upstream patch at:
> https://github.com/doorsdown/libssh2/commit/
> 7e7189e013db15c6306fab0ddb38c020c0de81ed

The above URL refers to some non-authoritative fork of the project.  This seems to be the actual upstream commit:

https://github.com/libssh2/libssh2/commit/ff1b1557


Note You need to log in before you can comment on or make changes to this bug.