DNS

DNS 18 BADTIME vs 23 BADCOOKIE

Both DNS 18 (BADTIME) and 23 (BADCOOKIE) belong to the DNS Response Codes (RCODEs) category. 18 indicates that signature out of time window. The TSIG signature timestamp is outside the allowed clock skew, indicating a time synchronization issue. Meanwhile, 23 means that bad or missing server cookie. The DNS COOKIE option in the request is absent, malformed, or does not match the server's expected value.

Description

Signature out of time window. The TSIG signature timestamp is outside the allowed clock skew, indicating a time synchronization issue.

When You See It

The clocks on the DNS client and server are too far apart (usually more than 5 minutes), causing TSIG signature validation to fail.

How to Fix

Synchronize clocks on both machines using NTP. Check that the TSIG fudge value (allowed skew) is reasonable — the default 300 seconds is usually sufficient.

Description

Bad or missing server cookie. The DNS COOKIE option in the request is absent, malformed, or does not match the server's expected value.

When You See It

Your resolver sent a query without a valid server cookie, or the cookie has expired. This is part of the DNS COOKIE mechanism to prevent spoofed-source attacks.

How to Fix

Retry the query — most resolvers automatically learn the correct server cookie from the first response. If the error persists, ensure your resolver supports RFC 7873 DNS Cookies.

Key Differences

1.

DNS 18: Signature out of time window. The TSIG signature timestamp is outside the allowed clock skew, indicating a time synchronization issue.

2.

DNS 23: Bad or missing server cookie. The DNS COOKIE option in the request is absent, malformed, or does not match the server's expected value.

3.

You encounter 18 when the clocks on the DNS client and server are too far apart (usually more than 5 minutes), causing TSIG signature validation to fail.

4.

You encounter 23 when your resolver sent a query without a valid server cookie, or the cookie has expired. This is part of the DNS COOKIE mechanism to prevent spoofed-source attacks.

When to Use Which

For 18 (BADTIME): Synchronize clocks on both machines using NTP. Check that the TSIG fudge value (allowed skew) is reasonable — the default 300 seconds is usually sufficient. For 23 (BADCOOKIE): Retry the query — most resolvers automatically learn the correct server cookie from the first response. If the error persists, ensure your resolver supports RFC 7873 DNS Cookies.

Learn More