It is ECDSA
, except that there is no hashing algorithm in use. Instead, the hashing algorithm just returns the data
that it passes in. This makes it trivial to forge messages with the correct signatures.
|
|
The following is referring to this question on Crypto StackExchange. The answer mentions how the signing of a message is carried out. Referring to the Wikipedia post on ECDSA
signing, in step 1, instead of passing through a hash function, the data is retained. In step 2, $z$ is the $L_n$ leftmost bits of $e$, where $L_n$ is the bit length of the group order $n$. From the NIST entry on ECDSA, the hashing algorithm output must be 160 bits, or 20 bytes.
The first 20 bytes of the signed message is
|
|
The signing algorithm does not care about the value of the username it is trying to sign, or more accurately the string following the first 20 characters. Hence, we can append almost anything to the msg
sent to verify
, with some previously generated signature from sign(username)
, and it will be valid.
Another crucial observation is that {"admin": false, "username": "admin", "admin": true}
is equivalent to {"admin": true, "username": "admin"}
. Hence, we can append "admin": true
to the message previously signed, and send with this forged message the previously requested signature.
Python Implementation:
|
|