Platform: Code4rena
Start Date: 21/07/2023
Pot Size: $90,500 USDC
Total HM: 8
Participants: 60
Period: 7 days
Judge: 0xean
Total Solo HM: 2
Id: 264
League: ETH
Rank: 32/60
Findings: 1
Award: $319.21
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Sathish9098
Also found by: 0x3b, 0xnev, 3agle, BugBusters, DadeKuma, K42, Udsen, foxb868, ktg, kutugu, oakcobalt, peanuts, squeaky_cactus
Arcade is a platform to enable liquid lending markets for NFTs. The eepository for this audit contains the contracts for a token-based governance system, which can be granted ownership and management authority over the core lending protocol.
"@openzeppelin/contracts": "4.3.2", "@openzeppelin/contracts-upgradeable": "^4.7.2",
The contract relies on a low version of openzeppelin with some high-risk vulnerabilities, which leaves some attack vectors.
The contract has unsafe type conversions, and although overflow is unlikely, it is better to use safecast for conversions.
// @ARCDVestingVault function addGrantAndDelegate() { if (grant.allocation != 0) revert AVV_HasGrant(); } function delegate(address to) external { grant.delegatee = to; } // @NFTBoostVault function _registerAndDelegate() { if (registration.delegatee != address(0)) revert NBV_HasRegistration(); } function delegate(address to) external override { if (to == address(0)) revert NBV_ZeroAddress("to"); }
The ARCDVestingVault and NFTBoostVault are designed in different ways to defend against multiple times registe attacks:
allocation != 0
to defend registe multiple times and allow update delegate to address(0)
delegatee != address(0)
to defend registe multiple times and don't allow update delegate to
address(0)
While this does not present a security issue, different mechanism designs may make it difficult to understand the system and future upgrades may create incompatibility issues. It is better to unify the two into one defensive strategy.
There is a cliff
cooling period in ARCDVestingVault, but votePower is not affected by this.
In NFTBoostVault, since the NFT boost multipler is variable, it is important to note that latestVotingPower
is old
data, and getting the current new data should always be recalculated using _currentVotingPower
, which is handled well.
The getMultiplier
function implementation has problems, when reading multipliers of non-boost NFT, getMultiplier
should return 1e3
, not 0
. This combined with the updateNft
issue, caused users to temporarily lose votePower.
The updateNft did not verify that the address and Id passed in by the user were of boost type; if the user passed in non-boost NFT, the getMultiplier returned 0, resulting in the user losing voting rights.
Contracts have some factors to consider and are handled well in the code:
NFTBoostVault does not support token whose tokenId is 0, which makes the protocol incompatible with the type of
tokenId == 0
. However, the ERC1155 standard does not specify that the tokenId cannot be 0.
The safeTransferFrom helps prevent NFT from getting stuck in unsupported contracts, but this introduces a vector of
reentrant attacks.
While the contract correctly adds reentrant protections for executable functions, but there is no protection for
readability functions such as getRegistration
.
When the user withdraws the token, votePower remains unchanged, other contracts that rely on these view functions should
be careful.
The contract should avoid accepting non-boost NFT, which may cause the NFT to accidentally send and stuck in the contract.
According to the ERC721 standard, tokenURI should revert when the tokenId does not exist to prevent phishing attacks from deceiving the user. However, the contract will return the corresponding link, which does not comply with the specification.
15 hours
#0 - c4-pre-sort
2023-07-31T16:41:17Z
141345 marked the issue as high quality report
#1 - liveactionllama
2023-08-02T17:37:00Z
After discussion with the lookout, removing the high quality
label here, simply to focus usage of that label on the top 2 QA reports.
#2 - c4-judge
2023-08-10T22:59:56Z
0xean marked the issue as grade-a