0

Hello Security Experts!

I am implementing a small web application where users can cast votes. On the one hand, I want ballots to by anonymous. So the username is not stored with the ballot. But on the other hand I want that each user can verify for himself, that his vote was accounted for. So I thought about this process:

When a user casts a vote, then he must enter his password. (Of course his password is never stored directly anywhere!) The backend creates a HASH value of the users password. And only that hash value is stored with the ballot. All ballots are publicly available, including their hashes.

So when a user wants to verify that his vote was accounted for, then he can simply recreate his hash value and look it up in the list of public ballots.


Initially I thought about MD5 but then I found that there are stronger, better Hash algorythm. Now i use BCRYPT.

But the Java implementatin of BCRYPT needs a new seed value everytime you want to hash a password. I found out that JBCRYPT stores the seed together with the hashed password.

=> Is that ok? Is that normal? => Could I create one initial seed once, store that and then reuse the same seed value everytime a vote is casted? Or would that be a security risk.

Why do I need that? My functional requirement is a little different than with normal password hashing. When checking a hashed password then you know where to look: Does that specific hash value (at that user) fit the provided password. My requirement is different: The user has a password. When this password is hashed, is the the hash value then contained in a list of hash values.

How can I implement this?

  • What's wrong with using PGP sigantures? They can't easily be cracked if using a weak password. – J.A.K. Mar 10 '17 at 14:27
  • Is it a requirement that each user only vote once? – Xiong Chiamiov Mar 10 '17 at 15:53
  • 1
    Have you researched any other auditable voting systems, like Punchscan? – Xiong Chiamiov Mar 10 '17 at 15:56
  • Yes every user must vote only once (or not at all). – Robert Mar 10 '17 at 20:57
  • Thank you very much for the hint to "punchscan". Up to now, I only knew "Three Ballot voting" (which has been broken). I will have a deeper look at punchscan. – Robert Mar 10 '17 at 21:30
2

You shouldn't make public your users' hashed passwords, even if they were hashed using a strong algorithm like bcrypt. An attacker could easily download them and bruteforce them, and recover some of the passwords.

The bcrypt "seed" is the salt used to protect against rainbow table attacks. A salt MUST be unique, so using the same salt for every hash is a really bad idea.


You should look at this question who faces the same problem than you, and has already some answers.

| improve this answer | |
  • Thank you very much for the link to the other question. That was exactly what I was looking for. .... uh oh I see a lot of coding nights coming may way :-) – Robert Mar 10 '17 at 21:02
0

The backend creates a HASH value of the users password. And only that hash value is stored with the ballot.

You have an XY problem. What you want to ask is: How can a user check their vote without me being able to tell which vote belongs to them?

What you do for that is provide a nonce for them at the time they vote which is not stored with the account. They record their nonce when voting and can use that to validate the vote.

| improve this answer | |
  • Yes you are right about the "XY problem". I also wanted a judgement of my current solution. :-) The nonces also sound interesting. As far as I understand you, these nonces would equal "the right to vote in this ballot". Assuming a central authority ("the server") would give out these nonces, how could the server validate that a nonce inside a posted ballot is valid? – Robert Mar 10 '17 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.