Mercurial > hg > dhcpcd
changeset 4265:59d30b522937 draft
auth: allow zero value replay detection data
It seems one ISP doesn't use Replay Data and always sets it to zero.
See the comment in the commit as to why this is technically legal,
even if it goes against the intent of the RFC.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Sun, 29 Apr 2018 21:28:15 +0100 |
| parents | b68206d6e0a1 |
| children | bd15cb1af330 |
| files | src/auth.c |
| diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth.c Sun Apr 29 09:31:18 2018 +0100 +++ b/src/auth.c Sun Apr 29 21:28:15 2018 +0100 @@ -151,7 +151,24 @@ memcpy(&replay, d, sizeof(replay)); replay = ntohll(replay); - if (state->token) { + /* + * Test for a replay attack. + * + * NOTE: Some servers always send a replay data value of zero. + * This is strictly compliant with RFC 3315 and 3318 which say: + * "If the RDM field contains 0x00, the replay detection field MUST be + * set to the value of a monotonically increasing counter." + * An example of a monotonically increasing sequence is: + * 1, 2, 2, 2, 2, 2, 2 + * Errata 3474 updates RFC 3318 to say: + * "If the RDM field contains 0x00, the replay detection field MUST be + * set to the value of a strictly increasing counter." + * + * Taking the above into account, dhcpcd will only test for + * strictly speaking replay attacks if it receives any non zero + * replay data to validate against. + */ + if (state->token && state->replay != 0) { if (state->replay == (replay ^ 0x8000000000000000ULL)) { /* We don't know if the singular point is increasing * or decreasing. */
