From: Miroslav Lichvar Date: Mon, 14 Nov 2016 08:27:07 +0000 (+0100) Subject: ntp: improve replay protection in symmetric mode X-Git-Tag: 3.0-pre1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfb3c3ba449536599f422258c852e43128efa0dc;p=thirdparty%2Fchrony.git ntp: improve replay protection in symmetric mode Always allow update from the first valid response, even if its transmit timestamp is not newer than the currently saved timestamp. This shoud provide a temporary protection in the case where the attacker does have an authenticated packet from future, but the peers are using the same polling interval and the protocol is already synchronised. This could be also useful in the case where the attacker cannot observe the traffic and authentication is disabled. --- diff --git a/ntp_core.c b/ntp_core.c index b92e0e15..50a3aec1 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -1458,7 +1458,7 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr, if ((inst->mode == MODE_CLIENT && valid_packet && !inst->valid_rx) || (inst->mode == MODE_ACTIVE && (valid_packet || !inst->valid_rx) && test5 && !UTI_IsZeroNtp64(&message->transmit_ts) && - (!inst->updated_timestamps || + (!inst->updated_timestamps || (valid_packet && !inst->valid_rx) || UTI_CompareNtp64(&inst->remote_ntp_tx, &message->transmit_ts) < 0))) { inst->remote_ntp_rx = message->receive_ts; inst->remote_ntp_tx = message->transmit_ts;