Owner of LaunchEvent token has the ability to DOS attack the event
The owner of a token used in a LaunchEvent can create a JoePair for that token before the LaunchEvent does, causing the LaunchEvent's createPair call to revert. This prevents the LaunchEvent from initialising its pair, blocking users from withdrawing their LP tokens and incentives.
Submitted by Ruhum, also found by TomFrenchBlockchain
The owner of the token for which the LaunchEvent was created, has the ability to DOS attack the event. They can prevent the LaunchEvent from creating a JoePair which in turn limits the access to the following two functions: withdrawLiquidity() & withdrawIncentives(). Thus, stopping anybody from withdrawing their LP tokens.
The owner of the RocketJoe platform has the ability to enable the emergency withdrawal allowing the depositors to take back their AVAX. But, they lose their burned rJOE tokens and the gas fees.
The dev team might use this attack vector if they think the price of their token is too low. In that case, they can DOS attack the LaunchEvent. If the RocketJoe owner enables the emergency withdrawal, the dev team is able to take back their initial deposit. Thus, they don’t lose anything but their reputation.
Proof of Concept
When createPair() is called, the function checks whether a pair already exists. If it does, the transaction is reverted: https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L382-L389
Anybody is able to create a new JoePair using the existing TraderJoe contracts. If someone owns both AVAX and the LaunchEvent token, they are able to create a new pair and deposit a small amount of liquidity. Thus, the totalSupply will be > 0. Meaning, at that point, the call to createPair() fails. Per design, the LaunchEvent will be used to issue a token to the public market. So only the dev team and its trusted parties have access to the necessary tokens to create a pair and provide liquidity.
https://github.com/traderjoe-xyz/joe-core/blob/main/contracts/traderjoe/JoeFactory.sol#L30
https://github.com/traderjoe-xyz/joe-core/blob/main/contracts/traderjoe/JoePair.sol#L133
Since createPair() can’t be executed the pair state variable is never initialized: https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L422
Thus, the following two functions are not reachable any more: https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L439
https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L469
If the emergency withdrawal is enabled, the token issuer can take back their deposit: https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L510-L516
Recommended Mitigation Steps
If a LaunchEvent for a token has started, only the LaunchEvent contract should be able to create a JoePair for that token. But, this change has to be made to the contracts that are not in the scope of this audit. I don’t think there’s a possibility to fix this issue within the RocketJoe contracts.
cryptofish7 (Trader Joe) acknowledged
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the LaunchEvent's createPair function reverts if a pair already exists, and anyone (including the token owner) can create a pair for the token beforehand.
Impact
Users cannot withdraw their LP tokens or incentives; the platform owner can enable emergency withdrawal so depositors recover AVAX but lose burned rJOE tokens and gas fees, and the token owner can recover their deposit.
What the attacker needed
Attacker is the token owner; attacker holds AVAX and the token; LaunchEvent has started
The fix
Only the LaunchEvent contract should be able to create a JoePair for its token once the event has started, but this requires changes outside the audited contracts.
How it was found
- The token owner obtains both AVAX and the LaunchEvent token.
- The token owner creates a new JoePair using the existing TraderJoe contracts.
- The token owner deposits a small amount of liquidity so totalSupply is greater than zero.
- The LaunchEvent's createPair call then fails because a pair already exists.
- The pair state variable is never initialised, so withdrawLiquidity and withdrawIncentives are unreachable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A LaunchEvent is a contract that helps a new token get traded by creating a trading pair on a decentralised exchange. The token owner can create that trading pair first, which makes the LaunchEvent's own attempt fail, so people who deposited funds cannot withdraw them.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.