Open hats-bug-reporter[bot] opened 2 months ago
In this POC, we set a 1% deposit fee (100 basis points). The attacker calculates an exploitAmount of 99, which results in a fee calculation of 99 * 100 / 10000 = 0 due to integer division. As a result, they receive the full 99 tokens without paying any fee.
In real world this attack does not make sense, as tx fees will be higher than 1e-18
potential deposit fee loss
Github username: -- Twitter username: -- Submission hash (on-chain): 0xcf4bc7df6332a067db197889f255cb086cf99c2e23894a8cc2bb58de491ea99f Severity: high
Description:
Description
The
previewDeposit
function in theBaseMinter
contract calculates the deposit fee using integer division, which can lead to precision loss. This allows a malicious user to bypass the deposit fee by carefully choosing deposit amounts that cause the fee calculation to round down to zero. The vulnerable code is in thepreviewDeposit
function:Furthermore the
redeem
andwithdraw
functions are also vulnerable in the same manner.Attack Scenario
depositFee
andFEE_DENOMINATOR
values.depositFee
and divided byFEE_DENOMINATOR
, results in a value just below 1.deposit
function with this carefully chosenamount
. Due to integer division, thefeeAmount
calculation rounds down to 0.Impact
This vulnerability allows users to bypass deposit fees, potentially leading to:
This vulnerability can be classified as high severity due to its potential to lead to protocol insolvency. If widely exploited, this vulnerability allows users to deposit large amounts of assets without paying fees. This could result in:
POC
Here's a simplified POC outlining the issue:
In this POC, we set a 1% deposit fee (100 basis points). The attacker calculates an exploitAmount of 99, which results in a fee calculation of 99 * 100 / 10000 = 0 due to integer division. As a result, they receive the full 99 tokens without paying any fee.