Platform: Code4rena
Start Date: 18/10/2023
Pot Size: $36,500 USDC
Total HM: 17
Participants: 77
Period: 7 days
Judge: MiloTruck
Total Solo HM: 5
Id: 297
League: ETH
Rank: 76/77
Findings: 1
Award: $8.30
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: MrPotatoMagic
Also found by: 0xMosh, 0xPsuedoPandit, 0xhacksmithh, 8olidity, Al-Qa-qa, Baki, Bughunter101, Krace, Stormreckson, T1MOH, Tendency, eeshenggoh, fibonacci, hals, immeas, kutugu, lsaudit, m4k2, mrudenko, okolicodes, phoenixV110, spark, twicek, xAriextz
8.3007 USDC - $8.30
As written in the solidity documentation, the low-level functions call
, delegatecall
and staticcall
return true as their first return value if the account called is non-existent, as part of the design of the EVM. Account existence must be checked prior to calling if needed.
The low-level function delegatecall
is used in the execute
function in the OD proxy
and it can be problematic. The function makes proper check by making sure the address is not a zero address but does not check if it is a contract address that can be able to execute code and if the target doesn't exist, success will be equal to true and the function will return true and the code execution will be continued like the call was successful.
https://github.com/open-dollar/od-contracts/blob/f4f0246bb26277249c1d5afe6201d4d9096e52e6/src/contracts/proxies/ODProxy.sol#L26
bool _succeeded; (_succeeded, _response) = _target.delegatecall(_data);
Also the return value of the data should be checked as well...
Manual Review
Check before any low-level call that the target address actually exists, for example before the delegate call in the OD proxy function you can check that the address is a contract by checking its code size. Another way in which you can mitiagte this is by checking for the returndata. A simple check like this will actually be fine:
if (data.length <= 4) { revert(); //delegatecall failed }
#0 - c4-pre-sort
2023-10-27T00:21:36Z
raymondfam marked the issue as low quality report
#1 - c4-judge
2023-11-03T16:53:40Z
MiloTruck marked the issue as grade-b