The addMessageHashForAutoWithdraw function in the StarklaneMessaging contract allows the owner to add message hashes for auto-withdrawal without verifying the validity or existence of the corresponding messages. This could potentially lead to the addition of arbitrary or non-existent message hashes.
The addMessageHashForAutoWithdraw function takes a uint256 msgHash as input, converts it to bytes32, and adds it to the _autoWithdrawn mapping if it's not already present but the function doesn't verify that the hash corresponds to an actual message sent from L2 or that the message content is valid and follows the expected format or that the message hasn't been tampered with.
The only check performed is to ensure the hash hasn't already been added for auto-withdrawal.
Addition of non-existent message hashes, allowing for unauthorized withdrawals. Also, manipulation of the auto-withdrawal system by adding arbitrary hashes. It can also lead to potential financial losses if the auto-withdrawal process is exploited.
Manual code review
Implement a verification mechanism to ensure the message hash corresponds to an actual message sent from L2. This could involve interacting with the Starknet core contract or maintaining a separate record of valid messages. Also add checks to validate the content and format of the message before adding its hash for auto-withdrawal.
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
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.