The unlock time will be extended by a value which is either the player setting or current the minimum configuration if the player setting is zero.
However, since the attack can be made with 1 wei + gas (affordable on blast), it can realistically grief real users which are about to unlock.
Another impact is that it can cause setLockDuration to fail if the block.timestamp_duration input is smaller than the current unlockTime.
Tools Used
Manual review
Recommended Mitigation Steps
One approach could be to add a min quantity to call lock.
Another approach could be to don't extend the unlock period when calling onBehalfOf.
Another option could also be to only extend the unlock period via onBehalfOf when called via trusted addresses.
Lines of code
https://github.com/code-423n4/2024-05-munchables/blob/main/src/managers/LockManager.sol#L275-L294 https://github.com/code-423n4/2024-05-munchables/blob/main/src/managers/LockManager.sol#L347-L351 https://github.com/code-423n4/2024-05-munchables/blob/main/src/managers/LockManager.sol#L382-L384 https://github.com/code-423n4/2024-05-munchables/blob/main/src/managers/LockManager.sol#L410-L411
Vulnerability details
An attacker can perform a griefing attack to extend the unlock period of users that are about to unlock, and effectively prevent users from unlocking.
Proof of Concept
lock
unlock
, but then jirard callslockOnBehalf
with 1 weiunlock
, his tx will revert withTokenStillLockedError
Following test can be added in
tests/managers/LockManager/subaccount.test.ts
:Impact
The unlock time will be extended by a value which is either the player setting or current the minimum configuration if the player setting is zero.
However, since the attack can be made with 1 wei + gas (affordable on blast), it can realistically grief real users which are about to unlock.
Another impact is that it can cause
setLockDuration
to fail if theblock.timestamp
_duration
input is smaller than the currentunlockTime
.Tools Used
Manual review
Recommended Mitigation Steps
One approach could be to add a min quantity to call
lock
. Another approach could be to don't extend the unlock period when callingonBehalfOf
. Another option could also be to only extend the unlock period viaonBehalfOf
when called via trusted addresses.Assessed type
Invalid Validation