Skip to content

Commit 2460349

Browse files
fix: STAA-11 remediation commit i
1 parent 54a094b commit 2460349

File tree

1 file changed

+61
-2
lines changed

1 file changed

+61
-2
lines changed

src/core/ModuleManager.sol

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,73 @@ abstract contract ModuleManager is AllStorage, EIP712, IModuleManager {
371371
// Extract the initialization data from the provided parameters.
372372
bytes memory initData = params[5:];
373373

374-
// Revert if the selector is either `onInstall(bytes)` (0x6d61fe70) or `onUninstall(bytes)` (0x8a91b0e3) or explicit bytes(0).
374+
// Revert if the selector is one of the banned selectors
375+
// `onInstall(bytes)` (0x6d61fe70) or `onUninstall(bytes)` (0x8a91b0e3) or explicit bytes(0).
376+
// Major selectors from ERC-7579, ERC-721, ERC-1155, ERC-1271 and ERC-4337
377+
// Majority of startale account native selectors
375378
// These selectors are explicitly forbidden to prevent security vulnerabilities.
379+
376380
// Allowing these selectors would enable unauthorized users to uninstall and reinstall critical modules.
377381
// If a validator module is uninstalled and reinstalled without proper authorization, it can compromise
378382
// the account's security and integrity. By restricting these selectors, we ensure that the fallback handler
379383
// cannot be manipulated to disrupt the expected behavior and security of the account.
384+
385+
// List of selectors
386+
387+
// IERC7579Module
388+
// bytes4(0x6d61fe70) - onInstall(bytes)
389+
// bytes4(0x8a91b0e3) - onUninstall(bytes)
390+
// bytes4(0xecd05961) - isModuleType(uint256)
391+
// bytes4(0xd60b347f) - isInitialized()
392+
// bytes4(0x7a0468b7) - preValidationHookERC1271()
393+
// bytes4(0xe24f8f93) - preValidationHookERC4337()
394+
// bytes4(0x97003203) - validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)
395+
// bytes4(0xf551e2ee) - isValidSignatureWithSender(address sender, bytes32 hash, bytes calldata data)
396+
397+
// IHook
398+
// bytes4(0xd68f6025) - preCheck()
399+
// bytes4(0x173bf7da) - postCheck()
400+
401+
// IValidator
402+
// bytes4(0x97003203) - validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)
403+
// bytes4(0xf551e2ee) - isValidSignatureWithSender(address sender, bytes32 hash, bytes calldata data)
404+
405+
// bytes4(0) - empty bytes
406+
407+
// ERC-4337
408+
// bytes4(0xee219423) - simulateValidation(PackedUserOperation calldata userOp, bytes32 userOpHash)
409+
// bytes4(0x570e1a36) - createSender(address)
410+
// bytes4(0x19822f7c) - validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
411+
// bytes4(0x52b7512c) - validatePaymasterUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
412+
// bytes4(0xb760faf9) - depositTo(address to, uint256 amount)
413+
// bytes4(0x8dd7712f) - executeUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)
414+
415+
// Startale IERC7579Account
416+
// bytes4(0x1626ba7e) - isValidSignature(bytes32 hash, bytes calldata signature)
417+
// bytes4(0x4b6a1419) - initializeAccount(bytes calldata initData)
418+
// bytes4(0xf2dc691d) - supportsModule(uint256 moduleTypeId)
419+
// bytes4(0xd03c7914) - supportsExecutionMode(ExecutionMode mode)
420+
// bytes4(0x9cfd7cff) - accountId()
421+
// bytes4(0xe9ae5c53) - execute(ExecutionMode mode, bytes calldata executionCalldata)
422+
// bytes4(0xd691c964) - executeFromExecutor(ExecutionMode mode, bytes calldata executionCalldata)
423+
// bytes4(0x9517e29f) - installModule(uint256 moduleTypeId, address module, bytes calldata initData)
424+
// bytes4(0xa71763a8) - uninstallModule(uint256 moduleTypeId, address module, bytes calldata deInitData)
425+
// bytes4(0x112d3a7d) - isModuleInstalled(uint256 moduleTypeId, address module, bytes calldata additionalContext)
426+
380427
require(
381-
!(selector == bytes4(0x6d61fe70) || selector == bytes4(0x8a91b0e3) || selector == bytes4(0)),
428+
// BAN ALL ABOVE SELECTORS
429+
!(
430+
selector == bytes4(0x6d61fe70) || selector == bytes4(0x8a91b0e3) || selector == bytes4(0xecd05961)
431+
|| selector == bytes4(0xd60b347f) || selector == bytes4(0x7a0468b7) || selector == bytes4(0xe24f8f93)
432+
|| selector == bytes4(0x97003203) || selector == bytes4(0xf551e2ee) || selector == bytes4(0xd68f6025)
433+
|| selector == bytes4(0x173bf7da) || selector == bytes4(0x97003203) || selector == bytes4(0xf551e2ee)
434+
|| selector == bytes4(0xee219423) || selector == bytes4(0x570e1a36) || selector == bytes4(0x19822f7c)
435+
|| selector == bytes4(0x52b7512c) || selector == bytes4(0xb760faf9) || selector == bytes4(0x8dd7712f)
436+
|| selector == bytes4(0x1626ba7e) || selector == bytes4(0x4b6a1419) || selector == bytes4(0xf2dc691d)
437+
|| selector == bytes4(0xd03c7914) || selector == bytes4(0x9cfd7cff) || selector == bytes4(0xe9ae5c53)
438+
|| selector == bytes4(0xd691c964) || selector == bytes4(0x9517e29f) || selector == bytes4(0xa71763a8)
439+
|| selector == bytes4(0x112d3a7d)
440+
),
382441
FallbackSelectorForbidden()
383442
);
384443

0 commit comments

Comments
 (0)