Some signatures do not use nonces
Description
Signatures need to be unique in order to prevent replay attacks. This uniqueness is usually achieved through the usage of nonces, which always increase and are included as part of the signature.
In the case of the Signature contract, some of the functions that verify signatures do not use nonces. This means that the signatures they use can be replayed. The following functions do not use nonces:
perpUploadEncodeHashVerify
eventsUploadEncodeHashVerify
marketUploadEncodeHashVerify
Impact
As the signatures can be replayed, the same action could accidentally be performed multiple times. This could lead to undesired behavior for the protocol as a whole. The likelihood of this issue is low, as the signatures are not part of public functions but rather functions used by privileged entities in the system.
Recommendations
We recommend incorporating nonces into the signatures to prevent replay attacks.
Remediation
This finding has been acknowledged by Orderly Networkand has not been remediated due to the low impact. Their official response is paraphrased below:
The
perpUploadEncodeHashVerify
andeventsUploadEncodeHashVerify
functions use thedata.batchId
as nonce, and checks ifbatchId
is the next wanted one, and revertsBatchIdNotMatch
if not.The
marketUploadEncodeHashVerify
does not use a nonce. We acknowledge that, but will not fix in the current version for two reasons:A. This method just uploads the view values and is not used in logic.
B. It is only called by privileged accounts.