description: Two strange men called me last night. They call themselves the Bogdanoff twins. I don’t know much about cryptocurrency- can you help them with their scheme?
category: Cryptography - 150
Investigations :
First, let’s have a look to the leaked_source.py file:
Well, we do not have the whole code but we can easily guess what we have to do.
When you see {SOME_HASHING_FUNC}(secret+command)
it’s about hash length extension attack and you can find some good information about it here
This attack consists in adding a payload in your entry so that when you calculate the new hash, you won’t have to know the secret. This attack would not work if it was SOME_HASHING_FUNC(command+secret).
Let’s now see this service using nc… we obtain this output:
So we have some transaction history and we want to transfer money from cryptowojak123 to not_b0gdan0ff.
We detect 1 interesting transaction fast and it will be useful later:
To inject a payload, we first need to know the secret length (I’ll injection only a ‘;’ for the moment) :
Great, our command is unreadable but our injection worked ! now let send something else than ‘;’, for example ‘;withdraw xXwaltonchaingangXx; deposit not_b0gdan0ff;’:
YEAH ! flag is : WPI{duMp_33t_aNd_g@rn33sh_H1$_wAg3$}