stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: medium
Invalid

No receive function will impact contract ability to receive ether

Summary

Contract cannot receive ether due to lack of receive or fallback function

Vulnerability Details

RESDLTokenBridge and WrappedTokenBridge contract cannot receive ether as it lack receive() or fallback() function.
receive() is for receiving ether without calling data and fallback()is for receiving ether with calling data.

Impact

If someone sends ETH to a smart contract without passing calldata and there is a receive() function, the receive() function is executed. If there is no receive() function, then the fallback() is executed.

// is msg.data empty?
// / \
// yes no
// / \
// receive() exists? is the function selector fundMe()?
// / \ / \
// yes no no yes
// / \ / \
// receive() fallback() exists? fundMe()
// / \
// yes no
// / \
// fallback() transaction is reverted

As there is no receive nor fallback, then the transaction reverts and the contract will not be able to receive and ether.

Tools Used

Manual code Review

Recommendations

Implement receive or fallback function in the RESDLTokenBridge and WrappedTokenBridge contract.

Updates

Lead Judging Commences

0kage Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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