All taker collateral and collected fees can be stolen by re-entering via `RFTLib.settle` to manipulate uniswap spot price when adding Maker liquidity
The contract fails to verify that the token amounts actually spent when minting Uniswap liquidity match the amounts charged to the user. An attacker can re-enter via a callback to manipulate the Uniswap spot price, causing the contract to spend more of its own tokens than the attacker paid, allowing theft of all taker collateral and collected fees.
Source: https://github.com/sherlock-audit/2025-09-ammplify-judging/issues/58
Found by
panprog
Summary
When any user adds maker liquidity (via newMaker or adjustMaker), the amounts of token0 and token1 required from the user are calculated in the data.xBalance and data.yBalance, however the actual amounts spent to mint the required liquidity are never checked, the contract simply sends whatever amounts of both tokens are given by the uniswap pool in the mint callback. When the funds are settled for the maker liquidity change, the following functions are called:
RFTLib.settle(msg.sender, tokens, balances, rftData);
PoolWalker.settle(pInfo, asset.lowTick, asset.highTick, data);
RFTLib.settle calls user contract:
// If the payer is an RFTPayer, we make the request now.
if (isRFTPayer) {
cbData = IRFTPayer(payer).tokenRequestCB(tokens, balanceChanges, data);
}
This allows the user to manipulate the uniswap pool spot price to a different value via the RFTLib callback. PoolWalker.settle will then proceed to mint the required liquidity, but will use amounts of token0 and token1 different from the ones calculated and received from the user. Moreover, the total value of these tokens will always be higher than the value of tokens received from the user. When user manipulates the price back to initial value, he will have profit from this manipulation, stealing token0 and/or token1 from the contract.
As the contract uses Diamond proxy, this contract holds all token balances at the same address which is used to mint uniswap liquidity. In particular, the following funds are under risk:
- All Takers collateral
- All fees collected from the uniswap pool
Root Cause
Re-entrancy in Maker.newMaker and Maker.adjustMaker which allows to manipulate uniswap pool before the pool positions are minted to the Ammplify:
https://github.com/sherlock-audit/2025-09-ammplify/blob/main/Ammplify/src/facets/Maker.sol#L49-L50
https://github.com/sherlock-audit/2025-09-ammplify/blob/main/Ammplify/src/facets/Maker.sol#L79-L80
Internal Pre-conditions
None.
External Pre-conditions
None.
Attack Path
Note: a0 is used for amount of token0, a1 for amount of token1
- Current
price = 100 - Takers have a total collateral of 100
a0and 10000a1(these are contract balances) - There is liquidity of 1 in the range[100;10000]
- Attacker adds 111 maker liquidity in the range [100;10000], paying 10
a0 - In the
RFTLib.settleattacker manipulates the price to 10000
4.1. Attacker pays a1: -90
4.2. Attacker receives a0: +0.09
5. Attacker returns from the RFTLib callback, 111 liquidity is minted to Ammplify, taking 10000 a1 from it
6. Attacker manipulates the price back to 100:
6.1. Attacker pays a0: -10
6.2. Attacker receives a1: +10000
7. Attacker waits for jit penalty time to pass and withdraws his 111 maker liquidity, receiving 10 a0
Contract balances:
- before: 100
a0+ 10000a1= $20000 - after: 110
a0+ 0a1= $11000
Attacker balances:
a0: -10 + 0.09 - 10 + 10 = -9.91 [-$991]a1: -90 + 10000 = +9910 [+$9910]- uniswap manipulation fees (0.3%): (90 + 10000) * 0.003 = -$30
Total: $9910 - $991 - $30 = +$8889
Attack is performed in a single transaction except the final withdrawal, however even with jit fees this is highly profitable to attacker. The same attack can be performed in a different direction (stealing most a0).
The attack allows to steal almost entire a0 and a1 balances of the Ammplify.
Impact
- Most (90-99%) Ammplify contract balances can be stolen, including:
- Taker collateral
- Uniswap fees collected but not yet claimed by the users
- When there are near-0 balances, multiple actions expecting positive balance will revert for users:
- Takers will be unable to get back their collateral
- Non-compounding Makers will be unable to adjust their balances, because all such actions will send them their expected uniswap pool fees, but the contract will not have them, so will revert with not enough funds.
Mitigation
Verify that the amounts spent during uniswap mint match the amounts charged from the user.
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 a re-entrancy vulnerability in Maker.newMaker and Maker.adjustMaker that allows an attacker to manipulate the Uniswap pool spot price before liquidity positions are minted.
Impact
Most (90-99%) of the Ammplify contract balances can be stolen, including taker collateral and uncollected Uniswap fees; additionally, users may be unable to withdraw collateral or adjust maker balances due to near-zero contract balances.
What the attacker needed
Attacker can add maker liquidity; Attacker can implement RFTLib callback; Sufficient contract balance to steal
The fix
The contract should verify that the amounts spent during the Uniswap mint match the amounts charged from the user.
How it was found
- Attacker adds maker liquidity in a chosen tick range, paying a small amount of token0.
- During the RFTLib.settle callback, the attacker manipulates the Uniswap spot price to a much higher value.
- The attacker returns from the callback, and the contract mints the liquidity using far more token1 from its own balance than the attacker paid.
- The attacker then manipulates the price back to the original value, receiving a large amount of token1.
- After the JIT penalty period, the attacker withdraws the maker liquidity and receives back the token0 initially paid.
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.
When you add liquidity to a Uniswap pool, the pool tells the contract how many of each token to deposit. This contract trusts those numbers without checking them against what the user actually paid. An attacker can briefly change the pool's price during a callback, so the contract deposits more of its own tokens than the attacker paid, then the attacker reverses the price change and keeps the profit.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.