Creation of a Gnosis Safe via Factory::deployRentalSafe Can be Blocked #114
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-443
edited-by-warden
grade-b
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/policies/Factory.sol#L138-L193
Vulnerability details
Impact
According to the current implementation, before a renter, let's call him
Charlie
can fulfil a lend order,Charlie
has to have deployed aGnosis safe
via a call toFactory::deployRentalSafe
function.This created safe will hold the rented
NFT
for the entire rent duration.There is currently a possible denial of service risk for users who intend to rent an
NFT
in the protocol.Attack Path:
Charlie
callsFactory::deployRentalSafe
Bob
noticesCharlie's
txn, then copies the txn data, but tweaks the call data to instead callGnosis Safe
Factory::createProxyWithNonce
function directly offering a higher gas price.Bob's
transaction gets executed successfully, thus creating a safe forCharlie
Charlie's
transaction fails.The effect of this is that, when the safe is created via
reNft
Factory::deployRentalSafe function, the safe is stored in theStorage
module as a protocol deployed safe:But since
Bob
created the safe forCharlie
via a direct call to Gnosis factory, whenCharlie
attempts to create a rental, there will be a revert during execution at:https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/policies/Create.sol#L649-L650
Proof of Concept
Please add the below test to
/smart-contracts/test/unit/Factory.t.sol
, then importimport {ISafe} from "@src/interfaces/ISafe.sol";
and then run:Here are the logs:
Tools Used
Manual Review && Foundry
Recommended Mitigation Steps
Allow users to pass an extra
bytes32
salt parameter inFactory::deployRentalSafe
function, this salt should be used as an extra input for generating the salt nonce passed on tosafeProxyFactory.createProxyWithNonce
. e.g:https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/policies/Factory.sol#L180-L186
Assessed type
DoS
The text was updated successfully, but these errors were encountered: