Repository navigation
Make RPC password resistant to timing attacks - #2886
Conversation
Fixes issue#2838; this is a tweaked version of pull#2845 that should not leak the length of the password and is more generic, in case we run into other situations where we need timing-attack-resistant comparisons.
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/42656ea2e552b027e174fdceab7348ffcb8245c4 for binaries and test log. |
|
ACK |
1 similar comment
|
ACK |
|
ACK. This does leak some timing data if bsize==0 or not, but I think this is inconsequential, I'm only mentioning it in case others didn't realize it and might care. |
Make RPC password resistant to timing attacks
Eliminates the possibility of timing attacks by changing the way the two passwords are compared. It iterates through each char in the strings, and if the two chars it is comparing aren't the same, then it adds 1 to nReturn and the function, once it's done comparing all the chars, will return false. Previously, the function would return false on the first char that didn't match, allowing a possible attacker to run a timing attack. See bitcoin/bitcoin#2886 http://rdist.root.org/2010/01/07/timing-independent-array-comparison/ for more detailed explanation.
Eliminates the possibility of timing attacks by changing the way the two passwords are compared. It iterates through each char in the strings, and if the two chars it is comparing aren't the same, then it adds 1 to nReturn and the function, once it's done comparing all the chars, will return false. Previously, the function would return false on the first char that didn't match, allowing a possible attacker to run a timing attack. See bitcoin/bitcoin#2886 http://rdist.root.org/2010/01/07/timing-independent-array-comparison/ for more detailed explanation.
Eliminates the possibility of timing attacks by changing the way the two passwords are compared. It iterates through each char in the strings, and if the two chars it is comparing aren't the same, then it adds 1 to nReturn and the function, once it's done comparing all the chars, will return false. Previously, the function would return false on the first char that didn't match, allowing a possible attacker to run a timing attack. See bitcoin/bitcoin#2886 http://rdist.root.org/2010/01/07/timing-independent-array-comparison/ for more detailed explanation.
Thanks to Gavin, bitcoin#2886
Fixes issue#2838; this is a tweaked version of pull#2845 that
should not leak the length of the password and is more generic,
in case we run into other situations where we need
timing-attack-resistant comparisons.