Closed code423n4 closed 1 year ago
We are aware of the centralization risks, initially, all contracts will have a multi-sig as owner to prevent a sole owner, later on a DAO could be the owner.
TriHaz marked the issue as sponsor acknowledged
GalloDaSballo marked the issue as duplicate of #377
GalloDaSballo marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/GovNFT.sol#L307-L309 https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/GovNFT.sol#L287-L294
Vulnerability details
Impact
According to https://docs.tigris.trade/protocol/governance, "Profits from trading fees are paid out to [Governance] NFT holders in real-time...Rewards are paid out in Tigris stablecoins." However, for some legitimate reasons, such as if the corresponding Tigris stablecoin has a bug, or if the owner of the
GovNFT
contract becomes compromised or malicious, this owner can call the followingGovNFT.setAllowedAsset
function to stop the corresponding Tigris stablecoin from being used as a reward token. After this happens, when calling functions likeTrading._handleOpenFees
andTrading._handleCloseFees
, theGovNFT.distribute
function below that is further called would not transfer the trade's DAO fee amount of the corresponding Tigris stablecoin from theTrading
contract to theGovNFT
contract. Instead, such amount can remain in theTrading
contract without belonging to anyone when functions likeTrading.initiateCloseOrder
are called. As a result, the Governance NFT holders cannot receive more deserved rewards from the DAO fees generated by the trades as long as the corresponding Tigris stablecoin is not allowed for being used as a reward token, which can be permanent if such Tigris stablecoin can no longer be used due to a bug or theGovNFT
contract's owner is compromised or malicious.https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/GovNFT.sol#L307-L309
https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/GovNFT.sol#L287-L294
Proof of Concept
Please add the following test in the
Trading using <18 decimal token
describe
block intest\07.Trading.js
. This test will pass to demonstrate the described scenario. Please see the comments in this test for more details.Tools Used
VSCode
Recommended Mitigation Steps
An upgradeable backup Tigris stablecoin can be set up. When calling the
GovNFT.distribute
function, if the Tigris stablecoin that is originally used as a reward token is no longer allowed which causes the!_allowedAsset[_tigAsset]
condition to betrue
, then the trade's DAO fee amount of the backup Tigris stablecoin can be minted to theGovNFT
contract for the Governance NFT holders to claim later.