When a string is passed in to `ares_create_query` or `ares_mkquery` and uses an escaped trailing dot, like "hello\.", c-ares calculates the string length wrong and subsequently writes outside of the the allocated buffer with one byte. The wrongly written byte is the least significant byte of the 'dnsclass' argument; most commonly 1. Affected versions: c-ares 1.0.0 to and including 1.11.0 Upstream patch: https://c-ares.haxx.se/CVE-2016-5180.patch External References: https://c-ares.haxx.se/adv_20160929.html
Created c-ares19 tracking bugs for this issue: Affects: epel-7 [bug 1380468]
Created mingw-c-ares tracking bugs for this issue: Affects: fedora-all [bug 1380465] Affects: epel-6 [bug 1380467]
Created c-ares tracking bugs for this issue: Affects: fedora-all [bug 1380464] Affects: epel-5 [bug 1380466]
The overflowed buffer is heap-allocated using malloc(). Overflow is by only one byte, and the value comes from another parameter (dnsclass) to the affected function. Normally this parameter is not under the attacker's control. For Internet domain resolution (by far the most common case), it must always be 1. As such, the worst possible outcome here is to corrupt the first byte of the following chunk's metadata, which may lead to a panic in a later call to malloc/free/realloc.
Created mingw-c-ares tracking bugs for this issue: Affects: epel-7 [bug 1380576]
Statement: Red Hat Product Security has rated this issue as having Moderate security impact. This issue is not currently planned to be addressed in future updates. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.
Created nodejs tracking bugs for this issue: Affects: fedora-all [bug 1389243] Affects: epel-all [bug 1389244]
Upstream patch (0.10.48): https://github.com/nodejs/node/commit/a14a6a3a1 Upstream patch (4.6.1): https://github.com/nodejs/node/commit/f3c63e7ccf
This issue has been addressed in the following products: Red Hat Software Collections for Red Hat Enterprise Linux 6 Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS Red Hat Software Collections for Red Hat Enterprise Linux 7 Red Hat Software Collections for Red Hat Enterprise Linux 7.2 EUS Red Hat Software Collections for Red Hat Enterprise Linux 7.3 EUS Red Hat Software Collections for Red Hat Enterprise Linux 7.1 EUS Via RHSA-2017:0002 https://rhn.redhat.com/errata/RHSA-2017-0002.html
NodeJS upstream fixed this issue in their bundled c-ares in versions 0.10.48, 0.12.17, and 4.6.1: https://nodejs.org/en/blog/vulnerability/october-2016-security-releases/ https://nodejs.org/en/blog/release/v0.10.48/ https://nodejs.org/en/blog/release/v0.12.17/ https://nodejs.org/en/blog/release/v4.6.1/