crytic/not-so-smart-contracts

Examples of Solidity security issues

Solidity

2,224

66 commits

updated Feb 24, 2023

See the code

README

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:

  • Description of the unique vulnerability type
  • Attack scenarios to exploit the vulnerability
  • Recommendations to eliminate or mitigate the vulnerability
  • Real-world contracts that exhibit the flaw
  • References to third-party resources with more 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.

ethereum
solidity
vulnerabilities

crytic/not-so-smart-contracts

Examples of Solidity security issues

Solidity

2,224

66 commits

updated Feb 24, 2023

See the code

README

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:

  • Description of the unique vulnerability type
  • Attack scenarios to exploit the vulnerability
  • Recommendations to eliminate or mitigate the vulnerability
  • Real-world contracts that exhibit the flaw
  • References to third-party resources with more 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.

ethereum
solidity
vulnerabilities

Significant stargazers

Benno Fünfstück

156 followers · starred Oct 2018

Ying Sheng

2,214 followers · starred Jun 2022

John Phamous

453 followers · starred May 2022

Ben Burns

215 followers · starred May 2022