# Unchecked external call: when a failed call looks like success

URL: https://shield.quillaudits.com/learn/vulnerabilities/unchecked-external-call/

An unchecked external call is a call to another address whose failure the contract never notices, so it carries on as if a payment or a transfer happened when it didn't. Low-level calls and `send` return a success flag instead of reverting, some ERC-20 tokens return false instead of reverting, and a call to an address with no code succeeds without doing anything. Check every success flag, decode return values, confirm the target has code, and route token transfers through one helper that does all three.

Last updated 3 December 2026. 5 minute read. By the QuillAudits Team.

## How does an unchecked external call go wrong?

Not every failure reverts. The [Solidity docs](https://docs.soliditylang.org/en/latest/security-considerations.html) list two ways sending Ether fails, 'the call depth going above 1024' and a recipient that 'requires more than the allotted amount of gas', and note that a low-level call 'returns a failure code instead of automatically propagating the error'. What the contract does next is up to its author.

- **The success flag is ignored.** `to.call{value: x}("")` or `to.send(x)` returns false, and the contract records the payment anyway.
- **The return value is ignored.** Some tokens report failure by returning false. [EIP-20](https://eips.ethereum.org/EIPS/eip-20) is explicit: 'Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned!'
- **The target has no code.** The [EVM treats a call to a non-existing contract as a success](https://docs.soliditylang.org/en/latest/control-structures.html). Solidity checks for code before high-level calls, but 'this check is not performed in case of low-level calls', so a hand-written transfer to a wrong or empty token address 'succeeds'.
- **The failure is forced.** A recipient contract that reverts, or uses up the gas it was sent, can make a call fail whenever it likes. Code that reverts on that failure inside a loop becomes a [denial of service](https://shield.quillaudits.com/learn/vulnerabilities/denial-of-service/).

## What does vulnerable code look like?

This payroll contract clears an employee's pay before sending it and ignores whether the send worked. Its token deposit uses a low-level call and credits the deposit without looking at the result.

**Vulnerable: ignored send result and an unchecked token call (illustrative, not audited code)** `Payroll.sol`

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

contract Payroll {
    address public immutable owner;
    mapping(address => uint256) public owed;
    mapping(address => mapping(address => uint256)) public credit; // user => token => amount

    constructor() payable {
        owner = msg.sender;
    }

    function setOwed(address employee, uint256 amount) external {
        require(msg.sender == owner, "not owner");
        owed[employee] = amount;
    }

    // Clears the debt whether or not the payment went through.
    function pay(address payable employee) external {
        uint256 amount = owed[employee];
        owed[employee] = 0;
        employee.send(amount); // result ignored
    }

    // Credits the deposit without checking that tokens moved. The low-level call
    // succeeds for an address with no code, and a `false` return goes unread.
    function depositToken(address token, uint256 amount) external {
        token.call(abi.encodeWithSignature("transferFrom(address,address,uint256)", msg.sender, address(this), amount));
        credit[msg.sender][token] += amount;
    }
}
```

If an employee is a contract that needs more than the gas `send` forwards, its pay is wiped and never arrives. And anyone can call `depositToken` with a token that returns false, or with an address that has no code, and be credited for tokens they never sent.

## How do you fix it?

**Fixed: pull payments and a transfer helper that checks everything (illustrative, not audited code)** `PayrollFixed.sol`

```
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

interface IERC20 {
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

library SafeTransfer {
    // Reverts unless the token has code, the call didn't revert, and it returned nothing or true.
    function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal {
        require(address(token).code.length > 0, "token has no code");
        (bool ok, bytes memory data) = address(token).call(abi.encodeCall(IERC20.transferFrom, (from, to, amount)));
        require(ok && (data.length == 0 || abi.decode(data, (bool))), "transferFrom failed");
    }
}

contract PayrollFixed {
    using SafeTransfer for IERC20;

    address public immutable owner;
    mapping(address => uint256) public owed;
    mapping(address => mapping(address => uint256)) public credit;

    constructor() payable {
        owner = msg.sender;
    }

    function setOwed(address employee, uint256 amount) external {
        require(msg.sender == owner, "not owner");
        owed[employee] = amount;
    }

    // Each employee pulls their own pay. If the payment fails, the whole call
    // reverts and the debt is still on record.
    function withdraw() external {
        uint256 amount = owed[msg.sender];
        require(amount > 0, "nothing owed");
        owed[msg.sender] = 0;
        (bool ok, ) = payable(msg.sender).call{value: amount}("");
        require(ok, "payment failed");
    }

    function depositToken(IERC20 token, uint256 amount) external {
        token.safeTransferFrom(msg.sender, address(this), amount);
        credit[msg.sender][address(token)] += amount;
    }
}
```

- **Check every success flag** from `call`, `delegatecall`, `staticcall` and `send`, and either revert or record the failure on purpose.
- **Decode token return values.** Accept no return data or `true`; treat `false` and malformed data as failure.
- **Confirm the target has code** before a low-level call to something you expect to be a contract, or use a high-level call, which [Solidity checks for you](https://docs.soliditylang.org/en/latest/control-structures.html).
- **Prefer \`call\` with a checked result over \`send\` and \`transfer\`.** The [Solidity docs](https://docs.soliditylang.org/en/latest/types.html) say the 2300 gas stipend they rely on 'no longer holds its original meaning due to changing opcode costs'.
- **Let recipients pull.** When each payee withdraws their own funds, one failed payment can't erase a debt or block anyone else.

## How has an unchecked call been exploited?

| Protocol | Qubit Finance QBridge |
| --- | --- |
| Date | 27 January 2022 |
| Chain | Ethereum and BNB Chain |
| Loss | around $80M, per BlockSec |
| What happened | QBridge's deposit function stayed in the contract after a separate depositETH path was added, and it still accepted the zero address as a token, which was on the bridge's whitelist. Its safeTransferFrom helper used a low-level call, and a low-level call to the zero address returns success, so each deposit completed whatever amount it claimed; Qubit's report puts it as 'tokenAddress is 0, so safeTransferFrom didn't fail'. The attacker made 16 such deposits on Ethereum, the bridge minted xETH for them on BNB Chain, and BlockSec puts the assets stolen at around $80M. |
| Sources | [Qubit Finance](https://medium.com/@QubitFin/protocol-exploit-report-305c34540fa3), [BlockSec](https://blocksec.com/blog/when-safe-transfer-becomes-unsafe-lessons-from-the-q-bridge-security-incident) |

This is the third case in the list above: the call was checked, but a success flag from an address with no code proves nothing. [BlockSec's analysis](https://blocksec.com/blog/when-safe-transfer-becomes-unsafe-lessons-from-the-q-bridge-security-incident) puts the root cause in a transfer helper that 'does not check the target is a valid contract (or whether it's a zero address)'; the helper in the fix above checks `address(token).code.length` first and would revert on that call.

## What should a reviewer check?

- Search for `.call(`, `.call{`, `.delegatecall(`, `.staticcall(` and `.send(`, and check what happens to every returned `bool`.
- Search for direct `transfer`, `transferFrom` and `approve` calls on tokens, and confirm each goes through a helper that handles `false` and empty return data.
- For each low-level call, could the target be an address with no code: a wrong configuration, a token on another chain, a contract that was never deployed?
- Is state updated as if a payment happened before the code knows that it did?
- Does any loop make external calls that one recipient could make fail?
- Do tests include a token that returns false, a token that returns nothing, an address with no code and a recipient that reverts?

## How does QuillShield check for unchecked external calls?

Spotting an ignored `bool` is easy; knowing whether it matters means following the call to what the contract does next, and to every place that trusts the state it wrote. QuillShield's full audit of the Solidity codebase in a Foundry project builds a security graph of the code and lists the invariants the code must keep. For this class, the one worth stating plainly is that recorded balances match what actually arrived. Each finding is passed to a separate reviewer agent that tries to disprove it; the ones that hold up list the exact lines, the impact and a recommended fix, and full audits add a proof of concept.

New integrations bring new external calls, so the pull request checks are where this class tends to reappear. QuillShield checks every pull request on GitHub or GitLab.com against the audit's security graph before it merges.

Each full audit of a GitHub or GitLab.com repository includes five pull request checks. [Start free](https://shield.quillaudits.com/register); new accounts get $50 in credit, good for up to half of an order.

## FAQ

### Do transfer() and send() revert on failure?

`transfer` reverts; `send` returns false and has to be checked. Both forward a fixed gas stipend that the Solidity docs say no longer means what it once did, so a checked `call` is the safer default.

### Is a call to an address with no code successful?

Yes. The EVM treats it as a success, and Solidity only adds its code check to high-level calls. A low-level call to an empty address returns true and no data.

### Does try/catch fix unchecked calls?

It lets you handle a revert from a high-level call without failing the whole transaction. It doesn't help with a token that returns false, so the return value still needs checking.

### What is the difference between an unchecked call and an arbitrary call?

An unchecked call ignores the result of a call your code meant to make. An arbitrary call lets the caller choose the target or the calldata, which is a different and usually more severe bug.

### Which SWC entry covers unchecked external calls?

[SWC-104, Unchecked Call Return Value](https://swcregistry.io/docs/SWC-104/): 'The return value of a message call is not checked.' Its fix is to handle the possibility that a low-level call fails by checking the return value. The [OWASP Smart Contract Top 10 (2025)](https://owasp.org/projects/smart-contract-top-10) lists the class as SC06, Unchecked External Calls.

## Sources

- [Security considerations: sending and receiving Ether, Solidity documentation](https://docs.soliditylang.org/en/latest/security-considerations.html) · checked 3 December 2026
- [Expressions and control structures: external function calls, Solidity documentation](https://docs.soliditylang.org/en/latest/control-structures.html) · checked 3 December 2026
- [Types: members of addresses, Solidity documentation](https://docs.soliditylang.org/en/latest/types.html) · checked 3 December 2026
- [ERC-20: Token Standard, Ethereum Improvement Proposals](https://eips.ethereum.org/EIPS/eip-20) · checked 3 December 2026
- [SWC-104: Unchecked Call Return Value, SWC Registry](https://swcregistry.io/docs/SWC-104/) · checked 3 December 2026
- [Protocol Exploit Report, Qubit Finance](https://medium.com/@QubitFin/protocol-exploit-report-305c34540fa3) · checked 3 December 2026
- [When safe transfer becomes unsafe: lessons from the QBridge security incident, BlockSec](https://blocksec.com/blog/when-safe-transfer-becomes-unsafe-lessons-from-the-q-bridge-security-incident) · checked 3 December 2026
- [OWASP Smart Contract Top 10 (2025), OWASP](https://owasp.org/projects/smart-contract-top-10) · checked 3 December 2026
