Platform: Code4rena
Start Date: 08/01/2024
Pot Size: $83,600 USDC
Total HM: 23
Participants: 116
Period: 10 days
Judge: 0xean
Total Solo HM: 1
Id: 317
League: ETH
Rank: 84/116
Findings: 2
Award: $14.38
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: BI_security
Also found by: 0xPsuedoPandit, 0xpiken, ABAIKUNANBAEV, Beepidibop, CipherSleuths, EV_om, Giorgio, Hajime, J4X, KingNFT, KupiaSec, NentoR, SBSecurity, SpicyMeatball, Tendency, Ward, ZdravkoHr, boringslav, deepplus, hals, hash, haxatron, jasonxiale, juancito, pkqs90, plasmablocks, ravikiranweb3, rokinot, rvierdiiev, trachev, zaevlad, zzebra83
1.8029 USDC - $1.80
Judge has assessed an item in Issue #290 as 2 risk. The relevant finding follows:
L3
#0 - c4-judge
2024-01-28T21:27:51Z
0xean marked the issue as duplicate of #239
#1 - c4-judge
2024-01-28T21:27:54Z
0xean marked the issue as satisfactory
🌟 Selected for report: 0xA5DF
Also found by: 0xmystery, 7ashraf, AkshaySrivastav, CipherSleuths, NentoR, SBSecurity, Tendency, ZanyBonzy, ZdravkoHr, dd0x7e8, hals, haxatron, invitedtea, jasonxiale, juancito, kaden, krikolkk, ladboy233, oakcobalt, peanuts, petro_1912, pkqs90, plasmablocks, ravikiranweb3, rbserver, rokinot, souilos
12.582 USDC - $12.58
Count | Title | Instances |
---|---|---|
[L-01] | Gnosis Safe disableModule's module parameter offset is incorrect. | 1 |
[L-02] | User cannot transfer any amount of extra ERC1155 tokens from wallet if rental exists. | 1 |
[L-03] | EIP712 hash for OrderMetadata is incorrect. | 1 |
Total Low Risk Issues: 3
Count | Title | Instances |
---|---|---|
[NC-01] | Add a to address check for Gnosis Safe call guards. | 1 |
Total Non-Critical Issues: 1
The offset for gnosis_safe_disable_module_offset
is incorrectly set to 0x24
, targeting the first parameter instead of the second. But the module
parameter is the second parameter, so the correct offset should be 0x44
.
This error could lead to administrative actions on the wrong module, allowing the safe owner to disable a module that hasn't been whitelisted. For instance, in a module list sequence of 0x01 (SENTINEL_MODULES) -> module0 -> module1 -> 0x01
, whitelisting module0
could unintentionally permit the disabling of module1
, which is not the intended outcome.
uint256 constant gnosis_safe_disable_module_offset = 0x24;
The disableModule()
function within Gnosis Safe ModuleManager.sol
:
function disableModule(address prevModule, address module);
Set gnosis_safe_disable_module_offset
to 0x44
.
The safe wallet's guard policy blocks the transfer of actively rented ERC1155 tokens, but it doesn't account for the quantity of ERC1155 tokens being rented. This could hinder users from transferring their ERC1155 tokens that aren't part of the rental.
For example, if a user rents 10 ERC1155 tokens and then acquires an additional 15 of the same token ID through a game reward, they should be able to transfer these extra 15 tokens. However, the current implementation prevents any transfer of the extra tokens as long as there's an active rental for the same token ID.
function _revertSelectorOnActiveRental( bytes4 selector, address safe, address token, uint256 tokenId ) private view { // Check if the selector is allowed. if (STORE.isRentedOut(safe, token, tokenId)) { revert Errors.GuardPolicy_UnauthorizedSelector(selector); } }
For ERC1155 tokens, the ideal approach is to track the quantity being rented. The system should permit transfers as long as the wallet holds the amount of the tokens being rented.
The _deriveOrderMetadataHash()
function doesn't correctly calculate the hash of OrderMetadata
, as it omits the orderType
and emittedExtraData
fields. Although this isn't causing any immediate issues, as the function is used for both offchain signing and onchain validation, it's still advisable to correct this implementation for accuracy and future reliability.
function _deriveOrderMetadataHash( OrderMetadata memory metadata ) internal view returns (bytes32) { // Create array for hooks. bytes32[] memory hookHashes = new bytes32[](metadata.hooks.length); // Iterate over each hook. for (uint256 i = 0; i < metadata.hooks.length; ++i) { // Hash the hook hookHashes[i] = _deriveHookHash(metadata.hooks[i]); } // Derive and return the metadata hash as specified by EIP-712. return keccak256( abi.encode( _ORDER_METADATA_TYPEHASH, metadata.rentDuration, keccak256(abi.encodePacked(hookHashes)) ) ); }
struct OrderMetadata { // Type of order being created. OrderType orderType; // Duration of the rental in seconds. uint256 rentDuration; // Hooks that will act as middleware for the items in the order. Hook[] hooks; // Any extra data to be emitted upon order fulfillment. bytes emittedExtraData; }
Add the corresponding fields.
to
address check for Gnosis Safe call guards.This isn't a bug, but rather a suggestion for code enhancement. The current guard policy checks the function selector against Gnosis Safe's module and guard setting calls. Since the intention is to prevent these specific calls only when directed at the safe itself, it would be beneficial to include a check for the to
address. This additional check could potentially allow other contracts with identical function selectors to operate without being inadvertently blocked.
Also add a from == to
check while checking these calls, to prevent accidently blocking other contract function calls.
#0 - 141345
2024-01-22T13:54:21Z
290 pkqs90 l r nc 0 0 1
L 1 d dup of https://github.com/code-423n4/2024-01-renft-findings/issues/565 L 2 d dup of https://github.com/code-423n4/2024-01-renft-findings/issues/600 L 3 d dup of https://github.com/code-423n4/2024-01-renft-findings/issues/239 N 1 n
#1 - c4-judge
2024-01-27T20:31:24Z
0xean marked the issue as grade-b