The WiseLendingDeclaration contract assumes that the FeeManager of the system will possess the 0 NFT ID of the PositionNFTs contract, however, this is not guaranteed and findings in PositionNFTs within the audit have shown that the 0 NFT ID may not even exist.
Impact:
As there are multiple ways to compromise what token ID will be minted by the DeclarationsFeeManager of FeeManager, a misconfigured FEE_MANAGER_NFT can cause significant misbehaviours in the ultimate WiseLending implementation.
Example:
uint256 constant FEE_MANAGER_NFT = 0;
Recommendation:
We advise the code to set the FEE_MANAGER_NFT in the contract's WiseLendingDeclaration::constructor and to set the variable as immutable, retaining almost an identical gas cost to constant whilst representing the correct token ID.
WLD-02M: Insecure Assumption of NFT Acquisition
Description:
The
WiseLendingDeclaration
contract assumes that theFeeManager
of the system will possess the0
NFT ID of thePositionNFTs
contract, however, this is not guaranteed and findings inPositionNFTs
within the audit have shown that the0
NFT ID may not even exist.Impact:
As there are multiple ways to compromise what token ID will be minted by the
DeclarationsFeeManager
ofFeeManager
, a misconfiguredFEE_MANAGER_NFT
can cause significant misbehaviours in the ultimateWiseLending
implementation.Example:
Recommendation:
We advise the code to set the
FEE_MANAGER_NFT
in the contract'sWiseLendingDeclaration::constructor
and to set the variable asimmutable
, retaining almost an identical gas cost toconstant
whilst representing the correct token ID.Alternatively, the value may be set by the
WiseLendingDeclaration::setSecurity
function to a normal contract-level variable.