Use double HMAC comparision for tokens - upgrade scmp to tsscmp#10
Use double HMAC comparision for tokens - upgrade scmp to tsscmp#10suryagh wants to merge 2 commits intopillarjs:masterfrom
Conversation
|
Thanks! This is good to know. Before we up and switch dependencies, is there a reason why the We can certainly switch modules, but I want to make sure all the bases are covered. |
|
|
|
Ah, @suryagh, thanks for the clarification :) Yes, I would agree that random-time-string-comparison is a different thing than constant-time-string-comparison. Change makes sense to me, then 👍 . I have to keep the pull request open for a while to allow other organization members to comment, just so you know why I'm not merging it just yet, but I don't see an issue. I know the title of the issue says "vulnerability", but I assume it isn't, otherwise hopefully this issue would have been disclosed privately until a fix could have been produced & published. |
|
@suryagh What's the main reason for using base64 representation and string comparison instead of Edit: Mostly just curious if there's a reason to deviate from the confirmed implementation. |
|
@blakeembrey |
|
Gotcha. So |
|
Hi @suryagh, I just used your PR and placed this module in a stress test, and compared to the current implementation, your implementation seems to sometimes end up throwing |
|
@dougwilson this looks to be an issue with the older versions of node where the The v1.0.2 of P.S. it is amazing your benchmarking test is able to catch this timing issue. |
|
Awesome! I've been running for a bit with 1.0.2 without issues. I think the reason I may have seen it is due to running on some elastic infrastructure, where things are spun up in response to traffic load. |
Constant-time string-comparison approach used by scmp is still vulnerable to timing attacks on node. Here is relative recent discussion by node core team. The recommendation is to use double HMAC comparison.
As a fix upgrade to tsscmp that uses the recommended approach implemented in the latest version of node