Closed code423n4 closed 2 years ago
call will be used instead of transfer
Validating the input field is non-zero is a nice to have. It's effectively not much different than withdrawing and then using a standard transfer to address(0), or making a simple typo when inserting the expected address - which we cannot guard against in the contract. Lowing to Low risk and merging this with the warden's QA report https://github.com/code-423n4/2022-06-nibbl-findings/issues/297
Lines of code
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/Basket.sol#L77-L82 https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L515-L528
Vulnerability details
Impact
The withdraw functions does not validate its
_to
parameter. Funds can be lost if to is the zero address.Proof of Concept
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/Basket.sol#L77-L82
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L515-L528
Tools Used
Manual.
Recommended Mitigation Steps
Check that
_to != address(0)
.