Open code423n4 opened 1 year ago
trust1995 marked the issue as duplicate of #285
trust1995 marked the issue as satisfactory
trust1995 marked the issue as selected for report
Better POC
@trust1995 Same as #273
0xBugsy marked the issue as sponsor confirmed
trust1995 marked the issue as duplicate of #273
trust1995 marked the issue as not a duplicate
trust1995 marked the issue as primary issue
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/main/src/ulysses-omnichain/RootBridgeAgent.sol#L58
Vulnerability details
Impact
A malicious user would make a deposit specifying an hToken of a high value(say hEther), and a depositToken of relatively lower value(say USDC), and for that user, RootBridgeAgent would increment his hToken balance by the amount of depositTokens he sent
Proof of Concept
Here is the
checkParams
function:The function performs 3 checks:
The PROBLEM is that the check only requires that
getLocalTokenFromUnder[_dParams.token]
!=address(0)
, but does not check thatgetLocalTokenFromUnder[_dParams.token]
==_dParams.hToken
:The checkParams function is used in the
RootBridgeAgent#bridgeIn
function.This allows a user to call
BranchBridgeAgent#callOutAndBridge
with ahToken
andtoken
that are not relatedATTACK SCENARIO
BranchBridgeAgent#callOutAndBridge
on ethereum with the following as DepositInput(_dParams):BranchPort#bridgeOut
transfers 10 USDC from user to BranchPort, and anyCall call is made to RootBridgeAgentRootBridgeAgent#bridgeIn
is called which callsCheckParamsLib.checkParams
checkParams
verifies that _dParams.amount(0) is less than or equal to _dParams.deposit(10)✅RootBridgeAgent#bridgeIn
callsRootPort#bridgeToRoot
which mints 10 global hEther to userif (_deposit > 0) mint(_recipient, _hToken, _deposit, _fromChainId);
Execution flow:
BranchBridgeAgent#callOutAndBridge
->BranchBridgeAgent#_callOutAndBridge
->BranchBridgeAgent#_depositAndCall
->BranchBridgeAgent#_performCall
->RootBridgeAgent#anyExecute
->RootBridgeAgentExecutor#executeWithDeposit
->RootBridgeAgentExecutor#_bridgeIn
->RootBridgeAgent#bridgeIn
Tools Used
Manual Review
Recommended Mitigation Steps
Currently, the protocol only checks if the token is recognized by rootport as an underlying token by checking that the registered local token for
_dParams.token
is not zero address._dParams.token
is equal to_dParams.hToken
.Assessed type
Invalid Validation