In LikeRegistry
, it contains a potential vulnerability in its matchRewards
function where fee calculations could be rounded down to zero due to Solidity's integer division behavior. This occurs when processing small reward amounts, potentially leading to loss of protocol fees.
The vulnerability exists in the following code segment:
The issue arises because:
FIXEDFEE is set to 10 (representing 10%)
When totalRewards * FIXEDFEE < 100, the division will result in 0
For example, if totalRewards = 9 wei:
9 * 10 = 90
90 / 100 = 0 (rounds down in Solidity)
This means no fees are collected for small transactions
The vulnerability is particularly concerning because:
It breaks the expected fee collection mechanism
It could be exploited by users intentionally making small transactions
There is no minimum threshold check in place
The issue affects all matches with total rewards less than 10 wei
The impact of this vulnerability includes:
Loss of Protocol Revenue
Protocol fees are not collected for small transactions
Cumulative loss could be significant with many small transactions
Economic Model Disruption
Creates an unfair advantage for small transactions
Undermines the protocol's fee structure
Could incentivize gaming of the system
Trust and Reputation
Inconsistent fee collection could affect protocol credibility
May require contract upgrade to fix
Manual review
Several solutions are recommended to address this vulnerability:
Consider implementing a hybrid fee structure:
Fixed minimum fee for small transactions
Percentage-based fee for larger transactions
Example implementation:
These recommendations should be implemented based on the specific requirements of the protocol and its economic model.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.