-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Observable Timing Discrepancy (Timing Attack) #65
Comments
Definitely worth considering this change. Thanks for the report. I'll evaluate it and when I have decided on the change I'll reply here. |
no problem |
To demonstrate a timing attack on this code, let’s walk through how an attacker could exploit the digestEquals method in the DelegatingDnssecRR class due to its use of Arrays.equals for comparing digests. This method is susceptible because Arrays.equals returns as soon as it detects a mismatch, which could allow an attacker to measure how long it takes for mismatches to be detected and, over many requests, to infer the correct value of the digest. Here’s an outline of a proof-of-concept (PoC) to simulate this attack:
Here’s a PoC to simulate the attack: java import java.util.Arrays; public class TimingAttackPoC {
} Explanation:
This code can be adapted and enhanced to improve precision, such as by averaging timing over multiple runs to minimize noise. Mitigation: Switching to MessageDigest.isEqual would ensure a constant-time comparison, rendering this timing attack ineffectiv |
Seems like this would be astronomically difficult to exploit remotely, but on the other hand it probably costs us very little to switch to a different comparator function. |
An attacker can guess the secret value of digest because it is compared using java.util.Arrays.equals, which is vulnerable to timing attacks. Use java.security.MessageDigest.isEqual to compare values securely.
line:154
/core/java/src/org/minidns/record/DelegatingDnssecRR.java#L154)
The text was updated successfully, but these errors were encountered: