[L-4] - BidBeastsNFTMarket::_executeSale function should follow CEI Pattern to Avoid Reentrancy Risk.
The BidBeastsNFTMarket::_executeSale function is exposed to reentrancy because it calls an external contract (BBERC721.transferFrom) before emitting the AuctionSettled event and call _payout to transfer the funds to the seller, allowing an attacker to execute malicious code and re-enter your contract while it’s in an inconsistent state.
Likelihood: Low.
Impact: Low.
This is the actual codebase of the _executeSale function:
To mitigate potential reentrancy risks, adhere to the CEI pattern by updating state variables (effects) before making any external calls (interactions). For instance:
Rearranging the code to follow the CEI pattern ensures that all relevant state changes are made before any interactions with external contracts, reducing the risk of reentrancy attacks and enhancing the overall security of the contract.
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.