The RAACHousePriceOracle
contract relies on the lastHouseId
variable to track which house ID is being updated by an oracle response. However, this approach introduces a race condition because multiple requests can be made before a response is fulfilled. As a result, when _processResponse
is called, the lastHouseId
may no longer correspond to the original request, leading to incorrect house price updates.
The issue stems from the following implementation:
The lastHouseId
is updated in _beforeFulfill
, which is called when the request is sent. Since _processResponse
is an asynchronous function, multiple requests can be sent before the first response is fulfilled, leading to lastHouseId
being overwritten. As a result, when _processResponse
executes, it may update a different house ID than originally intended.
This vulnerability can lead to incorrect price updates, causing house prices to be assigned to the wrong house ID. As a result, historical data integrity may be lost, and the contract may fail to correctly map oracle responses, making it unreliable for accurate house price tracking.
Manual review
Use requestId
Instead of lastHouseId
Instead of storing the house ID in a global variable, map it to the request ID:
Modify the fulfillment function to use requestId
:
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.