You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Role Revocation in initialize Function in solidityAmo.sol
Summary
The current implementation of the initialize function revokes the SETTER_ROLE from the msg.sender immediately after the initialization process. This is problematic because the SETTER_ROLE is required for several functions, including setWhitelistedTokens, which allows the management of whitelisted tokens. By revoking this role, the contract will not allow any further modifications to the whitelisted tokens, effectively locking the contract's ability to manage its reward tokens after initialization.
The immediate revocation of the SETTER_ROLE in the initialize function of the contract poses significant risks to its functionality and flexibility. This design choice limits the ability to modify critical parameters and manage whitelisted tokens after initialization, potentially leading to operational challenges and security vulnerabilities.
By revoking the SETTER_ROLE, the contract will no longer allow any account to call functions that require this role, such as setWhitelistedTokens, setVault, setTokenId, and setParams. This means that once the contract is initialized, it cannot be modified to add or remove whitelisted tokens or adjust other critical parameters.
Specially the setWhitelistedTokens() which was not initialized beforehand.
PoC
No response
Mitigation
Instead of revoking the SETTER_ROLE at the end of the initialize function, consider using the onlyInitializing modifier to restrict the execution of setter functions to the initialization phase only. This way, the role can remain active for the duration of the initialization process, allowing for necessary configurations without permanently locking out the ability to manage the contract's state.
The text was updated successfully, but these errors were encountered:
sherlock-admin2
changed the title
Prehistoric Emerald Poodle - Role Revocation in initialize Function in solidityAmo.sol
calc1f4r - Role Revocation in initialize Function in solidityAmo.solOct 30, 2024
calc1f4r
Medium
Role Revocation in initialize Function in
solidityAmo.sol
Summary
The current implementation of the initialize function revokes the SETTER_ROLE from the msg.sender immediately after the initialization process. This is problematic because the SETTER_ROLE is required for several functions, including setWhitelistedTokens, which allows the management of whitelisted tokens. By revoking this role, the contract will not allow any further modifications to the whitelisted tokens, effectively locking the contract's ability to manage its reward tokens after initialization.
https://github.com/sherlock-audit/2024-10-axion/blob/main/liquidity-amo/contracts/SolidlyV2AMO.sol#L99C1-L100C1
Root Cause
The immediate revocation of the SETTER_ROLE in the initialize function of the contract poses significant risks to its functionality and flexibility. This design choice limits the ability to modify critical parameters and manage whitelisted tokens after initialization, potentially leading to operational challenges and security vulnerabilities.
https://github.com/sherlock-audit/2024-10-axion/blob/main/liquidity-amo/contracts/SolidlyV2AMO.sol#L99C1-L100C1
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
By revoking the SETTER_ROLE, the contract will no longer allow any account to call functions that require this role, such as setWhitelistedTokens, setVault, setTokenId, and setParams. This means that once the contract is initialized, it cannot be modified to add or remove whitelisted tokens or adjust other critical parameters.
Specially the
setWhitelistedTokens()
which was not initialized beforehand.PoC
No response
Mitigation
Instead of revoking the SETTER_ROLE at the end of the initialize function, consider using the onlyInitializing modifier to restrict the execution of setter functions to the initialization phase only. This way, the role can remain active for the duration of the initialization process, allowing for necessary configurations without permanently locking out the ability to manage the contract's state.
The text was updated successfully, but these errors were encountered: