DeFi Security AllianceRequest an audit
Menu

EVM patterns

Solidity Low Level Call: Success, Return Data and Code Checks

A successful low-level execution does not establish that the intended operation completed. Our Solidity low level call matrix separates status, returned bytes and state across 64 local attempts, including false-word responses accepted by Address helpers. Bind the target, decode the result and check the application postcondition.

A blue signal passes through glass inspection plates toward a chamber with an empty recess and an untouched mechanical output block.

Key facts

Executed population
64 local attempts: 48 value calls and 16 static calls
Raw CALL outcome
14 true and 10 false statuses across 24 returned wrapper results
Value-helper outcome
12 returned and 12 reverted across 24 attempts
False-word boundary
3 helper responses returned a zero word without interpreting it
Identity boundary
3 helper responses accepted four bytes from a zero-code-length precompile
Scope
Pinned OpenZeppelin v5.5.0 local wrappers, no executed application decoder

Start with the returned pair

A relay invokes a contract and receives success = true. The returned bytes encode a Boolean false. In this illustrative scenario, the call completed without an execution exception but the application has not accepted the requested operation. Those statements can coexist. Our local fixture reproduced that distinction with both raw calls and OpenZeppelin Address helpers.

A Solidity low level call exposes an execution status and a byte sequence instead of imposing the complete contract of a typed application interface. The first value answers whether the low-level execution succeeded. It does not decode the second value or establish that the intended state changed. Record the target, exact calldata and expected result separately. The Solidity exception documentation explains that low-level calls return a failure flag instead of automatically bubbling an exception. An application can choose to revert after a failure, record it for later handling or allow a documented partial result. Ignoring the flag is also a choice, usually an unintended one. The policy belongs in the calling operation.

Calldata is part of that policy. A successful fallback can handle bytes that do not select the named function an integrator expected to invoke. Our fixtures intentionally used a fixed payload and fallback handlers, so they demonstrate transport and output behavior without claiming that a particular production selector was dispatched. Constructing a selector is not evidence that the matching function ran.

Transport status
The low-level Boolean reports execution success or failure for the attempted call.
Returned bytes
The response may encode a value, an error or something incompatible with the expected application interface.
Application postcondition
The relevant balance, entitlement, state transition or permission must satisfy the operation's own acceptance rule.

If the integration has a fixed interface, start with that declared interface and document why a raw byte path is needed. A generic executor may need flexible calldata, but flexibility moves obligations to the operation designer. Record which selectors are allowed, how their argument schemas are bound and who can submit them. A transport test using arbitrary bytes cannot substitute for a release test using the actual encoded operation. Keep the constructor of the input and the consumer of the output in the same review scope.

Typed calls and raw calls therefore need different evidence packets. A typed interface supplies declared argument and result types. A raw path must bind its own payload and interpret the response. Neither syntax alone proves that the target is the authorized integration or that the caller's accounting remains correct.

What 64 local call attempts showed

Method

We executed retained OpenZeppelin Contracts v5.5.0 source through fresh wrapper contracts. The raw routes returned their status and response. Helper routes either returned bytes or reverted, which is a different observable outcome. We did not relabel a helper's outer reversion as a directly observed inner call failure.

Executed
Toolchain
Solidity 0.8.36, Cancun target, optimizer and the intermediate representation pipeline enabled
Value-call population
2 routes multiplied by 8 target behaviors and 3 funding contexts: 48 attempts
Static population
2 routes multiplied by the same 8 target behaviors: 16 attempts
Funding contexts
Caller funded with 10 wei and value 0, funded with 10 wei and value 1, or unfunded with value 1
Input and execution cap
Payload 0x12345678, with a 2,000,000 gas cap on each outer fixture route
Exclusions
No row excluded from the completed 64-attempt grid

The targets were a no-code address, an empty-return fallback, a false-word fallback, a true-word fallback, a custom-error fallback, a one-byte fallback, the identity precompile and a storage-writing fallback. Each row started with a fresh wrapper and target state. Synthetic balances made the value boundary explicit rather than depending on a live account's funding.

Repository artifacts are seo/research/low-level-call-solidity-2026-12-04/measurement.py, CallMatrix.t.sol and measurement.json. They are retained in the repository, not published as download endpoints. The independent checker reconciled every full response, status, code-presence category, caller balance, recipient balance and storage counter against a separate case model. A second execution reproduced all 64 rows exactly.

Results

Execution outcomes from the constructed local grid, measured
RouteAttemptsWrapper completedWrapper revertedRaw trueRaw false
Raw CALL242401410
Address value helper241212Not exposedNot exposed
Raw STATICCALL88062
Address static helper853Not exposedNot exposed

All raw wrappers completed because they returned the target's outcome instead of requiring it to succeed. That includes the 10 failed raw value calls and 2 failed raw static calls. Calling those wrapper completions successful operations would reverse the meaning of the measurement.

