Skip to content

Code4rena

Trader Joe v2 contest

Every publicly disclosed report for Trader Joe v2 contest and what kind of bugs they were.

disclosed reports
12
most reported class
Business logic
bug classes found
3
first disclosure
2022
Find Trader Joe v2 contest on bugbounty.fyi Current scope, rewards and status, if it runs a public program.

Disclosed reports

Newest first. Only what Trader Joe v2 contest chose to make public.

Smart contracts

Transfering funds to yourself increases your balance

The token transfer function used temporary variables to update balances, so when sender and recipient were the same address, the recipient balance was overwritten with the sender balance plus the amount, effectively doubling the balance. An attacker could repeatedly transfer tokens to themselves to inflate their balance without limit.

Trader Joe v2 contest

High
Smart contracts

Wrong implementation of function LBPair.setFeeParameter can break the funcionality of LBPair and make user’s tokens locked

The function that updates fee parameters in a liquidity pair contract incorrectly combines the new and old values without shifting the old variable parameters, causing the stored fee parameters to be corrupted. This can make the bin step exceed the maximum allowed, breaking all swap, mint, and flash loan functionality and locking user tokens in the pool.

Trader Joe v2 contest

High
Business logic

Attacker can keep fees max at no cost

The volatility fee mechanism in TraderJoe's AMM updates the last swap timestamp even when the time since the last swap is below the filter period, so the volatility reference does not decay. An attacker can perform tiny swaps just under every filter period to keep fees high at negligible cost, making the pair uncompetitive.

Trader Joe v2 contest

Medium
Business logic

Flashloan fee collection mechanism can be easily manipulated

The flashloan fee mechanism only pays fees to liquidity providers in the active bin, even though the entire pair's liquidity can be borrowed. An attacker could add liquidity to the active bin just before a flashloan to capture most of the fees, or a borrower could atomically add and remove liquidity to reduce the effective fee they pay.

Trader Joe v2 contest

Medium
Smart contracts

Calling swapAVAXForExactTokens function while sending excess amount cannot refund such excess amount

The swapAVAXForExactTokens function is supposed to refund any excess AVAX sent, but the refund calculation subtracts the sent amount from the required amount, causing an underflow revert whenever more than the required amount is sent. An attacker could not exploit this for gain, but ordinary users sending extra AVAX would have their transactions fail.

Trader Joe v2 contest

Medium
Business logic

beforeTokenTransfer called with wrong parameters in LBToken._burn

The LBToken._burn function calls the _beforeTokenTransfer hook with the wrong arguments, passing address(0) as the from address and the account as the to address. This could break future extensions that rely on the hook to distinguish mints from burns, potentially causing loss of funds or a bricked system.

Trader Joe v2 contest

Medium
Business logic

Attacker can steal entire reserves by abusing fee calculation

The fee accounting in the LBPair contract skips updating user debts when the sender or recipient is the pair contract itself, allowing an attacker to mint LP tokens to the pair and then collect fees that were never properly accounted for. By repeating this and exploiting an unchecked block that lets fee totals overflow, the attacker can drain the entire reserves of the pair.

Trader Joe v2 contest

High
Business logic

Incorrect output amount calculation for Trader Joe V1 pools

The LBRouter contract calculates output amounts incorrectly for Trader Joe V1 pools when performing chained swaps, using a formula that underestimates the amount out. This causes users to receive fewer tokens than they should, resulting in a loss of funds.

Trader Joe v2 contest

High