Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1593580 - (CVE-2018-12327) CVE-2018-12327 ntp: Stack-based buffer overflow in ntpq and ntpdc allows denial of service or code execution
CVE-2018-12327 ntp: Stack-based buffer overflow in ntpq and ntpdc allows deni...
Status: NEW
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20180620,reported=2...
: Security
Depends On: 1599624 1624891 1593581
Blocks: 1593582
  Show dependency treegraph
 
Reported: 2018-06-21 03:04 EDT by Adam Mariš
Modified: 2018-10-09 07:28 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
The ntpq and ntpdc command-line utilities that are part of ntp package are vulnerable to stack-based buffer overflow via crafted hostname. Applications using these vulnerable utilities with an untrusted input may be potentially exploited, resulting in a crash or arbitrary code execution under privileges of that application.
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Mariš 2018-06-21 03:04:22 EDT
Stack-based buffer overflow in ntpq and ntpdc of NTP version 4.2.8p11 allows an attacker to achieve code execution or escalate to higher privileges via a long string as the argument for an IPv4 or IPv6 command-line parameter. NOTE: It is unclear whether there are any common situations in which ntpq or ntpdc is used with a command line from an untrusted source.

References:

https://gist.github.com/fakhrizulkifli/9b58ed8e0354e8deee50b0eebd1c011f
Comment 1 Adam Mariš 2018-06-21 03:04:47 EDT
Created ntp tracking bugs for this issue:

Affects: fedora-all [bug 1593581]
Comment 4 Adam Mariš 2018-07-10 05:32:02 EDT
Statement:

This issue affects the versions of ntp as shipped with Red Hat Enterprise Linux 7. Red Hat Product Security has rated this issue as having a security impact of Low. A future update may address this issue. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.

This issue affects the versions of ntp as shipped with Red Hat Enterprise Linux 6. Red Hat Enterprise Linux 6 is now in Maintenance Support 2 Phase of the support and maintenance life cycle. This has been rated as having a security impact of Low, and is not currently planned to be addressed in future updates. For additional information, refer to the Red Hat Enterprise Linux Life Cycle: https://access.redhat.com/support/policy/updates/errata/.

This issue affects the versions of ntp as shipped with Red Hat Enterprise Linux 5. Red Hat Enterprise Linux 5 is now in Extended Life Phase of the support and maintenance life cycle. This issue is not currently planned to be addressed in future updates. For additional information, refer to the Red Hat Enterprise Linux Life Cycle: https://access.redhat.com/support/policy/updates/errata/.
Comment 5 Adam Mariš 2018-07-10 05:43:53 EDT
Vulnerable code:

 623 static  int
 624 openhost( 
 625     const char *hname
 626     )
 627 {
 628     char temphost[LENHOSTNAME];
 629     int a_info, i;
 630     struct addrinfo hints, *ai = NULL;
 631     register const char *cp;
 632     char name[LENHOSTNAME];
 633     char service[5];
 634 
 635     /*
 636      * We need to get by the [] if they were entered
 637      */
 638 
 639     cp = hname;
 640 
 641     if (*cp == '[') {
 642         cp++;
 643         for (i = 0; *cp && *cp != ']'; cp++, i++)
 644             name[i] = *cp;
 645         if (*cp == ']') {
 646             name[i] = '\0';
 647             hname = name;
 648         } else {
 649             return 0;
 650         }
 651     }

The memory corruption happens in openhost() function which takes the hostname as given on the input and then it copies it into an array allocated on stack called 'name' with a fixed size LENHOSTNAME defined as 256. It doesn't check bounds when doing the copy. The same vulnerable pattern can be found in both ntpq.c and ntpdc.c files. Our builds have stack smashing protection which detects the overflow and terminates the program, making the exploitation (i.e. arbitrary code execution) more difficult.

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