[WP-H22] Attacker can deposit from and to the same chainId
to steal from the incentivePool
#144
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-03-biconomy/blob/db8a1fdddd02e8cc209a4c73ffbb3de210e4a81a/contracts/hyphen/LiquidityPool.sol#L149-L173
Vulnerability details
https://github.com/code-423n4/2022-03-biconomy/blob/db8a1fdddd02e8cc209a4c73ffbb3de210e4a81a/contracts/hyphen/LiquidityPool.sol#L149-L173
https://github.com/code-423n4/2022-03-biconomy/blob/db8a1fdddd02e8cc209a4c73ffbb3de210e4a81a/contracts/hyphen/LiquidityPool.sol#L242-L261
In the current implementation, users are allowed to set
toChainId
whendepositErc20()
ordepositNative()
, when there are some incentive rewards, the user can get more tokens ontoChainId
.However, there is no check that prevents the
toChainId
to be the currentchainId
, so that when the incentive rewards are high enough, an attacker or a malicious user can set thetoChainId
to the currentchainId
and steal the incentive rewards without helping the protocol to liquidity to the current chain, instead, it actually lowers the liquidity.PoC
Given:
rewardAmount
for 1 ETH is 0.01 ETHdepositNative()
on Mainnet withamount
= 1 ETH,toChainId
= 1,receiver
= Alicealice
, NATIVE,alice
, 1, 1.01 ETH, 0.01 ETH, tag) emittedsendFundsToUser()
on Mainnet,amount
= 1.01 ETHRecommendation
Consider adding checks to require
toChainId
!= current chainId.The text was updated successfully, but these errors were encountered: