# What is symbolic execution in smart contracts?

URL: https://shield.quillaudits.com/learn/glossary/symbolic-execution/

Symbolic execution analyzes a contract by running its functions on symbolic values, such as `a` and `b`, instead of concrete numbers ([ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/)). At each branch it records the condition needed to go each way, and a constraint solver then says whether a path to a failing assertion is possible and, if it is, returns inputs that take it.

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

## How does symbolic execution find a bug?

In the function below, random inputs would need to land on a pair where `b` is exactly `2a + 12345` with `a` above 1,000, which almost never happens. Symbolic execution reads that condition off the branch and solves it directly, returning for example `a = 1001` and `b = 14347`.

**A failure behind a narrow branch condition (illustrative, not audited code)** `HiddenPath.sol`

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

contract HiddenPath {
    bool public broken;

    function poke(uint256 a, uint256 b) external {
        if (a > 1000 && a < 2 ** 128 && b == a * 2 + 12345) {
            broken = true; // the state no test was meant to reach
        }
        assert(!broken);
    }
}
```

## Which tools use symbolic execution?

Mythril describes itself as a symbolic-execution-based security analysis tool for EVM bytecode ([Mythril](https://github.com/Consensys/mythril)), and ethereum.org also lists Manticore and hevm as symbolic execution tools ([ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/)). Trail of Bits lists Halmos, with Certora and KEVM, among formal verification tools ([Trail of Bits](https://blog.trailofbits.com/2025/02/12/the-call-for-invariant-driven-development/)).

## What are its limits?

Each branch can double the number of paths, so loops and long call sequences cause path explosion, and tools cap how deep they go. Hashes such as `keccak256` of an input are hard for a solver to invert, and calls to unknown contracts have to be modeled. A path the tool didn't explore is not a path proved safe, which is the difference from [formal verification](https://shield.quillaudits.com/learn/glossary/formal-verification/) against a full specification.

- Use it on functions with narrow branch conditions that [fuzzing](https://shield.quillaudits.com/learn/glossary/fuzzing/) keeps missing.
- Keep the target bounded: few loops and no unknown external calls.
- Turn each counterexample into a regular test, so the bug stays fixed.

## Sources

- [Formal verification of smart contracts, ethereum.org](https://ethereum.org/developers/docs/smart-contracts/formal-verification/) · checked 3 December 2026
- [Mythril, Consensys (GitHub)](https://github.com/Consensys/mythril) · checked 3 December 2026
- [The call for invariant-driven development, Trail of Bits](https://blog.trailofbits.com/2025/02/12/the-call-for-invariant-driven-development/) · checked 3 December 2026
