Rules › Solidity

delegatecall to an address the caller controls

highSolidityRule sol-delegatecall-input

delegatecall runs foreign code with this contract's storage and balance; a caller-chosen target can take it over.

Why it matters

delegatecall runs another contract's code in this contract's context: its storage, its balance, its msg.sender. If the caller chooses the target, they can run code that overwrites the owner slot, drains funds, or self-destructs. Only delegatecall into fixed, trusted implementations (proxies, libraries).

Vulnerable

function execute(address impl, bytes calldata data) external {
    (bool ok, ) = impl.delegatecall(data);
    require(ok);
}

Fixed

address public immutable implementation;

function execute(bytes calldata data) external onlyOwner {
    (bool ok, ) = implementation.delegatecall(data);
    if (!ok) revert CallFailed();
}

What other tools call it

ToolDetector or reference
Slithercontrolled-delegatecall
Solhintavoid-low-level-calls
Aderyndelegate-call-in-loop
SWC registrySWC-112

Check your code

Paste a contract into the in-browser checker, or let the Claude Code plugin scan before every deploy. The quick check for this rule is a pattern match: treat a hit as "look here", and a miss as no guarantee.

Static analysis finds known bug classes; it can't prove code is safe and isn't an audit. Get a professional audit before deploying code that will hold value.