A well financed attacker could prevent any other users from minting synthetic tokens
The mint limit in AlchemistV2 is only decreased on mint and not increased on burn, so an attacker can repeatedly mint and burn to keep the limit exhausted. This prevents other users from minting synthetic tokens, disrupting the protocol.
Submitted by dirky_
AlchemistV2.sol#L676-L683 AlchemistV2.sol#L704 Limiters.sol#L84
In the AlchemistV2 contract, users can deposit collateral to then borrow/mint the synthetic tokens offered by the protocol. The protocol also defines a minting limit that specifies how many synthetic tokens can be minted in a given time period. This exists to prevent unbounded minting of synthetic tokens.
Every time a user calls mint, the internal _mint method decreases the current mint limit. This works as intended. However, there is nothing stopping an attacker from immediately burning their synthetic tokens by calling burn and then calling mint again. This is possible because the debt position is updated during the burn phase, which lets the user then mint again against the same deposited collateral.
In most cases this probably wouldn’t be a problem if the mint limit is sufficiently high. However, it is currently possible for a well financed attacker to grief the contract by repeatedly minting and burning synthetic tokens to keep the contract pegged at the mint limit. This will prevent any normal users from minting any synthetic tokens, and hence prevents the protocol from performing as it should.
Proof of Concept
An attacker can repeatedly call mint followed by burn after depositing some collateral with deposit. If this is appropriately sized and timed, it can cause the mint call to fail for another user due to the check here that is called during mint here.
Tools Used
VSCode
Recommended Mitigation Steps
There should be an additional method added to the Limiters library that can increment the mint limit. This method can then be called during a burn call in the AlchemistV2 contract.
function increase(LinearGrowthLimiter storage self, uint256 amount) internal {
uint256 value = self.get();
self.lastValue = value + amount > self.maximum ? self.maximum : value + amount;
}
0xfoobar (Alchemix) disputed and commented:
If somebody griefed, let alone the insanely high capital requirements, governance could simply raise the mint limit.
0xleastwood (judge) commented:
As far as I can tell, this seems like a valid griefing attack. Assuming no fees are charged on mint/burn actions, it would be viable to use a flash loan to use up the entire mint limit, preventing other users from participating in the protocol. This could be mostly mitigated by charging a small fee on mints, which is sent to the protocol’s governance contract or distributed to pre-existing stakers. Could you confirm this @0xfoobar ?
0xfoobar (Alchemix) commented:
Upon further review the griefing action of
- initiate flashloan
- deposit
- mint
- burn
- repay flashloan
would be a valid approach to grief the protocol. No funds are at risk but we’ll discuss internally how to best mitigate this.
0xleastwood (judge) commented:
Agreed, keeping this issue as is!
This could have been upgraded to high risk if the ease of attack involved:
- Limits on burning tokens.
- The griefing attack is somewhat cheap, making it easy for attackers to maintain.
But as the issue raised does not lead to a loss of user’s funds, I believe medium risk to be justified.
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 mint limit is decreased on mint but not increased on burn, allowing repeated mint-burn cycles to exhaust the limit.
Impact
A well-financed attacker could prevent any normal users from minting synthetic tokens, disrupting the protocol, though no funds are at risk.
What the attacker needed
Sufficient capital or a flash loan; no fees on mint or burn
The fix
The Limiters library should be extended with a method to increase the mint limit, called during burn.
How it was found
- Deposit collateral using the deposit function.
- Repeatedly call mint followed by burn to keep the mint limit at its maximum.
- Other users' mint calls fail because the limit is exhausted.
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 mint limit caps how many synthetic tokens can be created in a period. Because burning tokens does not restore that limit, someone can mint up to the cap, burn the tokens, and mint again, keeping the cap full so others cannot mint.
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.