# What is a proof of concept exploit in smart contracts?

URL: https://shield.quillaudits.com/learn/glossary/proof-of-concept-exploit/

A proof of concept exploit, or PoC, is code that carries out an attack on the contracts in question and checks the result, such as funds leaving a vault. In smart contract security it is usually a test in the framework the project already uses, run on a local chain or a mainnet fork, so anyone can rerun it.

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

## What is a proof of concept exploit?

It is the shortest program that turns a vulnerability report into something you can run: set up the state, run the attack, then assert what the attacker gained or the protocol lost. If the assertion holds on the real code the bug is reproducible, and if it doesn't, the finding needs another look before anyone acts on it.

## What does a proof of concept look like?

In this vault, `setOwner` has no access check, so the test plays the attacker and asserts that the vault ends up empty.

**A vulnerable vault and a PoC test (illustrative, not audited code)** `VaultPoC.sol`

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

contract Vault {
    address public owner = msg.sender;

    function setOwner(address newOwner) external {
        owner = newOwner; // bug: anyone can call this
    }

    function sweep(address payable to) external {
        require(msg.sender == owner, "not owner");
        to.transfer(address(this).balance);
    }

    receive() external payable {}
}

contract VaultPoC {
    Vault internal vault;

    function setUp() public {
        vault = new Vault();
        payable(address(vault)).transfer(10 ether);
    }

    function test_anyoneCanSweepTheVault() public {
        address payable attacker = payable(address(0xA11CE));
        vault.setOwner(address(this)); // 1. take ownership
        vault.sweep(attacker); // 2. move every wei out
        assert(address(vault).balance == 0 && attacker.balance == 10 ether);
    }
}
```

Real PoCs use forge-std cheatcodes to change `msg.sender`, balances and the block time ([Foundry](https://www.getfoundry.sh/reference/cheatcodes/overview)), and run on a fork of mainnet when the bug depends on live state ([Foundry](https://www.getfoundry.sh/guides/fork-testing)).

## What makes a proof of concept convincing?

CodeHawks recommends a working test, a comment on every line and separate attacker, victim and protocol accounts ([CodeHawks](https://docs.cyfrin.io/codehawks/write-a-proof-of-concept-poc)). The impact it proves feeds the [severity classification](https://shield.quillaudits.com/learn/glossary/severity-classification/).

- Starts from the deployed configuration, or a fork at a stated block
- Asserts the outcome: balances moved, an invariant broken or a call that should revert

## How does QuillShield use proofs of concept?

QuillShield runs a full audit of a Solidity codebase in a Foundry project. A separate reviewer agent tries to disprove every finding before you see it, and each finding that holds up comes with the exact lines, the impact, a recommended fix and, on full audits, a proof of concept.

## FAQ

### Does a failing proof of concept mean the bug is not real?

Not always, because a PoC can fail when its setup is wrong, the fork block is too old or a precondition was missed. Treat a failing PoC as a reason to recheck the finding, not as proof that it is harmless.

### Should a proof of concept run against mainnet?

No, run it on a local chain or a fork, which copies mainnet state without sending real transactions, and follow the rules of any bounty program you report to.

## Sources

- [Cheatcodes overview, Foundry docs](https://www.getfoundry.sh/reference/cheatcodes/overview) · checked 3 December 2026
- [Fork testing, Foundry docs](https://www.getfoundry.sh/guides/fork-testing) · checked 3 December 2026
- [Write a proof of concept (PoC), Cyfrin CodeHawks docs](https://docs.cyfrin.io/codehawks/write-a-proof-of-concept-poc) · checked 3 December 2026
