adjustMaker ignores recipient parameter when removing liquidity
The adjustMaker function ignores the recipient parameter when removing liquidity, always sending tokens to msg.sender. This breaks the documented behaviour and could cause accounting problems or failed integrations.
Source: https://github.com/sherlock-audit/2025-09-ammplify-judging/issues/492
Found by
0x37, 0xHexed, 5am, BoyD, Edoscoba, SanketKogekar, blockace, devAnas, glitch-Hunter, maigadoh, makarov, panprog, shieldrey, t.aksoy, theholymarvycodes
Summary
The adjustMaker function takes a recipient parameter. The NatSpec says this should define who gets the tokens when removing liquidity.
But in the code, the function always sends tokens to msg.sender, even when removing liquidity. This means the recipient parameter is not used at all.
Root Cause
The function adjustMaker in MakerFacet takes a recipient parameter that, according to the NatSpec, should define who receives tokens when removing liquidity.`
/// @param recipient Who receives tokens when removing liq. Does not get used when adding liq.
However, the implementation always uses msg.sender for settlement, regardless of whether liquidity is being added or removed:
https://github.com/sherlock-audit/2025-09-ammplify/blob/main/Ammplify/src/facets/Maker.sol#L89
RFTLib.settle(msg.sender, tokens, balances, rftData);
This creates a mismatch between specification and implementation. In particular, when removing liquidity, tokens are always credited back to the position owner (msg.sender), not the intended recipient.
Internal Pre-conditions
- The caller owns the maker position (asset.owner == msg.sender).
- The liquidity type is MAKER or MAKER_NC.
External Pre-conditions
When calling adjustMaker specifying a recipient address expecting to receive removed liquidity.
Attack Path
- Alice opens a maker position.
- Alice calls adjustMaker with recipient = Bob.
- Liquidity is removed.
- Tokens are sent to Alice (msg.sender) instead of Bob.
- The system relying on recipient for accounting or further operations now behaves incorrectly.
Impact
This breaks the function’s documented behavior and can cause accounting problems or failed integrations.
PoC
n/a
Mitigation
Update the function so that:
When adding liquidity → keep using msg.sender (since they are depositing).
When removing liquidity → use recipient (so the tokens go where the caller specified).
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/itos-finance/Ammplify/pull/31
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
The implementation uses msg.sender for settlement instead of the recipient parameter when removing liquidity.
Impact
This breaks the function’s documented behavior and can cause accounting problems or failed integrations.
What the attacker needed
Caller owns the maker position; liquidity type is MAKER or MAKER_NC
The fix
The protocol team fixed this issue in a pull request.
How it was found
- Alice opens a maker position.
- Alice calls adjustMaker with recipient = Bob.
- Liquidity is removed.
- Tokens are sent to Alice (msg.sender) instead of Bob.
- The system relying on recipient for accounting or further operations now behaves incorrectly.
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 function is supposed to let you choose who receives tokens when you remove your money. But the code ignores that choice and always sends the tokens back to the person who called the function. This means you cannot direct the funds to someone else as promised.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.