ID CVE-2016-0787
Summary The diffie_hellman_sha256 function in kex.c in libssh2 before 1.7.0 improperly truncates secrets to 128 or 256 bits, which makes it easier for man-in-the-middle attackers to decrypt or intercept SSH sessions via unspecified vectors, aka a "bits/bytes confusion bug."
References
Vulnerable Configurations
  • Fedora 22
    cpe:2.3:o:fedoraproject:fedora:22
  • Fedora Project Fedora 23
    cpe:2.3:o:fedoraproject:fedora:23
  • OpenSUSE 13.2
    cpe:2.3:o:opensuse:opensuse:13.2
  • libssh2 1.6.0
    cpe:2.3:a:libssh2:libssh2:1.6.0
  • Debian Linux 7.0
    cpe:2.3:o:debian:debian_linux:7.0
  • Debian Linux 8.0 (Jessie)
    cpe:2.3:o:debian:debian_linux:8.0
CVSS
Base: 4.3 (as of 28-07-2016 - 14:45)
Impact:
Exploitability:
CWE CWE-200
CAPEC
  • Subverting Environment Variable Values
    The attacker directly or indirectly modifies environment variables used by or controlling the target software. The attacker's goal is to cause the target software to deviate from its expected operation in a manner that benefits the attacker.
  • Footprinting
    An attacker engages in probing and exploration activity to identify constituents and properties of the target. Footprinting is a general term to describe a variety of information gathering techniques, often used by attackers in preparation for some attack. It consists of using tools to learn as much as possible about the composition, configuration, and security mechanisms of the targeted application, system or network. Information that might be collected during a footprinting effort could include open ports, applications and their versions, network topology, and similar information. While footprinting is not intended to be damaging (although certain activities, such as network scans, can sometimes cause disruptions to vulnerable applications inadvertently) it may often pave the way for more damaging attacks.
  • Exploiting Trust in Client (aka Make the Client Invisible)
    An attack of this type exploits a programs' vulnerabilities in client/server communication channel authentication and data integrity. It leverages the implicit trust a server places in the client, or more importantly, that which the server believes is the client. An attacker executes this type of attack by placing themselves in the communication channel between client and server such that communication directly to the server is possible where the server believes it is communicating only with a valid client. There are numerous variations of this type of attack.
  • Browser Fingerprinting
    An attacker carefully crafts small snippets of Java Script to efficiently detect the type of browser the potential victim is using. Many web-based attacks need prior knowledge of the web browser including the version of browser to ensure successful exploitation of a vulnerability. Having this knowledge allows an attacker to target the victim with attacks that specifically exploit known or zero day weaknesses in the type and version of the browser used by the victim. Automating this process via Java Script as a part of the same delivery system used to exploit the browser is considered more efficient as the attacker can supply a browser fingerprinting method and integrate it with exploit code, all contained in Java Script and in response to the same web page request by the browser.
  • Session Credential Falsification through Prediction
    This attack targets predictable session ID in order to gain privileges. The attacker can predict the session ID used during a transaction to perform spoofing and session hijacking.
  • Reusing Session IDs (aka Session Replay)
    This attack targets the reuse of valid session ID to spoof the target system in order to gain privileges. The attacker tries to reuse a stolen session ID used previously during a transaction to perform spoofing and session hijacking. Another name for this type of attack is Session Replay.
  • Using Slashes in Alternate Encoding
    This attack targets the encoding of the Slash characters. An attacker would try to exploit common filtering problems related to the use of the slashes characters to gain access to resources on the target host. Directory-driven systems, such as file systems and databases, typically use the slash character to indicate traversal between directories or other container components. For murky historical reasons, PCs (and, as a result, Microsoft OSs) choose to use a backslash, whereas the UNIX world typically makes use of the forward slash. The schizophrenic result is that many MS-based systems are required to understand both forms of the slash. This gives the attacker many opportunities to discover and abuse a number of common filtering problems. The goal of this pattern is to discover server software that only applies filters to one version, but not the other.
