The checkAndCalculateBrokerFee
function permits a maxFee
parameter of 0
, allowing transactions to proceed even when the broker’s fee is set to zero. Although the test passes successfully, it reveals that there are no validations in place to prevent broker.fee
from being zero. Allowing a zero fee could lead to scenarios where no compensation is allocated to the broker, which may be unintended and lead to misuse or undervaluation of the broker's role. Furthermore, defining a minimum fee range as a percentage of totalAmount
would dynamically align broker fees with transaction sizes, avoiding excessively low fees relative to transaction size.
The lack of a validation check for broker.fee
being zero allows transactions to proceed without allocating any fees to the broker. While this may be intentional in certain scenarios, it presents potential issues: brokers may receive no minimum compensation, which could discourage them from fulfilling their roles, and without tying broker.fee
to the totalAmount
, fees can be set arbitrarily low, leading to disproportionately small fees for larger transactions.
This vulnerability has two main impacts:
Zero-Fee Broker Transactions: With no checks to ensure a non-zero fee, transactions could be structured with no broker compensation. In cases where brokers are required to maintain or facilitate complex operations, zero-fee transactions may discourage participation, degrade service quality, or create incentive misalignment.
Misalignment Between Broker Fee and Transaction Size: Allowing fees independent of transaction size creates a potential for disproportionate fees, either too high or too low, especially for large transactions. This could lead to fee structures that are misaligned with broker contributions, potentially impacting overall transaction flow and broker incentives.
The below tests will show that the broker.fee
can take in 0 amount or any other amounts.
PoC
Manual Review
To address these issues, we recommend implementing the following improvements:
Implement a Minimum Broker Fee Check: Ensure broker.fee
is greater than zero by adding a validation check within checkAndCalculateBrokerFee
:
This will prevent transactions from proceeding without a broker fee.
Define Broker Fee as a Percentage Range of totalAmount
: Link the broker fee to totalAmount
to ensure fees are proportionate to transaction size. This could be achieved by setting a minimum and maximum percentage range, such as between 0.5%
and 2%
of totalAmount
. Example:
Where minPercentage
and maxPercentage
are constants or configurable parameters that define the valid range of broker fees as a percentage of totalAmount
. This approach aligns broker fees with transaction size, enhancing flexibility and fairness.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.