Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low
Valid

Missing extcodesize check in proxy

Summary

Missing extcodesize check in proxy

Vulnerability Details

The target contract is resolved inside the fallback function. It may return address(0).

Impact

The target contract is resolved inside the fallback function. It may return address(0).

address implementation = _implementation;
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize())
let result := delegatecall(gas(), implementation, ptr, calldatasize(), 0, 0)
let size := returndatasize()
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}

Tools Used

Manual Review

Recommendations

Before delegate-calling into the target contract, check if it exists.

codeSize := extcodesize(\_target)
}
require(codeSize > 0);

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.