Access
VectorComplexityAuthentication
NETWORK MEDIUM NONE
Impact
ConfidentialityIntegrityAvailability
PARTIAL NONE NONE
nessus via4
  • NASL family Fedora Local Security Checks
    NASL id FEDORA_2016-215A2219B1.NASL
    description During the SSHv2 handshake when libssh2 is to get a suitable value for 'group order' in the Diffle Hellman negotiation, it would pass in number of bytes to a function that expected number of bits. This would result in the library generating numbers using only an 8th the number of random bits than what were intended: 128 or 256 bits instead of 1023 or 2047 Using such drastically reduced amount of random bits for Diffie Hellman weakened the handshake security significantly. The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2016-0787 to this issue. Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen 2019-02-21
    modified 2016-10-18
    plugin id 89491
    published 2016-03-04
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89491
    title Fedora 23 : libssh2-1.6.0-4.fc23 (2016-215a2219b1)
  • NASL family Misc.
    NASL id SECURITYCENTER_5_4.NASL
    description According to its self-reported version, the Tenable SecurityCenter application installed on the remote host is prior to 5.4.0. It is, therefore, affected by multiple vulnerabilities : - An arbitrary code execution vulnerability exists in the bundled version of libcurl due to using an insecure path to look for specific libraries, including the current working directory, which may not be under user control. A remote attacker can exploit this to inject and execute arbitrary code in the context of the current user. (CVE-2016-4802) - Multiple flaws exist in the bundled version of libssh due to a failure to securely generate Diffie-Hellman secret keys. A man-in-the-middle attacker can exploit these flaws to intercept and decrypt SSH sessions. (CVE-2016-0739, CVE-2016-0787) - An integer overflow condition exists in the bundled version of libcurl due to improper validation of user-supplied input when handling 'timeval'. An attacker can exploit this to have an unspecified impact. Note that Nessus has not tested for these issues but has instead relied only on the application's self-reported version number.
    last seen 2019-02-21
    modified 2019-01-02
    plugin id 92558
    published 2016-07-26
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=92558
    title Tenable SecurityCenter < 5.4.0 Multiple Vulnerabilities (TNS-2016-12)
  • NASL family Gentoo Local Security Checks
    NASL id GENTOO_GLSA-201606-12.NASL
    description The remote host is affected by the vulnerability described in GLSA-201606-12 (libssh and libssh2: Multiple vulnerabilities) libssh and libssh2 both have a bits/bytes confusion bug and generate an abnormaly short ephemeral secret for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. The resulting secret is 128 bits long, instead of the recommended sizes of 1024 and 2048 bits respectively. Additionally, a double free on dangling pointers in initial key exchange packets within libssh could leave dangling pointers in the session crypto structures. It is possible to send a malicious kexinit package to eventually cause a server to do a double-free before this fix. This could be used for a Denial of Service attack. Impact : Remote attackers may gain access to confidential information due to the short keysize generated by libssh and libssh2, or cause a Denial of Service condition. Workaround : There is no known workaround at this time.
    last seen 2019-02-21
    modified 2016-10-10
    plugin id 91843
    published 2016-06-27
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=91843
    title GLSA-201606-12 : libssh and libssh2: Multiple vulnerabilities
  • NASL family Debian Local Security Checks
    NASL id DEBIAN_DSA-3487.NASL
    description Andreas Schneider reported that libssh2, a SSH2 client-side library, passes the number of bytes to a function that expects number of bits during the SSHv2 handshake when libssh2 is to get a suitable value for'group order' in the Diffie-Hellman negotiation. This weakens significantly the handshake security, potentially allowing an eavesdropper with enough resources to decrypt or intercept SSH sessions.
    last seen 2019-02-21
    modified 2018-11-10
    plugin id 88915
    published 2016-02-24
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=88915
    title Debian DSA-3487-1 : libssh2 - security update
  • NASL family CentOS Local Security Checks
    NASL id CENTOS_RHSA-2016-0428.NASL
    description Updated libssh2 packages that fix one security issue are now available for Red Hat Enterprise Linux 6 and 7. Red Hat Product Security has rated this update as having Moderate security impact. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available from the CVE link in the References section. The libssh2 packages provide a library that implements the SSHv2 protocol. A type confusion issue was found in the way libssh2 generated ephemeral secrets for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. This would cause an SSHv2 Diffie-Hellman handshake to use significantly less secure random parameters. (CVE-2016-0787) Red Hat would like to thank Aris Adamantiadis for reporting this issue. All libssh2 users are advised to upgrade to these updated packages, which contain a backported patch to correct this issue. After installing these updated packages, all running applications using libssh2 must be restarted for this update to take effect.
    last seen 2019-02-21
    modified 2018-11-10
    plugin id 89849
    published 2016-03-11
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89849
    title CentOS 6 / 7 : libssh2 (CESA-2016:0428)
  • NASL family SuSE Local Security Checks
    NASL id OPENSUSE-2016-388.NASL
    description This update for libssh2_org fixes the following issues : Security issue fixed : - CVE-2016-0787 (bsc#967026): Weakness in diffie-hellman secret key generation lead to much shorter DH groups then needed, which could be used to retrieve server keys. A feature was added : - Support of SHA256 digests for DH group exchanges was added (fate#320343, bsc#961964) Bug fixed : - Properly detect EVP_aes_128_ctr at configure time (bsc#933336) This update was imported from the SUSE:SLE-12:Update update project.
    last seen 2019-02-21
    modified 2016-10-13
    plugin id 90166
    published 2016-03-25
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=90166
    title openSUSE Security Update : libssh2_org (openSUSE-2016-388)
  • NASL family OracleVM Local Security Checks
    NASL id ORACLEVM_OVMSA-2016-0035.NASL
    description The remote OracleVM system is missing necessary patches to address critical security updates : - use secrects of the appropriate length in Diffie-Hellman (CVE-2016-0787) - fix basic functionality of libssh2 in FIPS mode (#968575)
    last seen 2019-02-21
    modified 2018-07-24
    plugin id 89860
    published 2016-03-11
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89860
    title OracleVM 3.3 / 3.4 : libssh2 (OVMSA-2016-0035)
  • NASL family Scientific Linux Local Security Checks
    NASL id SL_20160310_LIBSSH2_ON_SL6_X.NASL
    description A type confusion issue was found in the way libssh2 generated ephemeral secrets for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. This would cause an SSHv2 Diffie-Hellman handshake to use significantly less secure random parameters. (CVE-2016-0787) After installing these updated packages, all running applications using libssh2 must be restarted for this update to take effect.
    last seen 2019-02-21
    modified 2018-12-28
    plugin id 89863
    published 2016-03-11
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89863
    title Scientific Linux Security Update : libssh2 on SL6.x, SL7.x i386/x86_64
  • NASL family Huawei Local Security Checks
    NASL id EULEROS_SA-2016-1005.NASL
    description According to the version of the libssh2 package installed, the EulerOS installation on the remote host is affected by the following vulnerability : - A type confusion issue was found in the way libssh2 generated ephemeral secrets for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. This would cause an SSHv2 Diffie-Hellman handshake to use significantly less secure random parameters. (CVE-2016-0787) Note that Tenable Network Security has extracted the preceding description block directly from the EulerOS security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen 2019-02-21
    modified 2018-11-14
    plugin id 99768
    published 2017-05-01
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=99768
    title EulerOS 2.0 SP1 : libssh2 (EulerOS-SA-2016-1005)
  • NASL family SuSE Local Security Checks
    NASL id OPENSUSE-2016-295.NASL
    description This update for libssh2_org fixes the following issues : - fix CVE-2016-0787 (boo#967026) - Weakness in diffie-hellman secret key generation - add CVE-2016-0787.patch
    last seen 2018-09-01
    modified 2016-10-13
    plugin id 89652
    published 2016-03-04
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89652
    title openSUSE Security Update : libssh2_org (openSUSE-2016-295)
  • NASL family Red Hat Local Security Checks
    NASL id REDHAT-RHSA-2016-0428.NASL
    description Updated libssh2 packages that fix one security issue are now available for Red Hat Enterprise Linux 6 and 7. Red Hat Product Security has rated this update as having Moderate security impact. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available from the CVE link in the References section. The libssh2 packages provide a library that implements the SSHv2 protocol. A type confusion issue was found in the way libssh2 generated ephemeral secrets for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. This would cause an SSHv2 Diffie-Hellman handshake to use significantly less secure random parameters. (CVE-2016-0787) Red Hat would like to thank Aris Adamantiadis for reporting this issue. All libssh2 users are advised to upgrade to these updated packages, which contain a backported patch to correct this issue. After installing these updated packages, all running applications using libssh2 must be restarted for this update to take effect.
    last seen 2019-02-21
    modified 2018-11-10
    plugin id 89820
    published 2016-03-10
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89820
    title RHEL 6 / 7 : libssh2 (RHSA-2016:0428)
  • NASL family Oracle Linux Local Security Checks
    NASL id ORACLELINUX_ELSA-2016-0428.NASL
    description From Red Hat Security Advisory 2016:0428 : Updated libssh2 packages that fix one security issue are now available for Red Hat Enterprise Linux 6 and 7. Red Hat Product Security has rated this update as having Moderate security impact. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available from the CVE link in the References section. The libssh2 packages provide a library that implements the SSHv2 protocol. A type confusion issue was found in the way libssh2 generated ephemeral secrets for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. This would cause an SSHv2 Diffie-Hellman handshake to use significantly less secure random parameters. (CVE-2016-0787) Red Hat would like to thank Aris Adamantiadis for reporting this issue. All libssh2 users are advised to upgrade to these updated packages, which contain a backported patch to correct this issue. After installing these updated packages, all running applications using libssh2 must be restarted for this update to take effect.
    last seen 2019-02-21
    modified 2018-07-24
    plugin id 89858
    published 2016-03-11
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89858
    title Oracle Linux 6 / 7 : libssh2 (ELSA-2016-0428)
  • NASL family SuSE Local Security Checks
    NASL id SUSE_SU-2016-0723-1.NASL
    description This update for libssh2_org fixes the following issues : - Add SHA256 support for DH group exchange (fate#320343, bsc#961964) - fix CVE-2016-0787 (bsc#967026) - Weakness in diffie-hellman secret key generation lead to much shorter DH groups then needed, which could be used to retrieve server keys. Note that Tenable Network Security has extracted the preceding description block directly from the SUSE security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen 2019-02-21
    modified 2018-11-29
    plugin id 89923
    published 2016-03-14
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89923
    title SUSE SLED11 / SLES11 Security Update : libssh2_org (SUSE-SU-2016:0723-1)
  • NASL family Debian Local Security Checks
    NASL id DEBIAN_DLA-426.NASL
    description Andreas Schneider reported that libssh2, an SSH2 protocol implementation used by many applications, did not generate sufficiently long Diffie-Hellman secrets. This vulnerability could be exploited by an eavesdropper to decrypt and to intercept SSH sessions. For the oldoldstable distribution (squeeze), this has been fixed in version 1.2.6-1+deb6u2. Although the changelog refers to 'sha256', this version only supports DH SHA-1 key exchange and it is that key exchange method that has been fixed. For the oldstable (wheezy) and stable (jessie) distributions, this will be fixed soon. NOTE: Tenable Network Security has extracted the preceding description block directly from the DLA security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen 2019-02-21
    modified 2018-07-06
    plugin id 88914
    published 2016-02-24
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=88914
    title Debian DLA-426-1 : libssh2 security update
  • NASL family SuSE Local Security Checks
    NASL id SUSE_SU-2016-0718-1.NASL
    description This update for libssh2_org fixes the following issues : Security issue fixed : - CVE-2016-0787 (bsc#967026): Weakness in diffie-hellman secret key generation lead to much shorter DH groups then needed, which could be used to retrieve server keys. A feature was added : - Support of SHA256 digests for DH group exchanges was added (fate#320343, bsc#961964) Bug fixed : - Properly detect EVP_aes_128_ctr at configure time (bsc#933336) Note that Tenable Network Security has extracted the preceding description block directly from the SUSE security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen 2019-02-21
    modified 2018-11-29
    plugin id 89922
    published 2016-03-14
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89922
    title SUSE SLED12 / SLES12 Security Update : libssh2_org (SUSE-SU-2016:0718-1)
  • NASL family F5 Networks Local Security Checks
    NASL id F5_BIGIP_SOL21531693.NASL
    description The diffie_hellman_sha256 function in kex.c in libssh2 before 1.7.0 improperly truncates secrets to 128 or 256 bits, which makes it easier for man-in-the-middle attackers to decrypt or intercept SSH sessions via unspecified vectors, aka a 'bits/bytes confusion bug.' (CVE-2016-0787)
    last seen 2019-02-21
    modified 2019-01-04
    plugin id 92876
    published 2016-08-12
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=92876
    title F5 Networks BIG-IP : libssh2 vulnerability (K21531693)
  • NASL family Fedora Local Security Checks
    NASL id FEDORA_2016-7942EE2CC5.NASL
    description During the SSHv2 handshake when libssh2 is to get a suitable value for 'group order' in the Diffle Hellman negotiation, it would pass in number of bytes to a function that expected number of bits. This would result in the library generating numbers using only an 8th the number of random bits than what were intended: 128 or 256 bits instead of 1023 or 2047 Using such drastically reduced amount of random bits for Diffie Hellman weakened the handshake security significantly. The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2016-0787 to this issue. Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen 2019-02-21
    modified 2016-10-18
    plugin id 89802
    published 2016-03-10
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=89802
    title Fedora 22 : libssh2-1.5.0-2.fc22 (2016-7942ee2cc5)
  • NASL family Amazon Linux Local Security Checks
    NASL id ALA_ALAS-2016-683.NASL
    description A type confusion issue was found in the way libssh2 generated ephemeral secrets for the diffie-hellman-group1 and diffie-hellman-group14 key exchange methods. This would cause an SSHv2 Diffie-Hellman handshake to use significantly less secure random parameters.
    last seen 2019-02-21
    modified 2018-04-18
    plugin id 90365
    published 2016-04-07
    reporter Tenable
    source https://www.tenable.com/plugins/index.php?view=single&id=90365
    title Amazon Linux AMI : libssh2 (ALAS-2016-683)
redhat via4
advisories
bugzilla
id 1306021
title CVE-2016-0787 libssh2: bits/bytes confusion resulting in truncated Diffie-Hellman secret length
oval
OR
  • AND
    • OR
      • comment Red Hat Enterprise Linux 6 Client is installed
        oval oval:com.redhat.rhsa:tst:20100842001
      • comment Red Hat Enterprise Linux 6 Server is installed
        oval oval:com.redhat.rhsa:tst:20100842002
      • comment Red Hat Enterprise Linux 6 Workstation is installed
        oval oval:com.redhat.rhsa:tst:20100842003
      • comment Red Hat Enterprise Linux 6 ComputeNode is installed
        oval oval:com.redhat.rhsa:tst:20100842004
    • OR
      • AND
        • comment libssh2 is earlier than 0:1.4.2-2.el6_7.1
          oval oval:com.redhat.rhsa:tst:20160428007
        • comment libssh2 is signed with Red Hat redhatrelease2 key
          oval oval:com.redhat.rhsa:tst:20152140006
      • AND
        • comment libssh2-devel is earlier than 0:1.4.2-2.el6_7.1
          oval oval:com.redhat.rhsa:tst:20160428009
        • comment libssh2-devel is signed with Red Hat redhatrelease2 key
          oval oval:com.redhat.rhsa:tst:20152140008
      • AND
        • comment libssh2-docs is earlier than 0:1.4.2-2.el6_7.1
          oval oval:com.redhat.rhsa:tst:20160428005
        • comment libssh2-docs is signed with Red Hat redhatrelease2 key
          oval oval:com.redhat.rhsa:tst:20152140010
  • AND
    • OR
      • comment Red Hat Enterprise Linux 7 Client is installed
        oval oval:com.redhat.rhsa:tst:20140675001
      • comment Red Hat Enterprise Linux 7 Server is installed
        oval oval:com.redhat.rhsa:tst:20140675002
      • comment Red Hat Enterprise Linux 7 Workstation is installed
        oval oval:com.redhat.rhsa:tst:20140675003
      • comment Red Hat Enterprise Linux 7 ComputeNode is installed
        oval oval:com.redhat.rhsa:tst:20140675004
    • OR
      • AND
        • comment libssh2 is earlier than 0:1.4.3-10.el7_2.1
          oval oval:com.redhat.rhsa:tst:20160428016
        • comment libssh2 is signed with Red Hat redhatrelease2 key
          oval oval:com.redhat.rhsa:tst:20152140006
      • AND
        • comment libssh2-devel is earlier than 0:1.4.3-10.el7_2.1
          oval oval:com.redhat.rhsa:tst:20160428015
        • comment libssh2-devel is signed with Red Hat redhatrelease2 key
          oval oval:com.redhat.rhsa:tst:20152140008
      • AND
        • comment libssh2-docs is earlier than 0:1.4.3-10.el7_2.1
          oval oval:com.redhat.rhsa:tst:20160428017
        • comment libssh2-docs is signed with Red Hat redhatrelease2 key
          oval oval:com.redhat.rhsa:tst:20152140010
rhsa
id RHSA-2016:0428
released 2016-03-10
severity Moderate
title RHSA-2016:0428: libssh2 security update (Moderate)
rpms
  • libssh2-0:1.4.2-2.el6_7.1
  • libssh2-devel-0:1.4.2-2.el6_7.1
  • libssh2-docs-0:1.4.2-2.el6_7.1
  • libssh2-0:1.4.3-10.el7_2.1
  • libssh2-devel-0:1.4.3-10.el7_2.1
  • libssh2-docs-0:1.4.3-10.el7_2.1
refmap via4
bid 82514
confirm
debian DSA-3487
fedora
  • FEDORA-2016-215a2219b1
  • FEDORA-2016-7942ee2cc5
gentoo GLSA-201606-12
suse openSUSE-SU-2016:0639
Last major update 23-03-2017 - 21:59
Published 13-04-2016 - 13:59
Last modified 30-10-2018 - 12:27
Back to Top