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. | Finding | Severity | Location |
|---|---|---|---|
| 1 | Reentrancy: payout before the balance is reset | high | auszahlen(), lines 24–26 |
| 2 | Authorisation via tx.origin | high | notfallAuszahlung(), line 31 |
| 3 | Anyone can set the owner | high | setzeBesitzer(), line 37 |
| 4 | Return value of send is ignored | medium | auszahlenAn(), line 43 |
| N1–N3 | Floating pragma, block.timestamp twice | note | lines 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
- N1, line 4:
pragma solidity ^0.8.20;allows any compiler from 0.8.20 upwards. For deployment, pin the exact version you tested with. - N2 and N3, lines 13 and 48: The lock uses block.timestamp. Block producers can shift the timestamp by seconds. For a 30-day lock this does not matter, so it is not a finding.
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
- Compilation with solc 0.8.28 (official Solidity compiler), compiler warnings included.
- 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.
- 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
- Errors in business logic (wrong formula, wrong order of steps that is not a known pattern)
- Economic attacks: price manipulation, flash loans, oracle risks, MEV
- Risks in third-party contracts your code calls, and in upgrade mechanisms
- Patterns not in the list above. Tools such as Slither or Aderyn know more patterns; they do not currently run in our environment.
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.