Penetration Test Report (mnemonic): mnemonic   Norwegian electronic voting system

Technical report
Source code audit of Norwegian
electronic voting system
Ministry of Local Government and
Regional Development
Tor E. Bjørstad, <tor@mnemonic.no>
Oslo, 2013-08-07
Source code review of Norway’s electronic voting system mnemonic as
......................................................................................................................................................................
Executive summary
On September 9th 2013, parliamentary elections will be held in Norway. For the 2013
elections, 12 of the 428 local municipalities in Norway will offer their citizens the
opportunity to vote in advance over the Internet, as part of a trial project organized by the
Norwegian Ministry of Local Government and Regional Development.
Internet voting has previously been piloted in 2011, with ten municipalities participating in a
trial run for the local elections. The system is based on an advanced cryptographic voting
protocol that has been designed to maintain the security, anonymity and verifiability of votes
cast online, while requiring a minimum of trust between system components.
The Norwegian Ministry of Local Government and Regional Development hired mnemonic
to perform a “third party review of those parts of the [electronic voting system] that
implement cryptographic primitives and generate keys”, to verify that this is done securely
and correctly.
mnemonic has not discovered any critical cryptographic weaknesses that would preclude the
use of the Internet voting system in the forthcoming election.
The most serious technical issue discovered during the review is an error in an encryption
format for storing password-protected data. If patching this bug before the elections is
deemed too risky, we recommend compensating with operational safeguards, such as strictly
limiting and monitoring access to systems where such data is stored.
A number of other flaws and potential security issues have been uncovered, some of which
require further analysis by the vendor. Based on the audit as a whole, and our current
understanding of the voting system implementation, mnemonic would like to suggest four
main recommendations:
1. Address the security issue(s) caused by cryptographic weaknesses in the password-
based encryption function cipherSymmetrically in the UtilsRBAC class (4.3.2.1).
2. Ensure that sufficient safeguards are in place to maintain the integrity of the audit
events, despite potential vectors for dishonest parties to truncate or manipulate data
from the secure log appenders (4.4.1).
3. Verify that observations made relating to key generation (4.5) do not threaten the
overall security of the protocol, by inadvertently revealing keys, passwords or other
security-critical information.
4. Take concrete actions to improve the overall state of the source code, e.g. by
consolidating and refactoring duplicate code, cleaning up interfaces and
dependencies, documenting technical architecture and usage, and continually
improving quality assurance practices in the development process.
Key stakeholders should review the technical chapters 3 and 4 of the report in detail, and
take appropriate actions to evaluate each of the findings presented, and assess and manage
any associated risks.
Pag e 2
Source code review of Norway’s electronic voting system mnemonic as
......................................................................................................................................................................
Table of Contents
Executive summary ..................................................................................................................... 2
1 Introduction ........................................................................................................................... 5
1.1 Project Mandate .............................................................................................................. 5
1.2 Scope and limitations ..................................................................................................... 5
1.3 Structure of the report .................................................................................................... 6
1.4 Summary of findings ...................................................................................................... 7
1.5 About the author ............................................................................................................. 7
2 Project Description .............................................................................................................. 8
2.1 Methodology and tools .................................................................................................. 8
2.2 Project execution ........................................................................................................... 8
2.3 Areas not covered ........................................................................................................... 9
3 Source code review of Norway’s electronic voting system ................................................. 10
3.1 Structure of the review .................................................................................................. 10
3.2 Introduction to the e-voting codebase ......................................................................... 10
3.3 General impressions ..................................................................................................... 11
3.3.1 Documentation ....................................................................................................... 12
3.3.2 Security levels and encapsulation ......................................................................... 13
3.3.3 Code duplication .................................................................................................... 15
3.3.4 Dead code ............................................................................................................... 17
3.4 Automated testing ........................................................................................................ 18
3.5 On random-number generation .................................................................................. 20
4 Review of low-level security implementation ..................................................................... 22
4.1 Analysis of com.scytl.jbasis .......................................................................................... 22
4.1.1 com.scytl.jbasis.crypto ........................................................................................... 22
4.1.2 com.scytl.jbasis.crypto.bc ..................................................................................... 24
4.1.3 com.scytl.jbasis.math ............................................................................................. 25
4.1.4 com.scytl.jbasis.shares .......................................................................................... 26
4.2 Analysis of com.scytl.evote.protocol ........................................................................... 28
4.2.1 com.scytl.evote.protocol.ciphers .......................................................................... 28
4.2.2 com.scytl.evote.protocol.digests ........................................................................... 32
Pag e 3
Source code review of Norway’s electronic voting system mnemonic as
......................................................................................................................................................................
4.2.3 com.scytl.evote.protocol.engine ............................................................................ 32
4.2.4 com.scytl.evote.protocol.generators ..................................................................... 33
4.2.5 com.scytl.evote.protocol.integration.mixing.base ................................................ 34
4.2.6 com.scytl.evote.protocol.integration.voting .....................................................