Deposits can be denied by abusing maxContractBalance
The treasury contract enforces a maximum balance limit in its deposit function, which can be exploited by a whale who front-runs a user's deposit with a large deposit to hit the limit, causing the user's deposit to fail. This blocks users from depositing and renting cards, allowing an attacker to manipulate market outcomes.
Submitted by cmichel
The treasury implements a max contract balance check in the deposit function:
require(
(erc20.balanceOf(address(this)) + _amount) <= maxContractBalance,
"Limit hit"
);
A whale can stop anyone from depositing by front-running a user’s deposit with a deposit that pushes the contract balance to the maxContractBalance limit first. The user’s deposit will then fail in the check. Afterwards, the whale can withdraw again.
This is not only restricted to whales, miners/users can do the same using same-block cross-transaction flashloans and submitting a
(attacker deposit, user deposit, attacker withdraw)flashbundle to a miner. Possibilities like this will only become more prevalent in the future.
Any users can be blocked from depositing which prevents them from renting cards. This allows an attacker to manipulate the outcome of a market in their favor by strategically preventing other competitors to bid on their cards (causing forfeiture due to a low deposit balance).
Recommend removing the contract limit or at least set the limit very high if it keeps happening.
mcplums (Reality Cards) acknowledged:
This is a good one- but I don’t think we need to make any changes to the contract. We can use it as originally intended, then if it is exploited as above, we can switch to only setting the variable to 0 or maxuint256. So it just acts as a toggle on whether deposits are allowed.
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 deposit function checks the contract's balance against a maximum limit, which can be temporarily filled by an attacker to cause other deposits to fail.
Impact
Any user can be blocked from depositing, preventing them from renting cards and allowing an attacker to manipulate market outcomes in their favour.
What the attacker needed
Attacker has sufficient funds to reach the limit; ability to front-run transactions
The fix
The contract limit should be removed or set very high to prevent this denial-of-service.
How it was found
- Attacker observes a pending user deposit transaction.
- Attacker front-runs with a deposit that brings the contract balance to the maxContractBalance limit.
- User's deposit transaction fails the balance check.
- Attacker withdraws their funds.
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 has a rule that the total amount of money it holds cannot exceed a certain limit. An attacker can quickly add a large amount just before someone else tries to deposit, so the victim's deposit is rejected because the limit is reached. The attacker then withdraws their money, having blocked the victim.
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.