You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: In the _rentStorage function, the contract transfers an overpayment back to the payer using payer.sendNative(overpayment). Using send or transfer in Ethereum can be risky because it allows for potential reentrancy attacks (depending on how sendNative is implemented). If the payer is a contract, they could reenter and exploit the contract by re-calling the function in an unintended way.
Fix: The contract should implement a checks-effects-interactions pattern by ensuring all state changes are made before the external call or consider using call with safe handling.
Issue: In the _rentStorage function, the contract transfers an overpayment back to the payer using payer.sendNative(overpayment). Using send or transfer in Ethereum can be risky because it allows for potential reentrancy attacks (depending on how sendNative is implemented). If the payer is a contract, they could reenter and exploit the contract by re-calling the function in an unintended way.
Fix: The contract should implement a checks-effects-interactions pattern by ensuring all state changes are made before the external call or consider using call with safe handling.
(bool success, ) = payer.call{value: overpayment}("");
require(success, "Transfer failed");
Fixing a reentrancy risk prevents one of the most notorious attack vectors in Ethereum smart contracts.
The text was updated successfully, but these errors were encountered: