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

3 stars 1 forks source link

LockManager does not handle Rebasing tokens properly #434

Closed howlbot-integration[bot] closed 3 months ago

howlbot-integration[bot] commented 3 months ago

Lines of code

https://github.com/code-423n4/2024-05-munchables/blob/57dff486c3cd905f21b330c2157fe23da2a4807d/src/managers/LockManager.sol#L373-L380

Vulnerability details

Impact

This can lead to instances where are funds getting stuck and some players will not be able to withdraw sometimes.

Per the audit documentation rebasing tokens are in the scope of this audit.

Proof of Concept

When players lock their tokens with lock(...) function the player’s lockedToken.quantity is updated to include the amount tokens that the player entered.

However, if the the tokenContract is a rebasing token the players lockedToken.quantity will be over inflated when the token supply reduces.

File: LockManager.sol
373:         // Transfer erc tokens
374:         if (_tokenContract != address(0)) { // normal ERC not ETH
375:             IERC20 token = IERC20(_tokenContract);
376:             token.transferFrom(_tokenOwner, address(this), _quantity);
377:         }
...
379:         lockedToken.remainder = remainder;
380:         lockedToken.quantity += _quantity;

Tools Used

Manual review

Recommended Mitigation Steps

Assessed type

Token-Transfer

c4-judge commented 3 months ago

alex-ppg marked the issue as unsatisfactory: Invalid