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: 94/246
Findings: 2
Award: $42.60
🌟 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
29.4683 USDC - $29.47
https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L182
If admin mistakenly adds a incorrect derivative contract, then all major contract functionality will permanently fail and User funds will stuck permanently
addDerivative
functionfunction addDerivative( address _contractAddress, uint256 _weight ) external onlyOwner { derivatives[derivativeCount] = IDerivative(_contractAddress); weights[derivativeCount] = _weight; derivativeCount++; ... }
0xabc
but mistakenly uses 0xabd
0xabd
gets createdrebalanceToWeights
which fails since derivatives[i].balance()
does not exist for 0xabd
contractfunction rebalanceToWeights() external onlyOwner { uint256 ethAmountBefore = address(this).balance; for (uint i = 0; i < derivativeCount; i++) { if (derivatives[i].balance() > 0) derivatives[i].withdraw(derivatives[i].balance()); } ... }
function unstake(uint256 _safEthAmount) external { ... for (uint256 i = 0; i < derivativeCount; i++) { // withdraw a percentage of each asset based on the amount of safETH uint256 derivativeAmount = (derivatives[i].balance() * _safEthAmount) / safEthTotalSupply; if (derivativeAmount == 0) continue; // if derivative empty ignore derivatives[i].withdraw(derivativeAmount); }
Allow admin to remove a derivative, which will prevent such scenarios
#0 - c4-pre-sort
2023-04-04T19:46:52Z
0xSorryNotSorry marked the issue as duplicate of #709
#1 - c4-judge
2023-04-23T12:02:53Z
Picodes marked the issue as duplicate of #703
#2 - c4-judge
2023-04-24T19:36:09Z
Picodes changed the severity to 3 (High Risk)
#3 - c4-judge
2023-04-24T21:23:19Z
Picodes marked the issue as satisfactory
#4 - c4-judge
2023-04-24T21:23:24Z
Picodes marked the issue as partial-50