Home

Awesome

No-so-smart-contracts is now in building-secure-contracts (see https://secure-contracts.com/)

(Not So) Smart Contracts

This repository contains examples of common Ethereum smart contract vulnerabilities, including code from real smart contracts. Use Not So Smart Contracts to learn about EVM and Solidity vulnerabilities, as a reference when performing security reviews, and as a benchmark for security and analysis tools.

Features

Each Not So Smart Contract includes a standard set of information:

Bonus! We have also included a repository and analysis of several honeypots.

Vulnerabilities

Not So Smart ContractDescription
Bad randomnessContract attempts to get on-chain randomness, which can be manipulated by users
Denial of ServiceAttacker stalls contract execution by failing in strategic way
Forced Ether ReceptionContracts can be forced to receive Ether
Incorrect InterfaceImplementation uses different function signatures than interface
Integer OverflowArithmetic in Solidity (or EVM) is not safe by default
Race ConditionTransactions can be frontrun on the blockchain
ReentrancyCalling external contracts gives them control over execution
Unchecked External CallSome Solidity operations silently fail
Unprotected FunctionFailure to use function modifier allows attacker to manipulate contract
Variable ShadowingLocal variable name is identical to one in outer scope
Wrong Constructor NameAnyone can become owner of contract due to missing constructor

Credits

These examples are developed and maintained by Trail of Bits. Contributions are encouraged and are covered under our bounty program.

If you have questions, problems, or just want to learn more, then join the #ethereum channel on the Empire Hacking Slack or contact us directly.