Since the cost of launching a new pool is minimal, an attacker can maliciously consume VirtualTokens
The VirtualToken contract limits how much virtual liquidity can be borrowed per block, but launching a new pool costs almost nothing. An attacker can repeatedly launch pools with the maximum allowed virtual liquidity, exhausting the per-block limit and causing legitimate users' pool creation transactions to revert.
Submitted by shaflow2, also found by 0xD4n13l, 0xGondar, c0pp3rscr3w3r, Coldless, EPSec, Evo, farismaulana, Fitro, Fon, Infect3d, jaraxxus, Jiri123, jkk812812, kodyvim, Le_Rems, m4k2, macart224, MrPotatoMagic, Mushow, NexusAudits, NexusAudits, parishill24, pontifex, prapandey031, rouhsamad, rspadi, threadmodeling, Tychai0s, typicalHuman, Vasquez, zxriptor, and zzebra83
When launching a new pool, the factory contract needs to call the takeLoan function to intervene with virtual liquidity. The amount that can be borrowed is limited to 300 ether per block.
function takeLoan(address to, uint256 amount) external payable onlyValidFactory {
if (block.number > lastLoanBlock) {
lastLoanBlock = block.number;
loanedAmountThisBlock = 0;
}
require(loanedAmountThisBlock + amount <= MAX_LOAN_PER_BLOCK, "Loan limit per block exceeded");
loanedAmountThisBlock += amount;
_mint(to, amount);
_increaseDebt(to, amount);
emit LoanTaken(to, amount);
}
However, when launching a new pool, the amount of virtual liquidity is controlled by users, and the minimum cost to launch a new pool is very low, requiring only gas fees and a small buy-in fee. This allows attackers to launch malicious new pools in each block, consuming the borrowing limit, which prevents legitimate users from launching new pools.
Proof of Concept
- User 1 and User 2 submit transactions to launch pools with virtual liquidity of 10 ether and 20 ether, respectively.
- An attacker submits a transaction to launch a pool with 300 ether of virtual liquidity and offers a higher gas fee, causing their transaction to be prioritized and included in the block.
- Due to the
takeLoandebt limit, the transactions of User 1 and User 2 revert. - The attacker can repeat this attack in the next block.
function test_createLaunchPool1() public {
(address quoteToken, address pool, uint256 amountYOut) = lamboRouter.createLaunchPadAndInitialBuy{
value: 10
}(address(factory), "LamboToken", "LAMBO", 300 ether, 10);
}
Running the above test can prove that an attacker only needs to consume the gas fee + 10 wei to exhaust the entire block’s virtual liquidity available for creating new pools.
Recommended mitigation steps
- Charge a launch fee for new pools to increase attack costs
- Limit the maximum virtual liquidity a user can consume per transaction
Shaneson (Lambo.win) 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 per-block loan limit is shared across all pool creations, and creating a pool is so cheap that an attacker can repeatedly consume the entire limit.
Impact
Legitimate users are prevented from launching new pools, and the attacker can sustain this across blocks at low cost.
What the attacker needed
Ability to submit transactions; pay gas fees and a small buy-in fee
The fix
The project should charge a launch fee for new pools and limit the maximum virtual liquidity a user can consume per transaction.
How it was found
- User 1 and User 2 submit transactions to launch pools with virtual liquidity of 10 ether and 20 ether.
- An attacker submits a transaction to launch a pool with 300 ether of virtual liquidity and a higher gas fee, so it is included first.
- Because of the takeLoan debt limit, User 1 and User 2's transactions revert.
- The attacker repeats this in the next block.
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 smart contract lets people create new liquidity pools, and it borrows a limited amount of virtual tokens per block to fund them. Because creating a pool is very cheap, someone can create pools that use up all that limited borrowing in a block, so other people's pool creations fail. This is a denial-of-service attack that blocks legitimate use.
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.