A lack of rate limiting in the createTradingAccount
function allows for the creation of multiple trading accounts without restriction. This vulnerability could potentially enable Sybil attacks, where an attacker creates a large number of accounts to gain an unfair advantage or manipulate the protocol.
The vulnerability is located in the createTradingAccount
function, responsible for creating new trading accounts and minting associated NFTs.
The createTradingAccount
function is accessible to the public, allowing any user to invoke it. The function performs the following steps:
Global Configuration & Account ID Generation:
Increments the nextAccountId
from the global configuration to generate a new tradingAccountId
.
Account Creation & NFT Minting:
Creates a new trading account and mints an NFT, assigning it to the caller (msg.sender
).
Referral Code Handling:
Sets a referral code if provided and validates it to ensure that users cannot refer themselves.
The absence of a mechanism to limit the rate or number of accounts that can be created per user or time period indicates a lack of rate limiting.
The lack of rate limiting in the account creation process poses significant security risks, including:
Sybil Attacks:
Attackers can create a large number of accounts to manipulate protocol features, such as governance, rewards, or any system depending on user counts or contributions.
Resource Exhaustion:
Excessive account creation could lead to resource exhaustion, impacting the protocol's infrastructure, storage, and operational efficiency.
Economic Manipulation:
Attackers could exploit referral programs or other economic incentives by creating multiple accounts to unfairly accumulate rewards or bonuses.
Manual Review
To address this vulnerability, the following mitigation strategies are recommended:
Rate Limiting Mechanism:
Implement rate limiting within the smart contract to restrict the number of accounts that can be created by a single address within a specified time frame. This can be enforced through:
Tracking the timestamp of the last account creation and ensuring a minimum time interval between consecutive creations.
Limiting the number of accounts that can be created by a single address.
Economic Disincentives:
Introduce a fee for account creation to deter mass account generation. The fee could be significant enough to dissuade attackers from creating multiple accounts but reasonable for legitimate users.
External Verification:
If applicable, integrate external verification (such as KYC or email verification) to ensure that each account corresponds to a unique and verified user.
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.