Closed c4-bot-4 closed 6 months ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as primary issue
Will let sponsor review the coded POC and its validity.
ditto-eth (sponsor) disputed
Not worried about this for two reasons:
hansfriese marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-03-dittoeth/blob/91faf46078bb6fe8ce9f55bcb717e5d2d302d22e/contracts/facets/BridgeRouterFacet.sol#L101
Vulnerability details
Impact
When a user deposits
rETH
orstETH
throughBridgeRouterFacet::deposit
using the corresponding bridge (bridgeCreditReth
orbridgeCreditSteth
), this credit is added to theVaultUser
based on the bridge used for deposit as perLibBridgeRouter#L25-L32
. This setup was designed to deter users from engaging in arbitrage activities:Additionally, if the user decides to withdraw using a bridge where they have no credit, they will incur fees as outlined in
BridgeRouterFacet#L109-L116
:The issue arises because this credit is not decreased when a user loses ETH due to liquidation or redemption, resulting in the
bridgeCredit
becoming completely outdated and the user potentially not being charged the appropriate fees if applicable and allowing the user to arbitrage without penalty.Proof of Concept
Consider the following scenario:
shorter
matches with abidder
. Theshorter
deposits and is credited inbridgeCreditSteth
, say5e18 stETH
.shorter
loses their collateral5e18 stETH
, but theirbridgeCreditSteth
does NOT decrease.shorter
then decides to deposit inrETH
, and theirbridgeCreditReth
now amounts to, say,3e18 rETH
.shorter
sees an arbitrage opportunity and decides to withdraw their3 rETH
using thebridgeCreditSteth
. However, since this credit was NOT reduced at the appropriate time (in step 2), the system allows the withdrawal without applying fees as perLibBridgeRouter#L80-L84
because5e18 stETH > 3e18 amount to withdraw
holds true:The following test demonstrates the above scenario:
Tools used
Manual review
Recommended Mitigation Steps
Update the corresponding
bridgeCredit
when theeth
decreases due toliquidation
orredemption
.Assessed type
Context