Submitted by kenzo
Unlock contains a feature in which a key buyer can ask for a refund.
The refund is sent from the lock - where the purchase funds were sent.
The lock manager can withdraw all funds from the lock.
Therefore, if the lock manager withdraws enough profits from the lock, the user would not be able to cancel his key and request refund.
Even if a lock manager is not malicious, if he would want to enable users to cancel their key, he would have to keep track of how much tokens need to be kept in the contract in order to enable this - not a trivial calculation. A naive lock manager might accidentally disable refunds for his clients.
Refunds are not guaranteed.
A user might buy a key expecting to cancel it within some time, only to discover he can not cancel it. (This loss of user funds is why I consider this a high risk finding.)
An unaware lock manager who just wants to withdraw all his profits might accidentally discover that he removed his users ability to cancel their key.
It seems the Unlock team is aware to some extent that withdrawing breaks refunds, as they state in the withdraw function:
However, even if just the owner is allowed to call it, he may break the refund functionality - on purpose or accidentally.
Looking on Unlock documentation I dont see a warning to creators about withdrawing their funds.
withdraw function has no limit on the amount withdrawn, therefore the owner can withdraw all funds:
https://github.com/code-423n4/2021-11-unlock/blob/main/smart-contracts/contracts/mixins/MixinLockCore.sol#L133:#L162
cancelAndRefund transfers the funds from the same lock contract:
https://github.com/code-423n4/2021-11-unlock/blob/main/smart-contracts/contracts/mixins/MixinRefunds.sol#L118
Therefore if there are not enough funds, the transfer will fail.
Perhaps a sort of MasterChef-like shares system can be implemented in order to make sure the owner leaves enough funds in the lock to process refunds.
julien51 (Unlock Protocol) disagreed with severity and commented:
0xleastwood (judge) decreased severity to Medium and commented:
julien51 (Unlock Protocol) commented:
0xleastwood (judge) commented:
