NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

withdrawTokens function incorrectly marked as payable

Summary

The withdrawTokens function in the Starklane contract is marked as payable, allowing it to receive Ether. This is atypical for a withdraw function and could lead to unintended consequences.

Vulnerability Details

Here's a snippet of the withdrawTokens function:

function withdrawTokens(
uint256[] calldata request
)
external
payable
returns (address)
{

https://github.com/Cyfrin/2024-07-ark-project/blob/273b7b94986d3914d5ee737c99a59ec8728b1517/apps/blockchain/ethereum/src/Bridge.sol#L153C3-L159C6

The payable keyword on this function allows it to receive Ether along with the function call. The withdrawTokens function doesn't use the received tokens (when sent) anywhere in its logic. This means any Ether sent with the function call will be locked in the contract, leading to loss of funds for users who mistakenly send Ether.

Aside this, accepting Ether in a function that doesn't need it can create attack vectors.

Impact

  • Users may accidentally send Ether when withdrawing tokens.

  • Ether sent to this function could become locked in the contract.

  • Increased potential for user confusion and errors.

  • Unnecessary increase in the contract's attack surface.

Tools Used

Manual review

Recommendations

Remove the payable keyword from the withdrawTokens function.

Updates

Lead Judging Commences

n0kto Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational / Gas

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.

Appeal created

sabit Submitter
12 months ago
n0kto Lead Judge
12 months ago
n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational / Gas

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.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.