The registerReferral
function in Referral.sol
has multiple vulnerabilities related to referral code validation.
The function converts referralCode
to a string
without checking its length
If referralCode
is excessively long, it could lead to high gas consumption or unintended behavior.
Malicious users could submit large bytes input, potentially causing storage issues.
When isCustomReferralCode
is false
, the function assumes referralCode
contains a valid address and directly decodes it
If referralCode
is malformed (e.g., incorrect length), abi.decode
may revert, leading to unexpected contract behavior.
One can exploit this by providing manipulated referralCode
inputs.
The function only checks if referralCode.length != 0
but does not prevent empty strings:
An empty string (""
) could be stored as a valid referral code, causing inconsistencies in the referral tracking system.
It allows users to bypass intended validation checks.
Attackers or users could exploit these issues to register invalid or arbitrary referral codes.
Manual Code Review
Validate referralCode
length before converting to string
Ensure referralCode
is exactly 20 bytes before decoding to address
Disallow empty strings as custom referral codes
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.