Attacking the Diebold Signature Variant – RSA Signatures with Unverified High-order Padding
Abstract
We examine a natural but improper implementation of RSA signature verification deployed on the widely used Diebold Touch Screen and Optical Scan voting machines. In the implemented scheme, the verifier fails to examine a large number of the high-order bits of signature padding and the public exponent is three. We present an very mathematically simple attack that enables an adversary to forge signatures on arbitrary messages in a negligible amount of time.
keywords:
Cryptography , RSA signature , Padding , Voting , Cryptanalysis, ,
1 Background
Standard signatures using the RSA primitive are generally computed in two steps: 1) A one-way transformation is applied to a message to produce an encoded message . 2) The RSA primitive using the private exponent is applied to to generate the signature . Given a signature on a message , verification generally proceeds similarly: 1) Again, the transformation is applied to to obtain the encoded message , and 2) the RSA primitive using the public exponent is applied to the signature to produce . 3) Finally, and are checked for equality, and the signature verifies if and only if they are equivalent.
In this paper, we examine an improperly implemented RSA signature scheme, which uses a public exponent of three, where the verifier fails to compare a large number of the high-order bits of the encoded messages and . We briefly present an simple attack against such implementations that enables an adversary to forge signatures on arbitrary messages in a negligible amount of time. Specifically, the attack works for any transformation function and for all messages when , where is the number of low-order bits of and that are examined, and is the bit-length of the RSA modulus.
This flawed signature scheme has become relevant in practice as we observe multiple instantiations of it in recent (May 2007) versions of the widely used Diebold voting machine firmware.111The code was examined under a charter from the Florida Department of State in June 2007 [8]. We find that the Diebold Touch Screen bootloader 1.3.6 and Optical Scan 1.96.8 employ a natural, yet flawed, implementation of “text-book” RSA where a transformation function is used, and the least significant 160 bits (i.e. the SHA-1 hash) of and are exclusively examined when verifying their equality. The verified signatures cover data [8] that, if unauthenticated, has been publicly reported to enable simple arbitrary software installation [11], vote pre-loading (and pre-removing) [10], arbitrary code execution [15], and a mass spreading, vote stealing virus [6] on the voting machines.
Several other research papers have analyzed variants and flawed constructions of RSA authentication systems and their padding and redundancy schemes. Recently, Bleichenbacher describes an attack under conditions similar to those we examine, where a public exponent of three is used and erroneously implemented signature verification code fails to appropriately verify most of the low-order bits of a PKCS-1 padded message [1]. Examining another standard, Coron, Naccache, and Stern extend a chosen plaintext attack on the RSA cryptosystem by Desmedt and Odlyzko [5] to develop a signature forgery strategy that is effective on a scheme that uses a padding format differing from ISO 9796-1 by only one bit [3]. In addition to these more common modes for RSA, several studies have discovered weaknesses, under varying conditions, in a number of schemes that do not hash messages before signing, but instead apply redundancy bits to them [4, 9, 14, 2, 12, 13].
2 Construction
We now describe the construction of the flawed RSA signature scheme we examine.
Let be an -bit standard RSA modulus equal to the product of two primes, and let denote the private exponent such that . Let be the public exponent. We use the notation to refer to the value obtained by writing bits of as a binary number, where bit is the least significant bit of . Furthermore, in the general scheme we find, a message is transformed into an encoded message using a transformation before it is signed. In practice, the function usually involves hashing and padding the message or applying redundancy to it. However, for the sake of this analysis, we let be any function (where may be approximated as all integers inclusively between and ).
Signature generation on a message then consists of the following two classic computations:
(1) |
(2) |
and the resulting signature is then .
Verification proceeds similarly given a signature and a message . The verifier computes:
(1) |
(2) |
Then, although an appropriate algorithm would verify that , in the faulty construction we find, the verifier checks
for a . The signature is considered valid if and only if the two values are equivalent.
3 Attack
Assuming the verification scheme described above, we now describe a very simple method for forging signatures on arbitrary messages.
Let be any message and . It follows from the construction that if we can find a value , such that
for any integer where , then is a valid signature. (Notice that if , its value is likely to alter the lower bits of the modular reduction, in which case they will no longer match those of .)
In the case where is odd, a solution is almost immediate when we consider the problem in . Since we know the order of , we can find the cube root of . First, using Euclid’s extended algorithm, we find such that .
Claim 1
is a valid signature on when is odd.
[Proof.] by Euler’s theorem. Since was generated as an element of , we know it can be written as an integer less than . Thus, and for some where .
In the case where is even, the same attack does not apply since . Instead, we use a slightly modified approach to obtain a member from that group.
Choose to be the least integer such that , and let be defined as above.
Claim 2
is a valid signature on when is even.
[Proof.] Let . We will first find an upper bound on . Since ,
Further, by our choice of , which we can rewrite
Combining these two inequalities yields
or, by our bound on ,
Thus,
Now, with the above bound, and the fact that , by our choice of . We can conclude . Hence, is a successful forgery iff . Indeed,
Since is odd, is a member of , and just as we saw in the odd case. Therefore, .
4 Conclusion
We have found a natural, but improper implementation of an RSA signature scheme in a highly sensitive application, electronic voting. We present an extremely mathematically simple attack against it, which is also very practical.222We verified the attack for the odd case on an optical scan machine provided by the state of Florida. We hope this subtle, but real flaw emphasizes the challenges of properly securing systems and also stresses the importance of approaching such tasks diligently.333After being notified of the flaw, the vendor improved the signature verification code in new versions of their firmware [7] although existing machines that are not updated remain vulnerable, of course.
Acknowledgments
This research was supported by NSF grant CNS-0524252 and by a grant from the Florida Department of State. We also thank Avi Rubin for his comments and support.
References
- [1] D. Bleichenbacher. RSA signature forgery based on implementation error. Advances in Cryptology – CRYPTO ’06, Rump session, August 2006. Available at http://www.imc.org/ietf-openpgp/mail-archive/msg14307.html.
- [2] E. Brier, C. Clavier, J.-S. Coron, and D. Naccache. Cryptanalysis of RSA signatures with fixed-pattern padding. In Advances in Cryptology – CRYPTO ’01, volume 2139, pages 433–439. Springer-Verlag, 2001.
- [3] J.-S. Coron, D. Naccache, and J. P. Stern. On the security of RSA padding. In Advances in Cryptology – CRYPTO ’99, volume 1666, pages 1–18. Springer-Verlag, 1999.
- [4] W. de Jonge and D. Chaum. Attacks on some RSA signatures. In Advances in Cryptology – CRYPTO ’85, volume 218, pages 18–27. Springer-Verlag, 1986.
- [5] Y. Desmedt and A. M. Odlyzko. A chosen text attack on the RSA cryptosystem and some discrete logarithm schemes. In Advances in Cryptology – CRYPTO ’85, volume 218, pages 516–522. Springer-Verlag, 1986.
- [6] A. J. Feldman, J. A. Halderman, and E. W. Felten. Security analysis of the diebold accuvote-ts voting machine. In USENIX/ACCURATE Electronic Voting Technology Workshop – EVT ’07, 2007.
- [7] D. Gainey, M. Gerke, and A. Yasinsac. Software review and security analysis of the diebold voting machine software, supplemental report. Technical report, Florida Department of State, August 2007.
- [8] R. Gardner, A. Yasinsac, M. Bishop, T. Kohno, Z. Hartley, J. Kerski, D. Gainey, R. Walega, E. Hollander, and M. Gerke. Software review and security analysis of the diebold voting machine software. Technical report, Florida Department of State, July 2007.
- [9] M. Girault and J.-F. Misarsky. Selective forgery of RSA signatures using redundancy. In Advances in Cryptology - EUROCRYPT ’97, volume 1233, pages 495–508. Springer-Verlag, 1997.
- [10] H. Hursti. Critical security issues the diebold optical scan design, July 2005. Available at http://www.blackboxvoting.org/BBVreport.pdf.
- [11] H. Hursti. Diebold tsx evaluation: Critical security issues with diebold tsx, May 2006. Available at http://www.blackboxvoting.org/BBVreportIIunredacted.pdf.
- [12] A. K. Lenstra and I. Shparlinski. Selective forgery of RSA signatures with fixed-pattern padding. In Practice and Theory in Public Key Cryptosystems – PKC ’02, volume 2274, pages 228–236. Springer-Verlag, 2002.
- [13] M. Michels, M. Stadler, and H.-M. Sun. On the security of some variants of the RSA signature scheme. In European Symposium on Research in Computer Security – ESORICS ’98, volume 1485, pages 85–96. Springer-Verlag, 1998.
- [14] J.-F. Misarsky. A multiplicative attack using LLL algorithm on RSA signatures with redundancy. In Advances in Cryptology – CRYPTO ’97, volume 1294, pages 221–234. Springer-Verlag, 1997.
- [15] D. Wagner, D. Jefferson, M. Bishop, C. Karlof, and N. Sastry. Security analysis of the diebold accubasic interpreter. Technical report, Voting Systems Technology Assessment Advisory Board, Office of the Secretary of State of California, February 2006.