Open c4-bot-2 opened 5 months ago
Not reasonable to expect this to be profitable even with low gas costs.
0xleastwood marked the issue as primary issue
Downgrading to QA
for above reasons.
0xleastwood changed the severity to QA (Quality Assurance)
Hi @0xleastwood,
I had taken my inspiration from the live bug bounty payout of Graph protocol which paid out a considerable reward a few months back for a similar bug which allowed the user to save their curationTax
and hence was considered a High
. Here's the article outlining it and an excerpt from the article talking about the first of the two bugs:
Normally, high gas costs on mainnet would prevent this from becoming a lucrative attack. But because this target contract is also deployed on Arbitrum, an L2 with much cheaper gas, the attacker could successfully avoid paying the
curationTax
completely by minting needed amount of tokens in batches of 99 tokens per call as presented in the PoC created by @GregadETH.This could essentially rob the protocol of owed revenue and cause loss of user funds or yield owed to protocol participants.
It's not only about the amount saved by the attacker, but the aspect that knowingly or unknowingly when mutliple users do so over a long period of time, there is value leakage for the protocol which accumulates over time.
Here's an example from a similar attack vector from the Code4rena Inverse Finance audit which talks about the economic feasibility/profitability of such attacks. The severity is still kept at Medium
and not a QA.
Hence I personally believe it to be suitable for a Medium
, but leave the final decision to you.
Thanks
Regardless, i don't really see the feasibility of this even in a low gas cost environment. Not inclined to upgrade this to medium
severity because there is negligible rounding.
Lines of code
https://github.com/code-423n4/2024-05-bakerfi/blob/main/contracts/core/Vault.sol#L260-L264
Vulnerability details
Description
The Vault::withdraw() function rounds-down the fee against the protocol's favour and hence a user can split their withdraw tx into multiple small ones such that
fee
evaluates to zero in each call. On less expensive chains like Arbitrum or Optimism, this strategy would be beneficial for them.Proof of Concept
settings().getWithdrawalFee()
to be1e4
.PERCENTAGE_PRECISION
is defined by the protocol as1e9
.amount
= 1e5(1e5 * 1e4) / 1e9 = 1
0.5e5
eachamount
= 0.5e5(0.5e5 * 1e4) / 1e9 = 0
Hence no fee paid by the malicious user.Impact
Loss of fee for the protocol
Tools Used
Manual review
Recommended Mitigation Steps
Round up in favour of the protocol. A library like solmate can be used which has
mulDivUp
:Assessed type
Math