{"id":184,"date":"2015-04-26T17:13:28","date_gmt":"2015-04-26T17:13:28","guid":{"rendered":"http:\/\/www.lapsedordinary.net\/?p=184"},"modified":"2015-04-26T17:13:28","modified_gmt":"2015-04-26T17:13:28","slug":"random-rabin-williams-signatures","status":"publish","type":"post","link":"http:\/\/lapsed.ordinary\/2015\/04\/26\/random-rabin-williams-signatures\/","title":{"rendered":"Random Rabin-Williams signatures"},"content":{"rendered":"

Last weekend I was sent a paper on a vulnerability in an implementation of Rabin-Williams signatures. Or, as Google<\/i> suggests, Robin Williams signatures.
\n

\"rabinwilliams\"<\/center>
\nRabin-Williams is an asymmetric cryptosystem of which the security depends on the fact that given a number N<\/i> which is the product of two large primes p<\/i> and q<\/i> (so N = p·q<\/i>), it is very hard to actually find p<\/i> and q<\/i>. This is also what lies behind the security of RSA; in fact Michael Rabin is the ‘R’ from RSA<\/s> (edit<\/i>: he is not, of course, he just happens to share the first letter of his surname with Ron Rivest).
\nMoreover, Rabin-Williams also uses the fact that it is easy to take a square root modulo N<\/i>, assuming one knows p<\/i> and q<\/i> (and especially if certain conditions about p<\/i> and q<\/i> are met), but without this knowledge it is impossible to do in practice (as long as p<\/i> and q<\/i> are sufficiently large). Squaring a number modulo N<\/i> — which is of course the inverse of taking a square root — is trivial, even without knowledge of p<\/i> and q<\/i>.
\nSo in Rabin-Williams, signing or decrypting a message involves taking a square root (which is thus only possible if one knows the private key), while verifying a signature or encrypting a message involves squaring a number, which anyone can do as the public key is, indeed, public. Rabin-Williams is especially useful in cases where the speed of the signing or encrypting operation is important.
\nThere is a caveat though: taking a square root modulo N<\/i> doesn’t give a unique answer. That is less surprising than one might think: taking the square root of 9 in the integers, that is finding a number whose square is 9, gives both 3 and –3 as solutions.
\nIn the case we’re in here, there are in fact four square roots that occur in two pairs: s<\/i>, –s<\/i> and t<\/i>, –t<\/i>. When decrypting a message, one needs some extra information about the message to know which of the four square roots is the correct one. In practice, one might know enough about the message to determine the ‘correct’ square root, while there are also some mathematical ‘fixes’ to ensure the correct square root is always returned.
\nThat signatures aren’t unique isn’t a problem in itself. After all, a signature is merely a proof of something (possession of the private key together with the message) and all that matters it that the receiver can cryptographically verify that the sender did indeed sign the message.
\nThis is all fine if the signing algorithm always returns the same signature — and of course, algorithms have a nice tendency to do that. But there is a big hole one might fall into: knowing one square root in each of the pairs (so s<\/i> or –s<\/i> and t<\/i> or –t<\/i>) makes it trivial to compute p<\/i> and q<\/i> and thus to crack the cryptosystem. (It happens that the difference of these roots, viewed as integers, shares a non-trivial divisor with N<\/i>.)
\nSo it is essential that an adversary never gets hold of multiple signatures (square roots). And this is what goes wrong in the Crypto++<\/i> library: a fix to prevent timing attacks introduces a randomness in the computation of the square roots, which means that the algorithm outputs each possible square root with a probability of 1\/4.
\nIf an adversary is thus able to have the same message signed twice, they are able to crack the private key with a probability of 1\/2. (This probability approaches 1 as more signatures are generated.) This is a serious weakness.
\nIt was discovered by Yandex<\/i> researcher Evgeny Sidorov and was published<\/a> by IACR<\/i> this week. If you like cryptography and number theory, I strongly recommend you read the paper. Evgeny also provides a simple fix to the implementation.
\nWhile admitting that I am far from an expert in this field, I have become a bit wary of Rabin-Williams and the fact that there are four square roots. Mathematics is strong enough to fix all the potential issues. But as always, people remain a big liability. And in the end, it is people who will have to implement the algorithms.<\/p>\n","protected":false},"excerpt":{"rendered":"

Last weekend I was sent a paper on a vulnerability in an implementation of Rabin-Williams signatures. Or, as Google suggests, Robin Williams signatures. Rabin-Williams is an asymmetric cryptosystem of which the security depends on the fact that given a number N which is the product of two large primes p and q (so N = […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/posts\/184"}],"collection":[{"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/comments?post=184"}],"version-history":[{"count":0,"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/posts\/184\/revisions"}],"wp:attachment":[{"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/media?parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/categories?post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/lapsed.ordinary\/wp-json\/wp\/v2\/tags?post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}