Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Valid

Current implementation of `RAACHousePrices.sol` doesn't follows the documentation.

Summary

Two things are missing in the current implementation of RAACHousePrices.sol from the documentation.

a. In the documentation, it is stated that the function setHousePrice should be called only by owner.

b. It is stated that function updatePriceFromOracle is only for oracle to call and update the price but, there is no function defined in the current implementation of RAACHousePrices.sol.

Vulnerability Details

a. Contract named RAACHousePrices.sol has a function setHousePrice which is documented to be called by owner but this function uses the modifier which restricts this function to only be called by oracle.

LINK TO DOCUMENTATION :

function setHousePrice(
uint256 _tokenId,
uint256 _amount
@> ) external onlyOracle {
tokenToHousePrice[_tokenId] = _amount;
lastUpdateTimestamp = block.timestamp;
emit PriceUpdated(_tokenId, _amount);
}

LINK TO CODE :

b. There is no function updatePriceFromOracle implemented within the current implementation of RAACHousePrices.sol.

LINK TO DOCUMENTATION :

Impact

The actual implementation of the code contradicts the documentation and misses one function.

Tools Used

Manual review.

Recommendations

a. Use the modifier mentioned in the documentation.

function setHousePrice(
uint256 _tokenId,
uint256 _amount
- ) external onlyOracle {
+ ) external onlyOwner {
tokenToHousePrice[_tokenId] = _amount;
lastUpdateTimestamp = block.timestamp;
emit PriceUpdated(_tokenId, _amount);
}

b. Add this function in RAACHousePrice.sol

+ function updatePriceFromOracle(
+ uint256 _tokenId,
+ uint256 _newPrice
+ ) external onlyOracle {
+ tokenToHousePrice[_tokenId] = _newPrice;
+ lastUpdateTimestamp = block.timestamp;
+ emit PriceUpdated(_tokenId, _newPrice);
+ }

Also, update the following lines in RAACHousePriceOracle.sol.

function _processResponse(bytes memory response) internal override {
uint256 price = abi.decode(response, (uint256));
- housePrices.setHousePrice(lastHouseId, price);
+ housePrices.updatePriceFromOracle(lastHouseId,price);
emit HousePriceUpdated(lastHouseId, price);
}

LINK TO CODE:

Updates

Lead Judging Commences

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RAACHousePrices implementation restricts setHousePrice to oracle only despite documentation stating owner access, preventing manual price corrections during oracle failures

inallhonesty Lead Judge 3 months ago
Submission Judgement Published
Validated
Assigned finding tags:

RAACHousePrices implementation restricts setHousePrice to oracle only despite documentation stating owner access, preventing manual price corrections during oracle failures

Support

FAQs

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