For the false-word target, 3 raw cases reported transport success while returning a zero word. The corresponding 3 helper cases also returned that word without reverting. They were the funded zero-value call, funded one-wei call and static call. No token transfer or application Boolean consumer was involved.

Limits

  • This is a constructed local grid, not a deployed-protocol sample or an estimate of attack frequency.
  • The experiment used one short payload and selected deterministic targets. It does not exhaust arbitrary bytecode, return sizes, gas budgets or every precompile.
  • No delegatecall, token transfer, proxy, constructor, callback attack or application ABI decoder was executed. Those require separate fixtures.
  • The independent model checks the observations but is not a second EVM client. Compiler settings and the outer gas cap define this run, not a universal gas recommendation.

What Address adds and what it leaves to the caller

The pinned functionCallWithValue first checks the wrapper's balance, then performs the low-level call. On success, it returns the response when there are returned bytes or target code. A successful empty response from a target without code instead raises AddressEmptyCode. On failure, the helper bubbles nonempty revert data or raises FailedCall if there is no returned reason. These are execution checks. They do not define the operation's business result. The source explicitly describes returning raw data and leaves conversion to the expected type to the caller. Our false-word and one-byte targets show why an accepted byte sequence still needs interpretation.

Observed target boundaries for funded or static helper routes
Target behaviorHelper outcomeMeaning of the observation
No code, empty response3 empty-code errorsSuccessful raw execution can fail the helper's target check
Contract, empty response3 returned empty responsesExisting code can satisfy the helper without a return value
False-word contract3 returned zero wordsThe helper does not impose Boolean acceptance
One-byte contract3 returned one-byte responsesNonempty is not a complete expected result schema
Identity precompile3 returned four-byte responsesNo stored target code did not force rejection

The last row is a useful counterexample. The local identity precompile at 0x04 had zero stored code length but returned the four input bytes. The helper accepted its nonempty response. The opened Geth source independently maps that address to its data-copy implementation. Geth was a source reference here, not another client used to execute the matrix.

Code presence is not a complete target identity or authorization policy. A no-code address and a precompile can have different behavior, while a contract with code can still implement the wrong interface or an unacceptable operation. Our specific no-code fixture used 0xBEEF. It is not a model of every address whose code length happens to be zero.

Record the helper's release and exact source. The inspected release marks verifyCallResultFromTarget deprecated, while its target-free verifyCallResult has a different contract. A tutorial that post-processes a raw response through an older helper is not interchangeable with every current Address route. Pin the behavior you actually call.

Separate funding, rollback and static execution

A value call needs funds in the calling wrapper. The 8 unfunded raw calls returned false, whereas the 8 unfunded helper calls reverted with InsufficientBalance. That helper guard occurs before the target call. It is a separate failure class from the three observed empty-code errors, even when the requested target is the same no-code address.

One funded row made rollback visible. The raw call to the no-code address sent 1 wei successfully. With the helper, the target's empty response failed the later code check and the wrapper reverted. Its balance remained 10 wei and the target balance remained zero. The observable value transfer was rolled back with the rejected helper operation.

Selected retained-state comparisons from the same local grid; each cell reports one observed value
CaseState fieldRaw routeHelper route
Funded CALL, no-code target, value 1 weiCaller balance in wei910
Funded CALL, no-code target, value 1 weiRecipient balance in wei10
Funded CALL, storage-writing target, value 1 weiTarget counter11
STATICCALL, storage-writing targetTarget counter00

This difference matters for accounting. A caller should not mark a payment delivered merely because a lower-level transfer could have occurred before a later guard. Inspect the final transaction outcome and the state that survived it. Our balance comparison measured the synthetic wrapper and recipient only, without transaction fees or a real wallet's balance history.

Static execution changes a different condition. EIP214's STATICCALL specification prohibits state-changing operations under the static flag. The storage-writing fallback failed in the raw static route, and the static helper surfaced FailedCall because that failure provided no error bytes. The counter remained zero.

The same target incremented its counter in the two funded value-call contexts on each ordinary CALL route. A static failure was therefore not evidence that the function could never run. It reflected the execution mode. Read-only success also does not authorize a subsequent state-changing transaction or guarantee that its inputs will remain applicable.

A raw failure does not automatically choose the caller's next action. Our wrapper returned the failed target status to its caller and completed. An application that updates its own bookkeeping around such a call needs a separate test for the state it retains when the target fails. One proposed control is to place a recognizable caller-side state change before the call, then check the documented failure branch afterward. That control was not part of this fixture. It would answer a caller-policy question that a recipient balance alone cannot settle.

When designing a failure policy, identify which layer owns it: caller funding, helper validation, target exception or application acceptance. Those categories support different remediation. Adding funds cannot repair a wrong result schema, and switching execution mode is not a substitute for defining the intended state change.

Give returned bytes an explicit contract

