DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: high
Invalid

off chain order signatures can be replayed on monad

Summary

off chain order signatures can be replayed on monad

Vulnerability Detail

In the readme of the contest we can observe the following statement:

while offering a top-notch trading experience on Arbitrum (and Monad in the future).

As we can see from the snippet, zaros will be available on arbitrum but also monad in the near future. This is important because of the use of off chain orders in the system. Currently the offchain order struct is as follows

struct Data {
uint128 tradingAccountId;
uint128 marketId;
int128 sizeDelta;
uint128 targetPrice;
bool shouldIncreaseNonce;
uint120 nonce;
bytes32 salt;
uint8 v;
bytes32 r;
bytes32 s;
}

From the above code snippet we can see that the struct does not include a way to distinguish the chain ID. this means if a user has the same trading ID on Monad and is in the same market ID, it is possible to replay his signature used on arbitrum and force his account on monad to do an offchain order.

This allows malicious users to move a users funds without their consent.

Impact

A users signature on arbitrum can replayed on monad because of lack of chain id in signature. This will allow a malicious user to create an order of another user when they do not intend to open an order.

Code Snippet

https://github.com/Cyfrin/2024-07-zaros/blob/d687fe96bb7ace8652778797052a38763fbcbb1b/src/perpetuals/leaves/OffchainOrder.sol#L16

Tool used

Manual Review

Recommendation

add a chain id feld to the data struct to ensure that signatures can only be used once on the chain the user desires.

Updates

Lead Judging Commences

inallhonesty Lead Judge
12 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

arnie Submitter
11 months ago
inallhonesty Lead Judge
11 months ago
arnie Submitter
11 months ago
inallhonesty Lead Judge
11 months ago
arnie Submitter
11 months ago
inallhonesty Lead Judge
11 months ago
arnie Submitter
11 months ago
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.