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

Allowing Zero Address for Oracle Actor Can Disrupt House Prices for `RAACHousePrices` Contract

Summary

Having no checks to determine if an oracle is set to a zero address is not recommended. In the RAACHousePrices::setOracle, you should add various checks for extra security. Check that the address is not zero and that the oracle cannot be a malicious actor through interface implementation checks. Having different oracle addresses will affect the functioning of the contract.

Vulnerability Details

function setOracle(address _oracle) external onlyOwner {
oracle = _oracle;
}

Impact

Break the functionality of the protocol
add a folder test to path contracts/core/primitives/ with the following

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { Test } from '../../../../dependencies/forge-std-1.9.6/src/Test.sol';
import {console} from '../../../../dependencies/forge-std-1.9.6/src/console.sol';
import { RAACHousePrices } from '../RAACHousePrices.sol';
contract FakeDeployer {}
contract TestRAACToken is Test {
RAACHousePrices public rAACHousePrices;
FakeDeployer fakeDeployer;
address public owner;
function setUp() public {
fakeDeployer = new FakeDeployer();
owner = address(fakeDeployer);
rAACHousePrices = new RAACHousePrices(owner);
fakeDeployer = new FakeDeployer();
}
function test_SetOracleToZeroSuccess() external {
address newOracle = address(0);
vm.prank(owner);
rAACHousePrices.setOracle(newOracle);
address actualOracle = rAACHousePrices.oracle();
assertEq(newOracle, actualOracle);
}
}

Convert the project to a foundry project

  1. npm i --save-dev @nomicfoundation/hardhat-foundry- Install the hardhat-foundry plugin.

  2. to the top of your hardhat.config.js file.

  3. un npx hardhat init-foundry in your terminal. This will generate a foundry.toml file based on your Hardhat project’s existing configuration, and will install the forge-std library.

  4. Run forge test --mt test_SetOracleToZeroSuccess -vvv

Results

(base) vik@vik:~/projects/auditing/2025-02-raac$ forge test --mt test_SetOracleToZeroSuccess -vvv
[⠒] Compiling...
[⠑] Compiling 1 files with Solc 0.8.28
[⠘] Solc 0.8.28 finished in 2.48s
Compiler run successful!
Ran 1 test for contracts/core/primitives/test/RAACHousePrices.t.sol:TestRAACToken
[PASS] test_SetOracleToZeroSuccess() (gas: 16286)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 2.34ms (376.21µs CPU time)
Ran 1 test suite in 36.91ms (2.34ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

Tools Used

Foundry and Soldeer

Recommendations

Add various checks

function setOracle(address _oracle) external onlyOwner {
+ require(_oracle != address(0))
+ require(_oracle.code.length != 0)
oracle = _oracle;
}
Updates

Lead Judging Commences

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Other
Assigned finding tags:

Admin is trusted / Malicious keepers

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point. Keepers are added by the admin, there is no "malicious keeper" and if there is a problem in those keepers, that's out of scope. ReadMe and known issues states: " * System relies heavily on keeper for executing trades * Single keeper point of failure if not properly distributed * Malicious keeper could potentially front-run or delay transactions * Assume that Keeper will always have enough gas to execute transactions. There is a pay execution fee function, but the assumption should be that there's more than enough gas to cover transaction failures, retries, etc * There are two spot swap functionalies: (1) using GMX swap and (2) using Paraswap. We can assume that any swap failure will be retried until success. " " * Heavy dependency on GMX protocol functioning correctly * Owner can update GMX-related addresses * Changes in GMX protocol could impact system operations * We can assume that the GMX keeper won't misbehave, delay, or go offline. " "Issues related to GMX Keepers being DOS'd or losing functionality would be considered invalid."

n0kto Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Other
Assigned finding tags:

Admin is trusted / Malicious keepers

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point. Keepers are added by the admin, there is no "malicious keeper" and if there is a problem in those keepers, that's out of scope. ReadMe and known issues states: " * System relies heavily on keeper for executing trades * Single keeper point of failure if not properly distributed * Malicious keeper could potentially front-run or delay transactions * Assume that Keeper will always have enough gas to execute transactions. There is a pay execution fee function, but the assumption should be that there's more than enough gas to cover transaction failures, retries, etc * There are two spot swap functionalies: (1) using GMX swap and (2) using Paraswap. We can assume that any swap failure will be retried until success. " " * Heavy dependency on GMX protocol functioning correctly * Owner can update GMX-related addresses * Changes in GMX protocol could impact system operations * We can assume that the GMX keeper won't misbehave, delay, or go offline. " "Issues related to GMX Keepers being DOS'd or losing functionality would be considered invalid."

Support

FAQs

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