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

0 stars 0 forks source link

Users will unfairly lose all their points during an emergency withdraw #304

Closed c4-bot-4 closed 5 months ago

c4-bot-4 commented 5 months ago

Lines of code

https://github.com/code-423n4/2024-05-loop/blob/main/src/PrelaunchPoints.sol#L274-L306

Vulnerability details

Impact

When the owner start an emergency withdraw, LRT's stakers will unfairly lose all their points.

Proof of Concept

    function _claim(address _token, address _receiver, uint8 _percentage, Exchange _exchange, bytes calldata _data)
        internal
        returns (uint256 claimedAmount)
    {
        uint256 userStake = balances[msg.sender][_token];
        if (userStake == 0) {
            revert NothingToClaim();
        }
        if (_token == ETH) {
            claimedAmount = userStake.mulDiv(totalLpETH, totalSupply);
            balances[msg.sender][_token] = 0;
            lpETH.safeTransfer(_receiver, claimedAmount);
        } else {
            // code
        }
        emit Claimed(msg.sender, _token, claimedAmount);
    }

Tools Used

Manual review

Recommended Mitigation Steps

Consider introducing a new emergency withdraw function for LRT stakers that dosen't trigger any Withdrawn event.

Assessed type

Other

141345 commented 5 months ago

invalid

LRT and ETH events are the same

141345 commented 5 months ago

@howlbot reject

0xbtk commented 4 months ago

Hi @0xbtk

I agree there is an oversight from the validator. The events are the same, but they are triggered differently for ETH on emergency withdrawal. However, It doesn't fall under

"or leak value with a hypothetical attack path with stated assumptions, but external requirements."

Because the points are calculated off-chain. So, it is under the control of the protocol team.

@koolexcrypto While it's true that points are calculated off-chain, the underlying issue originates on-chain. The points are derived from these on-chain events, leading to a direct loss for LRT stakers. Doesn't this warrant a medium?

koolexcrypto commented 4 months ago

Hi @0xbtk I agree there is an oversight from the validator. The events are the same, but they are triggered differently for ETH on emergency withdrawal. However, It doesn't fall under

"or leak value with a hypothetical attack path with stated assumptions, but external requirements."

Because the points are calculated off-chain. So, it is under the control of the protocol team.

@koolexcrypto While it's true that points are calculated off-chain, the underlying issue originates on-chain. The points are derived from these on-chain events, leading to a direct loss for LRT stakers. Doesn't this warrant a medium?

When there is emergency, I don't believe that points are considered anyway. Also, there is no attack happening here.