A denial of service vulnerability exists in the withdrawNFT
function where if the oracle sets a house price to 0, any attempt to withdraw NFTs from the lending pool will revert, effectively locking user's NFTs in the contract.
The vulnerability occurs in the following sequence:
A user mints NFTs with IDs 0 and 1 and deposits them as collateral in the lending pool
The oracle sets the house price of token ID 1 to 0 through the setHousePrice function
When attempting to withdraw any NFT through withdrawNFT, the function calls getUserCollateralValue, which call getNFTPrice for any deposited NFTs and reverts if the price is 0
This causes all withdrawNFT
calls to revert, locking the NFTs in the contract
Users cannot withdraw their NFTs from the lending pool if any of their deposited NFTs has a price of 0
This effectively locks user collateral in the contract indefinitely
Manual code review
Performing formal verification with Quint
Add validation in the oracle's setHousePrice
function to prevent setting prices to 0:
Alternatively, modify getNFTPrice
to handle zero prices gracefully:
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.