Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: medium
Invalid

contracts/core/RebaseController.sol

The provided Solidity code for the RebaseController contract appears to be reasonably structured and utilizes OpenZeppelin's Ownable contract for access control. However, there are several potential vulnerabilities and considerations to keep in mind:

1. Reentrancy Risk

  • The performUpkeep function calls external contracts (priorityPool.setPoolStatus, insurancePool.initiateClaim, and stakingPool.updateStrategyRewards). If any of these functions can be exploited to call back into the RebaseController, it could lead to a reentrancy attack.

  • Mitigation: Consider using the Checks-Effects-Interactions pattern. Also, adding a nonReentrant modifier (e.g., from OpenZeppelin) to functions that interact with external contracts can help mitigate this risk.

2. Gas Limit Issues

  • The code allows for gas limits to be set for cross-chain messages, but if these gas limits are not properly managed or set too low, it can lead to transaction failures, especially if the external calls are not optimized or if they change in complexity.

  • Mitigation: Ensure that proper checks and balances are in place for gas usage, especially in the updateRewards and distributeRewards functions.

3. Denial of Service (DoS) via State Changes

  • The performUpkeep function has a mechanism to pause the pool if losses exceed the maximum limit. If an attacker could manipulate this threshold, it could lead to a denial of service for users trying to access the pool.

  • Mitigation: Review the logic that determines when the pool can be paused or reopened, and ensure that it cannot be easily manipulated.

4. Uninitialized State Variables

  • If any of the external contracts (IStakingPool, IPriorityPool, ISDLPoolCCIPControllerPrimary, IInsurancePool) are not properly initialized or if their interfaces change, it could lead to unexpected behaviors or failures.

  • Mitigation: Ensure that the addresses of these contracts are properly validated and initialized. Additionally, consider using a fallback mechanism if any of these contracts become unavailable.

5. Invalid Array Lengths

  • In updateRewards, strategiesToUpdate is expected to have a specific length but is derived from external data. If the data provided does not match expectations, it may lead to unexpected results or revert.

  • Mitigation: Add checks to validate the length and contents of the incoming parameters before proceeding with operations.

6. Access Control

  • The onlyRebaseBot modifier restricts access to certain functions, but if the rebaseBot address is compromised or incorrectly set, it could lead to unauthorized access.

  • Mitigation: Consider implementing a multi-signature wallet or a timelock mechanism for changing critical addresses or permissions.

7. Potential for Underflows/Overflows

  • While Solidity 0.8.x has built-in overflow and underflow protection, careful consideration should still be given to the math operations, especially those involving deposit changes and percentages.

  • Mitigation: Make use of the SafeMath library if you are dealing with any complex calculations, even though Solidity handles this by default in 0.8.x.

8. Lack of Event Emission

  • There are no events emitted for critical actions such as updating rewards, changing the pool status, or adjusting settings. This could make it difficult to track actions on-chain.

  • Mitigation: Emit events in functions like updateRewards, performUpkeep, setRebaseLossBot, etc., to ensure transparency and ease of monitoring.

Summary

The code appears to be structured well, but there are several potential vulnerabilities and areas for improvement. Consider implementing the suggested mitigations and perform thorough testing, including unit tests and audits, before deploying the contract.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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