Pre-check › Sample report

Sample report: Spardose.sol

A contract with four deliberately planted bugs, checked with the same process as a real inquiry. It shows what the pre-check finds, how it explains findings and what it cannot do.

Sample with made-up code. We wrote this contract ourselves for this report. It is not deployed anywhere and must not be used. The report was produced by an AI system without a human auditor. This is not an audit. The contract uses German identifiers (“Spardose” means piggy bank); their meaning is given in brackets.

Summary

No.FindingSeverityLocation
1Reentrancy: payout before the balance is resethighauszahlen(), lines 24–26
2Authorisation via tx.originhighnotfallAuszahlung(), line 31
3Anyone can set the ownerhighsetzeBesitzer(), line 37
4Return value of send is ignoredmediumauszahlenAn(), line 43
N1–N3Floating pragma, block.timestamp twicenotelines 4, 13, 48

The pattern check reported 8 raw hits. Of these, 4 are real bugs, 3 are notes without action needed, and 1 hit (compiler warning about send) duplicates finding 4.

Findings

1. Reentrancy in auszahlen() (withdraw)

Severity: high · lines 24–26

(bool ok, ) = msg.sender.call{value: betrag}("");
require(ok, "Ueberweisung fehlgeschlagen");
guthaben[msg.sender] = 0;

What happens: The funds (betrag, amount) leave the contract before the balance (guthaben) is set to 0. If the recipient is a contract, its receive function can call auszahlen() again and gets the same amount once more, until the piggy bank is empty.

Fix: Change state first, then transfer (checks-effects-interactions). A reentrancy guard can be added as well.

guthaben[msg.sender] = 0;
(bool ok, ) = msg.sender.call{value: betrag}("");
require(ok, "Ueberweisung fehlgeschlagen");

2. Authorisation via tx.origin

Severity: high · line 31

require(tx.origin == besitzer, "nur Besitzer");

What happens: tx.origin is always the account that started the transaction. If an attacker gets the owner (besitzer) to call any third-party contract, that contract can call notfallAuszahlung() (emergency withdrawal) and passes the check.

Fix: Check msg.sender instead of tx.origin.

3. setzeBesitzer() (set owner) without access control

Severity: high · line 37

function setzeBesitzer(address neu) external {
    besitzer = neu;
}

What happens: Any address can make itself the owner and then use every function reserved for the owner. Combined with findings 2 and 4, this is enough to drain the piggy bank.

Fix: require(msg.sender == besitzer) or a proven Ownable building block, plus an event on every change.

4. Return value of send is ignored

Severity: medium · line 43

ziel.send(betrag);

What happens: On failure, send only returns false. The function (auszahlenAn, pay out to) still completes successfully. The caller believes the payment went through.

Fix: Check the result, or better use call with require, or a pull pattern (the recipient withdraws the funds themselves).

Notes without action needed

Cross-check

A corrected version (order in auszahlen() swapped, tx.origin function removed, setzeBesitzer() with a check, pinned pragma) produces 0 findings of high or medium severity in the same process. That only means these patterns no longer occur, not that the contract is secure.

How it was checked

  1. Compilation with solc 0.8.28 (official Solidity compiler), compiler warnings included.
  2. Pattern check over the syntax tree: external calls before state changes, tx.origin, writes to permission variables without checking the caller, unchecked return values of call and send, delegatecall, selfdestruct, block.timestamp, floating pragma.
  3. Review of every raw hit by the AI system: real bug, note or false positive, with reasoning and fix.

What this process does not find

For code that manages real money, the pre-check does not replace an audit. It helps you get rid of obvious bugs beforehand, so an audit can focus on the hard questions.

Inquire about a pre-check