The function ecrecover() will return address(0) if the signature verification fails.
There are no checks during the signature verification to ensure the return value is non-zero. The result is that it's possible for the signature to pass if lender = address(0) / borrower = address(0)
Lines of code
https://github.com/code-423n4/2022-04-abranft/blob/5cd4edc3298c05748e952f8a8c93e42f930a78c2/contracts/NFTPairWithOracle.sol#L452 https://github.com/code-423n4/2022-04-abranft/blob/5cd4edc3298c05748e952f8a8c93e42f930a78c2/contracts/NFTPairWithOracle.sol#L417 https://github.com/code-423n4/2022-04-abranft/blob/5cd4edc3298c05748e952f8a8c93e42f930a78c2/contracts/NFTPair.sol#L383 https://github.com/code-423n4/2022-04-abranft/blob/5cd4edc3298c05748e952f8a8c93e42f930a78c2/contracts/NFTPair.sol#L383
Vulnerability details
Impact
The function
ecrecover()
will returnaddress(0)
if the signature verification fails.There are no checks during the signature verification to ensure the return value is non-zero. The result is that it's possible for the signature to pass if
lender = address(0)
/borrower = address(0)
Proof of Concept
Recommended Mitigation Steps
This issue may be mitigated by ensure that the
borrower
/lender
is a non-zero address.