Platform: Code4rena
Start Date: 24/03/2023
Pot Size: $49,200 USDC
Total HM: 20
Participants: 246
Period: 6 days
Judge: Picodes
Total Solo HM: 1
Id: 226
League: ETH
Rank: 82/246
Findings: 1
Award: $58.94
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: rbserver
Also found by: 0xAgro, DadeKuma, DeStinE21, HollaDieWaldfee, IgorZuk, J4de, P7N8ZK, Parad0x, Stiglitz, bytes032, carrotsmuggler, csanuragjain, dec3ntraliz3d, kaden, koxuan, lukris02, rvierdiiev, tnevler
58.9366 USDC - $58.94
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L182-L195
Out-of-work derivatives or incorrectly calling of addDerivative
could lead to the user losing funds, the project will be inaccessible and unrecoverable forever.
In the SafEth
contract , we have 2 key external functions addDerivative
and rebalanceToWeights
for the owner, and also 2 external functions stake
and unstake
for the user. At the meanwhile, the SafEth
contract is the only owner of these derivatives (now we have Reth
, SfrxEth
and WstEth
). Only the SafEth
can call the deposit
, withdraw
and setMaxSlippage
of these derivatives.
The owner can add new derivatives, but can not update the derivative address corresponding to one index. If one derivative is out-of-work or the owner adds an invalid derivative by addDerivative
into the project, all the future calls of rebalanceToWeights
, stake
and unstake
will revert. The user will lose funds and no one can recovery.
Invalid derivatives could be:
SafEth
We'd better add a function updateDerivative
other than adding extra validation logics.
event DerivativeChange( uint indexed index, address toAddress, uint weight, ); functin updateDerivative( uint256 _derivativeIndex, address _contractAddress, uint256 _weight ) external onlyOwner { uint256 _derivativeCount = derivativeCount; require(_derivativeIndex < _derivativeCount, "Invalid derivativeIndex"); derivatives[_derivativeIndex] = IDerivative(_contractAddress); weights[_derivativeIndex] = _weight; uint256 localTotalWeight = 0; for (uint256 i = 0; i < _derivativeCount; i++) localTotalWeight += weights[i]; totalWeight = localTotalWeight; emit DerivativeChange(_derivativeIndex, _contractAddress, _weight); }
Btw, please consider using proxy pattern for the SafEth
contract and the derivatives to be sure we have a plan-B to rescue the funds locked in the derivatives.
#0 - c4-pre-sort
2023-04-04T19:44:51Z
0xSorryNotSorry marked the issue as duplicate of #709
#1 - c4-judge
2023-04-23T12:03:02Z
Picodes marked the issue as duplicate of #703
#2 - c4-judge
2023-04-24T19:34:34Z
Picodes marked the issue as satisfactory
#3 - c4-judge
2023-04-24T19:36:09Z
Picodes changed the severity to 3 (High Risk)