functions like delegatecall, call, staticcall, send, and external contract function calls fail but return values go unchecked, leading to unintended state changes, lost funds, or incorrect assumptions about success
Game
Look for unchecked low level calls
// SPDX-License-Identifier: MIT// Open me in VSCode and really think before opening the hints!// Add @audit tags wherever suspicious// Go to the solidity docs to complete missing knowledge of what's happening here// Solve by drafting a fix!pragmasolidity ^0.8.0;contract UncheckedCallGame {addresspublic targetContract;constructor(address_targetContract) { targetContract = _targetContract; }functionexecuteExternalCall(bytesmemory data) public { targetContract.call(data); }}
Low-level calls (call) do not automatically revert if they fail. Consider how you might confirm that the call succeeded before allowing the function to proceed.
Use the return values from call to check if the external call succeeded and take appropriate action if it didn’t.
functionexecuteExternalCall(bytesmemory data) public { (bool success, ) = targetContract.call(data);require(success,"External call failed"); // Fix: Check the success of the call}