Facebook CTF 2019 - postquantumsig (Crypto, 125)


Our hot new cryptocurrency uses powerful techniques to make the asymmetric key signatures just as hard to crack on a quantum computer as a binary one. Maybe we forgot something though? Send some money to a weird address if you get any.

nc challenges.fbctf.com 8088

Given : verifier.py, signatures.csv

There’re tons of signatures.

Those format is :
identity | transaction msg | H1, H2, ..., H512 | Others

The part of others is made up of five to six [bit(0 or 1), sha256(?)]

In verifier.py, I found it just do something to hash of transaction msg(bit by bit).

def msg_to_hashes(msg, signature):
# turn a message with signature into an ordered list of key pairs
bit_stream = bit_stream_from_msg(msg)
sign_stream = group_by_n(signature, 2)
return_stream = []
for bit, sign in zip(bit_stream, sign_stream):
if bit:
return return_stream

So, I take a look at signature.csv and found no matter what transaction message is, H1, H2 are




e.g. If the first bit is 0, H1,H2 are


else if the first bit is 1, then H1,H2 are


This seems determined by the hash of transaction message corresponding bit is 0 or 1.

Not only that, I also found out each transaction send by 9bca65c9376209ede04b5df3b02cb832f8997ff978069d171dc9cbfca657f91a using the same value of others to get the identity.

0, d0387c7bd1f8776829397426ee43ed5ce3d640b78379762582e330c9472a2ec0,
0, cc0ab8c97096f3f7894ef4c76c573ea8f65072cf2f58fa72a0ac679718371c1e,
0, d48e7be8713e54c00c0a45786667916459e545ea2795e068a20f18c0a230e476,
0, 017b9a1fa38e2c572de41e02d339ace47d8463ae0b86e9ee9289e5e13539eb84,
0, fc9e2ba2edfd3a75ffee8a6b2b20411763f17575c6aeb76950c777b9ea335370


Maybe …

  1. If I use 9bca65c9376209ede04b5df3b02cb832f8997ff978069d171dc9cbfca657f91a to send the transaction message.

  2. collect all corresponding hash value to make the right set of H1,H2,…H512 depends on the hash of transaction message.

  3. Add that others behind it.

Then I will pass the veritify … ?



After the game, I learned that this algorithm is called Lamport signature or Lamport one-time signature

I hope this message helps xD.