The addMessageHashesFromL2
function in the StarknetMessagingLocal
contract allows any external address to add message hashes without any form of verification. This lack of validation means that malicious or arbitrary hashes can be registered, compromising the contract’s integrity and security.
The addMessageHashesFromL2
function in the StarknetMessagingLocal
contract allows any external address to directly register message hashes as consumable, without performing any verification or validation on the provided hashes. This function is defined as follows:
Unauthorized Operations: An attacker could exploit this vulnerability by adding arbitrary message hashes. If the contract logic later processes or relies on these hashes, it could lead to unauthorized actions, including but not limited to incorrect message processing or exploitation of contract functionalities.
Disruption of Normal Operations: The introduction of unverified message hashes could interfere with the normal operation of the contract, potentially causing service disruptions or inconsistent behavior.
Contract Integrity Risk: The contract’s ability to correctly manage and validate message hashes is undermined, increasing the risk of operational failures and security breaches.
Manual Review
Implement Message Hash Verification:
Introduce verification mechanisms to ensure that message hashes are legitimate and correspond to actual messages before registering them. This could involve:
Verifying that hashes correspond to messages that have been validated or approved by a trusted source.
Integrating checks or cryptographic proofs to validate the authenticity of the message hashes.
Implement access control mechanisms to restrict who can call the addMessageHashesFromL2
function. Only authorized entities should be able to register message hashes
References:
Solidity Documentation on Access Control
OpenZeppelin Contracts Access Control
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.