From 8c98a259ada01d5506743adb1f818dba2866ad10 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Thu, 8 Jun 2023 14:11:07 +0200 Subject: [PATCH] Fix #11: Attack by using a nonce multiple times --- verifier.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/verifier.py b/verifier.py index dda765c..e2286d4 100755 --- a/verifier.py +++ b/verifier.py @@ -55,6 +55,15 @@ while True: with open(input('entries: ')) as f: entries = ast.literal_eval(f.read()) + nonces = set() + for entry in entries: + if type(entry) == str: + break + if entry in nonces: + print('A given nonce was used several times!') + exit(1) + nonces.add(entry) + merkleTreeLevels = [{} for _ in range(common.LEVELS)] for index in indexesRequest: