function lockFor() in BkdLocker is supposed to lock 'msg.senderfunds and increaseuseraddress funds but if anyone one calls it with0x0` address by mistake then his funds will be locked forever.
As you can see there is no check that user is not 0x0. code calls _userCheckpoint() which will increase 0x0 balances in the contract and there is no check in _userCheckpoint() either and user can lose all his funds just by one simple mistake.
Lines of code
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/BkdLocker.sol#L227-L232
Vulnerability details
Impact
function
lockFor()
inBkdLocker
is supposed to lock 'msg.senderfunds and increase
useraddress funds but if anyone one calls it with
0x0` address by mistake then his funds will be locked forever.Proof of Concept
This is
lockFor()
code inBkdLocker
:As you can see there is no check that
user
is not0x0
. code calls_userCheckpoint()
which will increase0x0
balances in the contract and there is no check in_userCheckpoint()
either and user can lose all his funds just by one simple mistake.Tools Used
VIM
Recommended Mitigation Steps
check that
user
is not0x0
inlcokFor