Open hats-bug-reporter[bot] opened 4 months ago
Non issue
@rotcivegaf Disagree with the decision.
Similar issue was reported to Immunefi and was awarded Critical
:
https://medium.com/immunefi/the-graph-rounding-error-bugfix-review-c946ff470f65
invalid,
Users can bypass protocolFees completely by passing amount = minWithdrawalLimit (Note: This value is set to 700 & withdrawalFee = 1 on initialization).
the withdraw()
function will always revert if amount=minWithdrawalLimit
as ,
uint64 amountAfterNetworkFee = amount - (BYTES_PER_OUTGOING_TRANSFER * satoshiPerByte);
require(amountAfterNetworkFee >= minWithdrawalLimit, "AFL");
here due to (BYTES_PER_OUTGOING_TRANSFER * satoshiPerByte)
,amount
will be always less than minWithdrawalLimit
and therefore reverts
amountAfterNetworkFee
What I meant is as long as amountAfterNetworkFee
equals minWithdrawalLimit
which is 700
, the protocolFees
will be rounded down to zero.
Github username: @erictee2802 Twitter username: 0xEricTee Submission hash (on-chain): 0x66f0eebb9e44d8d9fad9e880b341f80ec49e7f53b57f26f11fcbd103c78595aa Severity: high
Description: Description
In
packages/contracts/contracts/illuminex/xengine/chains/btc/wallet/VaultBitcoinWallet.sol::withdraw
:Users can bypass
protocolFees
completely by passingamount
=minWithdrawalLimit
(Note: This value is set to700
&withdrawalFee
=1
on initialization).Attack Scenario
Users can bypass
protocolFees
by exploiting rounding issue, causing protocol to lose revenues.Attachments
NA
In the
protocolFees
equation:Variables values:
amountAfterNetworkFee
= 700withdrawalFee
= 1Therefore,
uint64 protocolFees = 700 * 1 / 1000
which will be rounded down to zero, causing loss of revenues to the protocol.Consider rounding up the
protocolFees
calculation to prevent revenues loss.