Closed code423n4 closed 2 years ago
I do tend to think that this should generally be handled by the token implementation
ie. Solmate ERC20 implementation would be vulnerable to this while OZ's wouldn't
ERC721 from Solmate and OZ have address(0)
on the to
And for ERC1155, we're using safeTransferFrom
and safeBatchTransferFrom,
which both have the address(0)
checks for OZ and Solmate. So I think the scope is pretty limited here
Lines of code
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L328-L343
Vulnerability details
It is possible to withdraw all the assets after Buyout before settleVault() was run and newVault created as asset transfer functions do not check the address.
Proof of Concept
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L328-L343
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L352-L367
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L376-L393
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L403-L420
Recommended Mitigation Steps
Consider checking for the newVault to be set, i.e. add non-zero check.