The RAACHousePriceOracle
and RAACPrimeRateOracle
contracts inherit from BaseChainlinkFunctionsOracle
and are designed to fetch house pricing data and prime rate from an off-chain API using Chainlink Functions. However, a critical vulnerability exists in the BaseChainlinkFunctionsOracle
contract: the fulfillRequest
function does not validate whether the returned requestId
matches the stored s_lastRequestId
. This oversight can lead to incorrect price updates in the RAACHousePriceOracle
and RAACPrimeRateOracle
contracts, potentially causing financial losses or data corruption.
Both RAACHousePriceOracle
and RAACPrimeRateOracle
contracts inherit from BaseChainlinkFunctionsOracle
The sendRequest
function in BaseChainlinkFunctionsOracle
stores the requestId
of the sent request in s_lastRequestId
.
The fulfillRequest
function processes the response but does not verify if the returned requestId
matches s_lastRequestId
.
If multiple requests are sent, and their responses are returned out of order, fulfillRequest
might process a response intended for a different request, leading to incorrect data updates in RAACHousePriceOracle
and RAACPrimeRateOracle
What's more, a malicious actor could exploit this vulnerability by crafting a fake response and calling fulfillRequest
with an arbitrary requestId
. This could result in unauthorized updates to house prices and prime rate, potentially manipulating the on-chain data.
Incorrect Price Updates: The housePrices.setHousePrice(lastHouseId, price)
function in RAACHousePriceOracle
could set incorrect prices due to mismatched or malicious responses. The lendingPool.setPrimeRate(lastPrimeRate)
function in RAACPrimeRateOracle
could set incorrect prime rate due to mismatched or malicious responses.
Financial Losses: If the oracle is used in a financial application, incorrect price updates could lead to financial losses for users or the protocol.
Data Integrity: The integrity of the house price data stored in the RAACHousePrices
contract could be compromised.
The impact is High, the likelihood is Low, so the severity is Medium.
Manual Review
To mitigate this vulnerability, the fulfillRequest
function should validate the requestId
before processing the response. Here is the updated code:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.