HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: low
Valid

AaveDIVAWrapperCore constructor has wrong order of parameters

Summary

The AaveDIVAWrapper contract incorrectly passes parameters to its parent contract AaveDIVAWrapperCore in the wrong order during initialization, leading to critical address misassignments in the contract's storage variables.

Vulnerability Details

File: AaveDIVAWrapper.sol (Line 12)

The child contract AaveDIVAWrapper implements its constructor as:

constructor(address _aaveV3Pool, address _diva, address _owner)
AaveDIVAWrapperCore(_aaveV3Pool, _diva, _owner) {}

However, the parent contract AaveDIVAWrapperCore defines its constructor parameters in a different order:

constructor(address diva_, address aaveV3Pool_, address owner_)
Ownable(owner_) {...}

Parameter Mismatch:

  • Parent contract expects parameters: (diva_, aaveV3Pool_, owner_)

  • Child contract passes parameters: (_aaveV3Pool, _diva, _owner)

This inversion causes:

  1. _diva state variable will store the Aave V3 Pool address

  2. _aaveV3Pool state variable will store the DIVA Protocol address

  3. Critical protocol dependencies are initialized with incorrect addresses

Impact

Severity: High

The address misassignment will:

  1. Break core protocol functionality relying on Aave/DIVA integrations

  2. Cause failed transactions when interacting with external protocols

  3. Potentially allow unintended contract interactions (e.g., using Aave pool as DIVA protocol)

  4. Require contract redeployment to fix due to immutable variables

Tools Used

  • Foundry

Recommendations

Correct the parameter order in the child constructor:

// Original (incorrect):
// constructor(address _aaveV3Pool, address _diva, address _owner)
// AaveDIVAWrapperCore(_aaveV3Pool, _diva, _owner) {}
// Fixed version:
constructor(address _diva, address _aaveV3Pool, address _owner)
AaveDIVAWrapperCore(_diva, _aaveV3Pool, _owner) {}

Additional Checks:

  1. Add parameter validation in child constructor

  2. Implement unit tests verifying address assignments

  3. Use NatSpec comments to explicitly document parameter order

Updates

Lead Judging Commences

bube Lead Judge 9 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Constructor arguments mismatch

Support

FAQs

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