Begin with the expected response type. An ABI Boolean has a defined encoding and value domain. A successful response containing a zero word is not the same observation as an execution failure, and one returned byte is not proof that a Boolean response was delivered. The matrix captured those bytes but did not execute a production decoder.

Transport success branches into different application decisionsThe same successful transport observation can contain a zero ABI word or a one-byte response. A Boolean consumer must interpret the zero according to its operation contract and must establish the response schema before using the short response. Neither case proves the intended state change.Transport succeededOutcome uncheckedZero word: decode and apply Boolean policyA returned false can decline the operationOne byte: establish the expected result schemaNonempty bytes do not establish a postcondition
Response interpretation follows transport. These are observed byte shapes with separate application decisions.
Boolean response
Decode the declared result and apply the operation's documented rule for false. Do not substitute the call-status Boolean.
Short response
Validate the expected response representation before consuming it. A nonempty response alone is insufficient evidence.
Postcondition
Check the intended state or value relationship at the layer that owns it, including behavior after a rejected operation.

A proposed consumer can make those stages visible:

Illustrative Boolean-consumer guard, not executed in the local matrix
bytes memory returned = Address.functionCall(target, payload);
require(returned.length == 32, "unexpected response");
require(abi.decode(returned, (bool)), "operation declined");
// Apply the application's target policy and state invariants separately.

This guard is appropriate only for an interface whose acceptance contract requires a single Boolean word. It would reject an intentionally empty-return interface. The target allowlist, payload binding and accounting invariant remain separate requirements, so copying the example is not a complete integration review.

Successful decoding is not a substitute for binding the declared interface either. The storage-writing fixture returned its updated count as a word containing 1. The true-word fixture returned the same numeric word for a different reason. Their byte shape did not identify which operation was authorized or which state should have changed. Our case model distinguished those targets through the known fixture and counter observation, not by treating a particular word as proof of identity. Keep the expected meaning with the target and payload when recording the result.

Error responses also carry bytes. The custom-error target returned the expected selector and argument through the failure routes. That supports our fixture classification, while the source API's warning about trusting error data still applies to real integrations. Keep the full payload when diagnosing a failure instead of reducing every response to one label.

Review the complete custom call path

An external call hands control to another execution context. The Address source warns about reentrancy when transferring control, and a successful transport result does not settle callback safety. Review the caller's state before the call and the invariants it expects afterward. Our targets did not attempt reentry, so the grid supplies no executed assurance for that path.

Return-data handling needs its own limits. The fixture used small deterministic responses and a fixed outer gas cap. It did not measure large-response copying, malicious memory expansion or application gas margins. Preserve those as explicit tests when an untrusted target can influence output size, rather than treating our accepted responses as a resource-safety certificate.

  1. Pin the deployed implementation, Address release and exact call route. Record who may choose the target and payload.
  2. Define the expected response and postcondition before running the happy path. Include the meaning of empty data or a returned false.
  3. Exercise target failure, insufficient funding and a code-presence boundary. Retain the raw result separately from a helper's outer exception.
  4. Inspect final balances and state after rejection. Add the application's callback, authorization and return-size cases that this grid did not execute.
  5. Keep the complete input and output packet with a reproducible test. Re-run the same cases after remediation and confirm the invariant that motivated each change.

Scope the custom application path, its intended state change and its observable failure behavior. Pharos Production describes automated analysis and manual line-by-line code review in its smart contract security audits service. Use that scope to request reproducible findings and verify remediation against the same call paths, including return-data handling and the invariants that should survive a failed operation.

For a token integration, continue with SafeERC20 transfer accounting rather than inferring received value from a call flag. Batched payable paths also need the separate conservation checks in payable multicall security. The Pharos Production member profile and security tools hub provide review and tooling context without replacing your acceptance criteria.

Apply the model to a new case: the relay receives an accepted helper response, but the user's credit did not increase. The next evidence is the decoded result and the caller's accounting path. Another successful transport observation cannot answer that state question.

Frequently asked questions

Can these CALL results be substituted for delegatecall tests?

No. Delegatecall has a distinct context contract, including the caller storage used by delegated code. The pinned Address source exposes a separate helper for that route. Our matrix executed ordinary and static calls only, so a proxy or delegated implementation needs its own storage, authority and value-context tests.

Does a returned custom error identify the contract that originated it?

The ABI specification warns against trusting error data: bytes may bubble from a deeper call or be fabricated to match an error signature. A selector is useful for diagnosis but does not authenticate the source contract. Our exact error payload comparison describes known local targets, not a general origin-verification mechanism.

Should a contract-code helper be used simply to pay a user address?

Choose the helper for the operation. The inspected sendValue route sends ether with empty calldata and does not impose the successful-empty-response code check used by functionCallWithValue. It still checks funding and propagates failure. Its source warns about transferred control and reentrancy. No sendValue or callback payment experiment was executed in this matrix.

Comments

0

    Leave a comment

    Share a question or observation about this article.

    10 to 3,000 characters.