-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users may lose their token when send tokens cross chain #162
Comments
raymondfam marked the issue as primary issue |
raymondfam marked the issue as sufficient quality report |
tom2o17 marked the issue as disagree with severity |
So agree with this issue, Basically I feel that given a user must wait for the nonce to be the same between src chains and must pass the message using the same wallet and amount. tldr: ilf the user really needs to put in work to invoke this error. |
ypatil12 (sponsor) confirmed |
I'm inclined to accept this as high severity. There are requirements for this attack / bug to have the same:
If these conditions are met there will be significant loss of funds. |
kirk-baird marked the issue as satisfactory |
kirk-baird marked issue #391 as primary and marked this issue as a duplicate of 391 |
Agree with the above more so a comment that the conditions to induce the bug are sufficiently difficult to produce, given that the user will have to be listening to cross chain state and be subject to race conditions, all so that the user ....checks notes.... burns their funds. Generally think that when working with invalid state paths it is worth considering the difficulty of producing said bug in the wild, when weighting the severity, but defer to y'all. 🤠 |
@kirk-baird |
Came to comment the same as stalin, the condition required to make this happen are not too straight forward. |
The debate here for this issue and new primary #391 is whether the likelihood of this issue is high enough to qualify for high severity vs medium severity. Looking at each aspect
I'm going to consider the opinions from the sponsor and other wardens here, that this is not sufficient likelihood to qualify for a high severity and downgrade it to medium. |
kirk-baird changed the severity to 2 (Med Risk) |
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/47d34d6d4a5303af5f46e907ac2292e6a7745f6c/contracts/bridge/DestinationBridge.sol#L78-L114
Vulnerability details
Impact
If a user send token from Chain A to Chain C, and during the waiting for approval the user send the same amount of token from Chain B to Chain C, if Chain A and Chain B have the same nonce, users can lost their token from Chain A to Chain C forever.
Proof of Concept
_execute() function in DestinationBridge.sol record a transaction from a source chain by txnHash, and txnHash is keccak256(payload). payload is just a combination of VERSION, sender, amount and nonce. So if a user send transactions from two source chains which have the same nonce, the txnHash will be exactly same. Since when a transaction is received it need to wait for approval to complete, if at this time a transaction with same txnHash is sent to the same destination chain, it can overwrite the pending transaction, and user will lose that token forever.
A POC is here to illustrate this, simply add it to forge-tests/bridges/DestinationBridge.t.sol and run
Tools Used
Manual Review, Foundry
Recommended Mitigation Steps
Add srcChain when creating a payload, this can prevent two source chains have exactly same payload.
Assessed type
Other
The text was updated successfully, but these errors were encountered: