code-423n4 / 2024-05-munchables-validation

0 stars 0 forks source link

Token Owner tokens will be lost if the owner uses wrong OnBehalf Address #614

Open c4-bot-10 opened 6 months ago

c4-bot-10 commented 6 months ago

Lines of code

https://github.com/code-423n4/2024-05-munchables/blob/main/src/managers/LockManager.sol#L275

Vulnerability details

Impact

Loss of tokens for the Owner who called the lockOnBehalf function.

Proof of Concept

In the lockOnBehalf function, if a user locks tokens on behalf of another user and mistakenly uses the wrong user address, the tokens will be locked in the contract under the wrong user's account. As a result, the wrong user can unlock these tokens, leading to potential loss of tokens for the intended user.

Scenario:

Tools Used

Manual Review

Recommended Mitigation Steps

Add 2 step verification for the call in which OnBehalf confirms the transaction. (Or) In the ERC20 standard, if User A mistakenly approves tokens for User C instead of User B, User A can later correct this by calling approve with 0 tokens for User C. This revokes the approval, ensuring that User C cannot spend the tokens. However, in the current contract's lockOnBehalf function, there is no similar mechanism to revoke the lock in case of a mistake.

Assessed type

DoS