Submitted by SadBase, also found by danzero
The get_cost_amount function unintentionally sets the price for domain names of length greater than or equal to 7 to zero. This behavior is due to the following code logic:
Here, FREE_LENGTH is defined as 7. When the length of the domain name is greater than or equal to 7, the else branch is executed, setting the price_per_year to 0. While this behavior may be intentional to make longer domain names free, it opens the system to abuse.
The lack of cost for these registrations incentivizes malicious behavior, as attackers only incur transaction fees.
Exploitation Steps:
Code Reference:
The issue originates from the following code snippet:
As long as len >= 7, the else branch ensures the price_per_year is zero, enabling free registrations for long domain names.
See code reference from the relevant GitHub repository here.
To prevent abuse and ensure proper pricing for all domain names, update the logic in the get_cost_amount function as follows:
andrew (Initia) confirmed and commented:
