Ether can be locked in the PoolFactory
contract without a way to retrieve it
#168
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
Handle
broccolirob
Vulnerability details
If a borrower calls the
createPool
function with a non-zero value, but also includes an ERC20 token address for_collateralToken
, then the Ether value sent will be locked in thePoolFactory
contract forever.In the
_createPool
function, a_collateralToken
address other than the zero address will set theamount
variable to zero. Thatamount
variable will be passed tocreate2
which will send 0 wei to the newly createdPool
contract.Impact
A borrower can accidentally lock Ether in the
PoolFactory
without the ability to retrieve it.Proof of Concept
A borrower reuses a script they made to create a pool and deposit collateral. They intend to deposit Ether as collateral so they send value with the transaction, but forget to change the
_collateralToken
address to address(0). ThePool
contract will be deployed using the_collateralToken
, and will lock the Ether sent in thePoolFactory
Tools Used
Manual analysis and Hardhat.
Recommended Mitigation Steps
If msg.value is greater than 0, make sure the
_collateralToken
address is set to address(0).The text was updated successfully, but these errors were encountered: