Due to inadequate checks, Adversary can call BranchBridgeAgent#retrieveDeposit
with an invalid _depositNonce
, which would lead to loss of other users' deposit.
#688
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
H-08
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/BranchBridgeAgent.sol#L433
Vulnerability details
Impact
Attacker will cause user's funds to be collected and locked on Branch chain without it being recorded on root chain.
Proof of Concept
Anyone can call
BranchBridgeAgent#retrieveDeposit
, with an invalid_depositNonce
:If for example, global depositNonce is x, attacker can call
retrieveDeposit(x+y)
.RootBridgeAgent#anyExecute
will be called, and the executionHistory for the depositNonce that the attacker specified would be updated to true:This means that when a user makes a deposit on that BranchBridgeAgent and his Deposit gets assigned a depositNonce which attacker previously called retrieveDeposit for, his tokens would be collected on that BranchBridgeAgent, but would not succeed on RootBridgeAgent because executionHistory for that depositNonce has already been maliciously set to true.
Attack Scenario
Tools Used
Manual Review
Recommended Mitigation Steps
A very simple and effective solution is to ensure that in the
BranchBridgeAgent#retrieveDepoit
function,msg.sender==getDeposit[_depositNonce].owner
just like it was done inBranchBridgeAgent#retryDeposit
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: