https://github.com/Cyfrin/2024-07-ark-project/blob/273b7b94986d3914d5ee737c99a59ec8728b1517/apps/blockchain/ethereum/src/Bridge.sol#L78-L84
The depositTokens
function in the provided contract allows users to deposit tokens into escrow and initiates the transfer to L2. However, there is a potential issue when the ownerL2
address is set to zero.
If the ownerL2
address is zero, it could lead to a situation where tokens are locked in escrow on L1 without being transferred to the intended recipient on L2. This could cause user funds to be inaccessible, leading to potential financial losses and a loss of trust in the system.
As it is user input so likelihood is very low and can be considred user mistake, but the impact is high because user tokens gets lock in the escrow. So the final severity will be low.
The depositTokens
function includes a parameter ownerL2
, which represents the new owner's address on StarkNet. The function checks if ownerL2
is a valid felt252 value, but it does not explicitly check if ownerL2
is non-zero. Here’s a simplified version of the critical part of the function:
To mitigate this issue, add an explicit check to ensure that ownerL2
is not zero. Here is a potential solution:
By ensuring ownerL2
is non-zero, we can prevent tokens from being locked in escrow and ensure they are transferred to a valid address on StarkNet.
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.
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.