withdrawTokens()::Bridge.sol
shouldn't be payable
. It allows the end user to send native tokens when executing this function but no native token is needed to withdraw
NFTs.
The function depositTokens()
is payable because it uses msg.value
:
But withdrawTokens()
doesn't use msg.value
in its code, and doesn't have to. No need to send native tokens to the contract when using this function to withdraw
NFTs.
https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/ethereum/src/Bridge.sol#L157
If an end user send some native tokens by mistake using this withdrawTokens()
function, those will be lost.
I looked into LightChaserV3_CodeHawks_Ark.md
to see if this bug was already found, there are 2 similar findings but not for this particular function : withdrawTokens()::Bridge.sol
.
These are those 2 findings from LightChaserV3
which are not relevant :
https://github.com/Cyfrin/2024-07-ark-project/tree/main/apps/blockchain/ethereum/src/Messaging.sol#L28-L28
28: contract StarklaneMessaging is Ownable
https://github.com/Cyfrin/2024-07-ark-project/tree/main/apps/blockchain/ethereum/src/UUPSProxied.sol#L14-L14
14: contract UUPSOwnableProxied is Ownable, UUPSUpgradeable
LightChaserV3
highlighted those 2 contracts but like we can see, it is not relevant. But it doesn't found withdrawTokens()::Bridge.sol
, which is in fact the only one causing problem.
Possible loss of funds for the end user.
Github, VisualCode.
payable
should be removed from :
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.