Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1650089

Summary: The ttl option is not correctly managed in broadcast ntp
Product: Red Hat Enterprise Linux 6 Reporter: Welterlen Benoit <bwelterl>
Component: ntpAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-15 10:56:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Welterlen Benoit 2018-11-15 10:42:52 UTC
Description of problem:
With the last version ntp-4.2.6p5-12.el6_9.2.x86_64 that includes this patch: 
--- ntp-4.2.6p5/ntpd/ntp_proto.c.cve-2017-6464  2017-03-22 12:54:11.270454677 +0100
+++ ntp-4.2.6p5/ntpd/ntp_proto.c        2017-03-22 12:54:11.279454706 +0100
@@ -3017,8 +3017,10 @@ peer_xmit(
                        }
                }
                peer->t21_bytes = sendlen;
-               sendpkt(&peer->srcadr, peer->dstadr, sys_ttl[peer->ttl],
-                   &xpkt, sendlen);
+               sendpkt(&peer->srcadr, peer->dstadr,
+                       sys_ttl[(peer->ttl >= sys_ttlmax) ? sys_ttlmax : peer->ttl],
+                       &xpkt, sendlen);
                peer->sent++;
                peer->throttle += (1 << peer->minpoll) - 2;

the ttl option is not correctly managed:
For example:
broadcast 224.0.1.1 ttl 6

will configure a ttl of 1 if the destination address is not in the same network.
But if we add an line 
"ttl 8" in the ntp.conf file, then ttl is then set to 8 (and not 6 ..)


The first issue is that in the patched code, sys_ttlmax is -1 thus peer->ttl is not used but -1 ... 

This is due to this part:

8<---------- 8< ---------------- 8< ---------------- 8< --------
static void
config_ttl(
        struct config_tree *ptree
        )
{
        int i = 0;
        int *curr_ttl;

        curr_ttl = queue_head(ptree->ttl);
        while (curr_ttl != NULL) {
                if (i < COUNTOF(sys_ttl))
                        sys_ttl[i++] = (u_char)*curr_ttl;
                else
                        msyslog(LOG_INFO,
                                "ttl: Number of TTL entries exceeds %lu. Ignoring TTL %d...",
                                (u_long)COUNTOF(sys_ttl), *curr_ttl);

                curr_ttl = next_node(curr_ttl);
        }
        sys_ttlmax = i - 1;
}
8<---------- 8< ---------------- 8< ---------------- 8< --------

ptree->ttl is 0, thus sys_ttlmax is -1 ...

If a ttl is not defined, it should be 127 according to the documentation, that is not the case, even if the broadcast address is for the local network (64).

Version-Release number of selected component (if applicable):
 ntp-4.2.6p5-12.el6_9.2.x86_64

How reproducible:
Easy

Steps to Reproduce:
1. Configure a broadcast with ttl option (or without)
2. Check the ttl of the message
3.

Actual results:
ntp-4.2.6p5-10.el6_8.2.x86_64:
	1. ttl configured to 5:
		- same network: => ttl 64
		- other network: => ttl 160
	2. no ttl option:
		- same network: => ttl 64
		- other network: => ttl 1
ntp-4.2.6p5-12.el6_9.1.x86_64:
	1. ttl configured to 5:
		- same network: => ttl 64
		- other network: => ttl 1
	2. no ttl option:
		- same network: => ttl 64
		- other network: => ttl 1

Expected results:
ttl correctly set according to the configuration.

Additional info:
I honestly don't know exactly what should be the value to ensure security but the documentation and ntp behaviour should match.
Thank you

Comment 2 Miroslav Lichvar 2018-11-15 10:56:34 UTC
The ttl configuration is confusing. The ttl value in the broadcast directive is an index to the array configured by the ttl directive and the CVE-2017-6464 fix prevents using the default values of the array.

This is similar to bug #1548416. Unfortunately, it's probably too late in the RHEL6 life cycle to be fixed.

*** This bug has been marked as a duplicate of bug 1548416 ***

Comment 3 Welterlen Benoit 2018-11-15 14:04:55 UTC
Thank you for the quick answer.
I will write a KCS on it.

Best regards,

Benoit