Skip to content
critical External Calls No SWC entry CWE-829

Arbitrary External Call Injection

SAFE-0029 External Calls Checked automatically by the scanner
1

What goes wrong

A function lets the caller specify an arbitrary target and calldata, which the contract then executes. Attackers point it at tokens/approvals the contract holds, draining them or calling privileged callbacks.

2

How to fix it

the pattern that is safe
mapping(address=>bool) public allowedTarget;
function call(address t, bytes calldata d) external onlyOwner {
    require(allowedTarget[t], "target");
    (bool ok,) = t.call(d); require(ok);
}
Allowlist targets; never expose unrestricted external calls.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0029 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs