DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect Initialization of `tradingAccountToken` and `usdToken` can lead to Improper Functioning

Summary

The initialize function in the GlobalConfigurationBranch contract sets the tradingAccountToken and usdToken addresses. An issue exists where an incorrect tradingAccountToken address could be initialized, leading to improper functioning of the contract.

Impact

Proof of Impact and Vulnerability: Initializing the tradingAccountToken with an incorrect address can have significant impacts:

  • Incorrect Token Interactions: The contract may interact with the wrong token, leading to incorrect token transactions.

  • Malfunction in Trading Operations: It could cause a malfunction in trading operations, resulting in potential loss of user funds.

  • Security Vulnerabilities: Security vulnerabilities may arise, making the protocol susceptible to exploitation.

  • Loss of Trust: User and liquidity provider trust in the protocol could diminish, affecting the protocol's reputation and usage.

Example Scenario: If tradingAccountToken is set to an incorrect address, any function attempting to transfer or interact with this token would fail or behave unexpectedly, potentially resulting in loss of funds. For instance, if a user tries to trade, the contract might not execute the trade correctly, leading to financial losses.

Tools Used

Manual code review

Recommendations

To mitigate this issue, implement a validation check to ensure that the provided tradingAccountToken address is correct:

//@audit can initializing wrong accountToken
function initialize(address tradingAccountToken, address usdToken) external initializer {
require(tradingAccountToken != address(0), "Invalid tradingAccountToken address");
require(usdToken != address(0), "Invalid usdToken address");
GlobalConfiguration.Data storage globalConfiguration = GlobalConfiguration.load();
globalConfiguration.tradingAccountToken = tradingAccountToken;
globalConfiguration.usdToken = usdToken;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.