Closed code423n4 closed 2 years ago
The new value of an NFT is decided with a governance proposal, if someone were to try and set the value to something too high (higher than the actual value of the NFT) the proposal would be rejected.
Again, we have to assume that the DAO is going to act with the best intentions and in favor of the protocol continuing to work well. This is invalid.
Lines of code
https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/vaults/NFTVault.sol#L830 https://github.com/code-423n4/2022-04-jpegd/blob/main/contracts/lock/JPEGLock.sol#L68
Vulnerability details
Impact
The
NFTVault
allows value proposals to be finalized and warranted as long as users are willing to lock and stake theirJPEG
tokens inJPEGLock
.However, since the tokens
JPEG
tokens are never liquidated even if NFT is severely overvalued and liquidated due to expiry of borrow positions, users are incentivised to finalize whatever proposal that is higher than market price. Then proceed to dump NFT as collateral for "borrowing"stablecoin
without ever intending to redeem NFT.In cases when NFT value rises, the malicious actor can always decide on the spot to redeem it and won't suffer from any loss of value.
This is a classic nothing at stake scenario, where finalizing unreasonably high NFT value proposals can only result in gain of malicious actors and loss of current
stablecoin
holders.Proof of Concept
During liquidation of a borrow position, no punishment on NFT value warrantor exists, and
JPEG
are always returned to lockers upon expiry.This incentivizes malicious users to finalize high NFT value proposals and enjoy the profits without any risk.
It also puts current owners of
stablecoin
at an inferior position, since excessive distribution ofstablecoin
decreases its value.Tools Used
vim, ganache-cli
Recommended Mitigation Steps
Seize warrantor's
JPEG
tokens when a liquidation happens. If a global NFT value estimation exists, liquidate only the difference between the individual value and global value. This will force proposal finalizers to take responsibility for their decisions.