Large amount of points can STILL be minted without any cost
The points system allows an attacker to repeatedly deposit and withdraw liquidity to mint a large number of points at almost no cost, and the implemented rate limit does not prevent this. The attacker can also exhaust the rate limit to prevent other users from earning points.
Bauchibred Follow with santipu_ and xiaoming90
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-03-flat-money-fix-review-contest-judging/issues/10
The protocol has acknowledged this issue.
Found by
Bauchibred, santipu_, xiaoming90
Summary
An issue was raised in the last FlatMoney audit (here) where the watsons pointed out that the points could be minted without any cost, this issue still remains, and now the attacker can prevent other users from earning points.
Vulnerability Detail
The issue raised in the last audit pointed out that an attacker could perform the following attack to mint a large number of points:
- Deposit liquidity
- After a short amount of time, withdraw it
- Repeat the attack, minting a huge amount of points
This attack can still be executed to mint a large number of points at almost no cost. The mitigation that was implemented (if I'm not mistaken), consisted of a rate limit on the minted points. Even though this mitigation would reduce the profit of an attacker, it won't prevent the attacker from minting the maximum amount of points until the rate limit is reached.
Moreover, an attacker could use the rate limit to prevent other users from minting points. By constantly depositing and withdrawing liquidity, it would mint all points for himself until the rate limit is reached. Then, when other innocent users deposit liquidity or make trades, they won't receive any points.
Impact
The attacker can still mint a large amount of points, and prevent other users from receiving them.
Code Snippet
Tool used
Manual Review
Recommendation
Reduce the amount of points earned when users withdraw liquidity or implement a withdrawal fee even if the LP is the last in the market.
Discussion
sherlock-admin2
2 comment(s) were left on this issue during the judging contest.
santipu_ commented:
Medium
takarez commented:
valid; medium(1)
itsermin
There is a cost associated with withdrawing liquidity in the form of the withdrawal fee. If a user wishes to mint points and giving collateral fees to LP holders, then that's their choice. It's an exchange. These fees increase the returns for the LPs and create incentive for more deposits.
There will be no change to this functionality.
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 points are awarded based on deposit and withdrawal actions without sufficient cost or time commitment, and the rate limit only caps total points rather than preventing the exploit.
Impact
The attacker can still mint a large amount of points, and prevent other users from receiving them.
What the attacker needed
Ability to deposit and withdraw liquidity
The fix
Reduce the amount of points earned when users withdraw liquidity or implement a withdrawal fee even if the LP is the last in the market.
How it was found
- Deposit liquidity
- After a short amount of time, withdraw it
- Repeat the attack, minting a huge amount of points
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 points system rewards users for depositing money. An attacker can put money in, take it out quickly, and repeat to earn many points without keeping money in. A rate limit was added but it only caps how many points can be earned in a period, so the attacker can still earn the maximum and stop others from earning any.
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.