Closed howlbot-integration[bot] closed 3 months ago
Validating any possible path is unfeasible for gas limits. By using Claimed event we track if user indeed withdraw and adjust points accordingly. In this case the contract does not need further modifications
koolexcrypto changed the severity to QA (Quality Assurance)
koolexcrypto marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2024-05-loop/blob/0dc8467ccff27230e7c0530b619524cc8401e22a/src/PrelaunchPoints.sol#L470
Vulnerability details
Impact
The protocol's design allows users to withdraw ERC20 tokens before claim time, or at emergency times, but it's actually possible for users to withdraw locked ERC20 tokens even at those restricted times.
Proof of Concept
In
withdraw
function, we can see when such action is permitted:only after
loopActivation
, and beforestartClaimDate
. When an admin callsconvertAllETH
, the claim period starts, and unless an emergency mode is declared, users cannot withdraw their locked assets anymore.On the other hand, in
_claim
, the exchangers are provided to the protocol to swap ERC20 tokens to ETH, and then use the swapped amount to deposit forlpETH
and stake. The exchangers supported are only UniswapV3 and TransformERC20 in the 0x protocol. During the validation of call data, not all entries are checked for transformer exchanger:We see, three parameters are loaded from memory, but in fact, there are more parameters to the function:
The
transformations
field provides some additional transforming info to the function, and the struct looks like this:In the transformer, this
data
part of the struct will be passed into different transformers user have specified:and:
For example, in one of the transformers:
Tokens can be transferred out to recipients specified by users, but not controlled by the prelaunch contract. After those calls, the rest of the balance will be considered as output amount, and proceeds to transfer them to the prelaunch contract. Since there is no ETH in the 0x contract, so the output value will also be 0, the transaction will succeed and transferred ERC20 tokens will go back to the users' hand.
In general, this doesn't hurt the protocol's funds and anything, but simply allows users to withdraw ERC20 tokens during disallowed periods, violating the protocol design.
Tools Used
Manual review
Recommended Mitigation Steps
If the only transformer is meant to be used is
FillQuoteTransformer
, then consider adding a check for such transformer's info.Assessed type
Context