Vulnerability Type stringclasses 10
values | File Name stringlengths 9 47 | Source Code stringlengths 228 96.8k | input stringlengths 116 49.7k |
|---|---|---|---|
denial_of_service | dos_simple.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/dos_gas_limit/dos_simple.sol
* @author: -
* @vulnerable_at_lines: 17,18
*/
pragma solidity ^0.4.25;
contract DosOneFunc {
address[] listAddresses;
function ifillArray() public returns (bool){
if(listAddre... | pragma solidity ^0.4.25;
contract DosOneFunc {
address[] listAddresses;
function ifillArray() public returns (bool){
if(listAddresses.length<1500) {
for(uint i=0;i<350;i++) {
listAddresses.push(msg.sender);
}
return true;
} els... |
front_running | ERC20.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/transaction_order_dependence/ERC20.sol
* @author: -
* @vulnerable_at_lines: 110,113
*/
pragma solidity ^0.4.24;
/** Taken from the OpenZeppelin github
* @title SafeMath
* @dev Math operations with safety checks that rever... | pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
... |
front_running | FindThisHash.sol | /*
* @source: https://github.com/sigp/solidity-security-blog
* @author: -
* @vulnerable_at_lines: 17
*/
pragma solidity ^0.4.22;
contract FindThisHash {
bytes32 constant public hash = 0xb5b5b97fafd9855eec9b41f74dfb6c38f5951141f9a3ecd7f44d5479b630ee0a;
constructor() public payable {} // load with ether
... | pragma solidity ^0.4.22;
contract FindThisHash {
bytes32 constant public hash = 0xb5b5b97fafd9855eec9b41f74dfb6c38f5951141f9a3ecd7f44d5479b630ee0a;
constructor() public payable {}
function solve(string solution) public {
require(hash == sha3(solution));
msg.sender.tran... |
front_running | eth_tx_order_dependence_minimal.sol | /*
* @source: https://github.com/ConsenSys/evm-analyzer-benchmark-suite
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 23,31
*/
pragma solidity ^0.4.16;
contract EthTxOrderDependenceMinimal {
address public owner;
bool public claimed;
uint public reward;
function EthTxOrderDependenceMinimal() ... | pragma solidity ^0.4.16;
contract EthTxOrderDependenceMinimal {
address public owner;
bool public claimed;
uint public reward;
function EthTxOrderDependenceMinimal() public {
owner = msg.sender;
}
function setReward() public payable {
require (!claimed);
require(msg.s... |
front_running | odds_and_evens.sol | /*
* @source: http://blockchain.unica.it/projects/ethereum-survey/attacks.html#oddsandevens
* @author: -
* @vulnerable_at_lines: 25,28
*/
pragma solidity ^0.4.2;
contract OddsAndEvens{
struct Player {
address addr;
uint number;
}
Player[2] public players; //public only for debug purpose
... | pragma solidity ^0.4.2;
contract OddsAndEvens{
struct Player {
address addr;
uint number;
}
Player[2] public players;
uint8 tot;
address owner;
function OddsAndEvens() {
owner = msg.sender;
}
function play(uint number) payable{
if (msg.value != 1 ether) throw;
pla... |
access_control | multiowned_vulnerable.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/solidity/unprotected_critical_functions/multiowned_vulnerable/multiowned_vulnerable.sol
* @author: -
* @vulnerable_at_lines: 38
*/
pragma solidity ^0.4.23;
/**
* @title MultiOwnable
*/
contract MultiOwnable {
address pu... | pragma solidity ^0.4.23;
contract MultiOwnable {
address public root;
mapping (address => address) public owners;
constructor() public {
root = msg.sender;
owners[root] = root;
}
modifier onlyOwner() {
require(owners[msg.sender] != 0);
_;
}
function newOwner(address _owne... |
access_control | phishable.sol | /*
* @source: https://github.com/sigp/solidity-security-blog
* @author: -
* @vulnerable_at_lines: 20
*/
pragma solidity ^0.4.22;
contract Phishable {
address public owner;
constructor (address _owner) {
owner = _owner;
}
function () public payable {} // collect ether
function with... | pragma solidity ^0.4.22;
contract Phishable {
address public owner;
constructor (address _owner) {
owner = _owner;
}
function () public payable {}
function withdrawAll(address _recipient) public {
require(tx.origin == owner);
_recipient.transfer(this.balance);
... |
access_control | incorrect_constructor_name1.sol | /*
* @source: https://github.com/trailofbits/not-so-smart-contracts/blob/master/wrong_constructor_name/incorrect_constructor.sol
* @author: Ben Perez
* @vulnerable_at_lines: 20
*/
pragma solidity ^0.4.24;
contract Missing{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
... | pragma solidity ^0.4.24;
contract Missing{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
}
function IamMissing()
public
{
owner = msg.sender;
}
function () payable {}
function withdraw()
public
... |
access_control | wallet_03_wrong_constructor.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-105#wallet-03-wrong-constructorsol
* @author: -
* @vulnerable_at_lines: 19,20
*/
pragma solidity ^0.4.24;
/* User can add pay in and withdraw Ether.
The constructor is wrongly named, so anyone can become 'creator' and withdraw all f... | pragma solidity ^0.4.24;
contract Wallet {
address creator;
mapping(address => uint256) balances;
function initWallet() public {
creator = msg.sender;
}
function deposit() public payable {
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
... |
access_control | incorrect_constructor_name2.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-118#incorrect-constructor-name1sol
* @author: Ben Perez
* @vulnerable_at_lines: 18
*/
pragma solidity ^0.4.24;
contract Missing{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
}
... | pragma solidity ^0.4.24;
contract Missing{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
}
function missing()
public
{
owner = msg.sender;
}
function () payable {}
function withdraw()
public
onlyowner
... |
access_control | incorrect_constructor_name3.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-118#incorrect-constructor-name2sol
* @author: Ben Perez
* @vulnerable_at_lines: 17
*/
pragma solidity ^0.4.24;
contract Missing{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
}
... | pragma solidity ^0.4.24;
contract Missing{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
}
function Constructor()
public
{
owner = msg.sender;
}
function () payable {}
function withdraw()
public
onlyown... |
access_control | proxy.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-112#proxysol
* @author: -
* @vulnerable_at_lines: 19
*/
pragma solidity ^0.4.24;
contract Proxy {
address owner;
constructor() public {
owner = msg.sender;
}
function forward(address callee, bytes _data) public {
// <ye... | pragma solidity ^0.4.24;
contract Proxy {
address owner;
constructor() public {
owner = msg.sender;
}
function forward(address callee, bytes _data) public {
require(callee.delegatecall(_data));
}
} |
access_control | parity_wallet_bug_1.sol | /*
* @source: https://github.com/paritytech/parity-ethereum/blob/4d08e7b0aec46443bf26547b17d10cb302672835/js/src/contracts/snippets/enhanced-wallet.sol#L216
* @author: parity
* @vulnerable_at_lines: 223,437
*/
//sol Wallet
// Multi-sig, daily-limited account proxy/wallet.
// @authors:
// Gav Wood <g@ethdev.com>
//... | pragma solidity 0.4.9;
contract WalletEvents {
event Confirmation(address owner, bytes32 operation);
event Revoke(address owner, bytes32 operation);
event OwnerChanged(address oldOwner, address newOwner);
event OwnerAdded(address newOwner);
event OwnerRemoved(address oldOwner);
event Req... |
access_control | parity_wallet_bug_2.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-106#walletlibrarysol
* @author: -
* @vulnerable_at_lines: 226,233
*/
//sol Wallet
// Multi-sig, daily-limited account proxy/wallet.
// @authors:
// Gav Wood <g@ethdev.com>
// inheritable "property" contract that enables methods to be prote... | pragma solidity ^0.4.9;
contract WalletEvents {
event Confirmation(address owner, bytes32 operation);
event Revoke(address owner, bytes32 operation);
event OwnerChanged(address oldOwner, address newOwner);
event OwnerAdded(address newOwner);
event OwnerRemoved(address oldOwner);
event Req... |
access_control | wallet_04_confused_sign.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-105#wallet-04-confused-signsol
* @author: -
* @vulnerable_at_lines: 30
*/
pragma solidity ^0.4.24;
/* User can add pay in and withdraw Ether.
Unfortunatelty, the developer was drunk and used the wrong comparison operator in "withdra... | pragma solidity ^0.4.24;
contract Wallet {
address creator;
mapping(address => uint256) balances;
constructor() public {
creator = msg.sender;
}
function deposit() public payable {
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
balances[msg.s... |
access_control | FibonacciBalance.sol | /*
* @source: https://github.com/sigp/solidity-security-blog
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 31,38
*/
//added pragma version
pragma solidity ^0.4.22;
contract FibonacciBalance {
address public fibonacciLibrary;
// the current fibonacci number to withdraw
uint public calculatedFibNum... | pragma solidity ^0.4.22;
contract FibonacciBalance {
address public fibonacciLibrary;
uint public calculatedFibNumber;
uint public start = 3;
uint public withdrawalCounter;
bytes4 constant fibSig = bytes4(sha3("setFibonacci(uint256)"));
constructor(address _fibonacciLibrar... |
access_control | unprotected0.sol | /*
* @source: https://github.com/trailofbits/not-so-smart-contracts/blob/master/unprotected_function/Unprotected.sol
* @author: -
* @vulnerable_at_lines: 25
*/
pragma solidity ^0.4.15;
contract Unprotected{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
... | pragma solidity ^0.4.15;
contract Unprotected{
address private owner;
modifier onlyowner {
require(msg.sender==owner);
_;
}
function Unprotected()
public
{
owner = msg.sender;
}
function changeOwner(address _newOwner)
publi... |
access_control | rubixi.sol | /*
* @source: https://github.com/trailofbits/not-so-smart-contracts/blob/master/wrong_constructor_name/Rubixi_source_code/Rubixi.sol
* @author: -
* @vulnerable_at_lines: 23,24
*/
// 0xe82719202e5965Cf5D9B6673B7503a3b92DE20be#code
pragma solidity ^0.4.15;
contract Rubixi {
//Declare variables for stora... | pragma solidity ^0.4.15;
contract Rubixi {
uint private balance = 0;
uint private collectedFees = 0;
uint private feePercent = 10;
uint private pyramidMultiplier = 300;
uint private payoutOrder = 0;
address private creator;
... |
access_control | arbitrary_location_write_simple.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-124#arbitrary-location-write-simplesol
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 27
*/
pragma solidity ^0.4.25;
contract Wallet {
uint[] private bonusCodes;
address private owner;
constructor() public {
... | pragma solidity ^0.4.25;
contract Wallet {
uint[] private bonusCodes;
address private owner;
constructor() public {
bonusCodes = new uint[](0);
owner = msg.sender;
}
function () public payable {
}
function PushBonusCode(uint c) public {
bonusCodes.push(... |
access_control | mycontract.sol | /*
* @source: https://consensys.github.io/smart-contract-best-practices/recommendations/#avoid-using-txorigin
* @author: Consensys Diligence
* @vulnerable_at_lines: 20
* Modified by Gerhard Wagner
*/
pragma solidity ^0.4.24;
contract MyContract {
address owner;
function MyContract() public {
ow... | pragma solidity ^0.4.24;
contract MyContract {
address owner;
function MyContract() public {
owner = msg.sender;
}
function sendTo(address receiver, uint amount) public {
require(tx.origin == owner);
receiver.transfer(amount);
}
} |
access_control | wallet_02_refund_nosub.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-105#wallet-02-refund-nosubsol
* @author: -
* @vulnerable_at_lines: 36
*/
pragma solidity ^0.4.24;
/* User can add pay in and withdraw Ether.
Unfortunately the developer forgot set the user's balance to 0 when refund() is called.
... | pragma solidity ^0.4.24;
contract Wallet {
address creator;
mapping(address => uint256) balances;
constructor() public {
creator = msg.sender;
}
function deposit() public payable {
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
balances[msg.s... |
access_control | simple_suicide.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/unprotected_critical_functions/simple_suicide.sol
* @author: -
* @vulnerable_at_lines: 12,13
*/
//added prgma version
pragma solidity ^0.4.0;
contract SimpleSuicide {
// <yes> <report> ACCESS_CONTROL
function sudicideAn... | pragma solidity ^0.4.0;
contract SimpleSuicide {
function sudicideAnyone() {
selfdestruct(msg.sender);
}
} |
access_control | mapping_write.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-124#mapping-writesol
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 20
*/
pragma solidity ^0.4.24;
//This code is derived from the Capture the Ether https://capturetheether.com/challenges/math/mapping/
contract Map {
address p... | pragma solidity ^0.4.24;
contract Map {
address public owner;
uint256[] map;
function set(uint256 key, uint256 value) public {
if (map.length <= key) {
map.length = key + 1;
}
map[key] = value;
}
function get(uint256 key) public view retur... |
arithmetic | token.sol | /*
* @source: https://github.com/sigp/solidity-security-blog
* @author: Steve Marx
* @vulnerable_at_lines: 20,22
*/
pragma solidity ^0.4.18;
contract Token {
mapping(address => uint) balances;
uint public totalSupply;
function Token(uint _initialSupply) {
balances[msg.sender] = totalSupply = _in... | pragma solidity ^0.4.18;
contract Token {
mapping(address => uint) balances;
uint public totalSupply;
function Token(uint _initialSupply) {
balances[msg.sender] = totalSupply = _initialSupply;
}
function transfer(address _to, uint _value) public returns (bool) {
require(balances[msg.... |
arithmetic | overflow_single_tx.sol | /*
* @source: https://github.com/ConsenSys/evm-analyzer-benchmark-suite
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 18,24,30,36,42,48
*/
//Single transaction overflow
//Post-transaction effect: overflow escapes to publicly-readable storage
pragma solidity ^0.4.23;
contract IntegerOverflowSingleTransaction ... | pragma solidity ^0.4.23;
contract IntegerOverflowSingleTransaction {
uint public count = 1;
function overflowaddtostate(uint256 input) public {
count += input;
}
function overflowmultostate(uint256 input) public {
count *= input;
}
function un... |
arithmetic | integer_overflow_minimal.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/integer_overflow_and_underflow/integer_overflow_minimal.sol
* @author: -
* @vulnerable_at_lines: 17
*/
//Single transaction overflow
//Post-transaction effect: overflow escapes to publicly-readable storage
pragma solidity ^... | pragma solidity ^0.4.19;
contract IntegerOverflowMinimal {
uint public count = 1;
function run(uint256 input) public {
count -= input;
}
} |
arithmetic | integer_overflow_add.sol | /*
* @source: https://github.com/ConsenSys/evm-analyzer-benchmark-suite/blob/master/benchmarks/integer_overflow_add.sol
* @author: -
* @vulnerable_at_lines: 17
*/
//Single transaction overflow
//Post-transaction effect: overflow escapes to publicly-readable storage
pragma solidity ^0.4.19;
contract IntegerOverfl... | pragma solidity ^0.4.19;
contract IntegerOverflowAdd {
uint public count = 1;
function run(uint256 input) public {
count += input;
}
} |
arithmetic | insecure_transfer.sol | /*
* @source: https://consensys.github.io/smart-contract-best-practices/known_attacks/#front-running-aka-transaction-ordering-dependence
* @author: consensys
* @vulnerable_at_lines: 18
*/
pragma solidity ^0.4.10;
contract IntegerOverflowAdd {
mapping (address => uint256) public balanceOf;
// INSECURE
... | pragma solidity ^0.4.10;
contract IntegerOverflowAdd {
mapping (address => uint256) public balanceOf;
function transfer(address _to, uint256 _value) public{
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
}
} |
arithmetic | integer_overflow_benign_1.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/integer_overflow_and_underflow/integer_overflow_benign_1.sol
* @author: -
* @vulnerable_at_lines: 17
*/
//Single transaction overflow
//Post-transaction effect: overflow never escapes function
pragma solidity ^0.4.19;
cont... | pragma solidity ^0.4.19;
contract IntegerOverflowBenign1 {
uint public count = 1;
function run(uint256 input) public {
uint res = count - input;
}
} |
arithmetic | timelock.sol | /*
* @source: https://github.com/sigp/solidity-security-blog
* @author: -
* @vulnerable_at_lines: 22
*/
//added pragma version
pragma solidity ^0.4.10;
contract TimeLock {
mapping(address => uint) public balances;
mapping(address => uint) public lockTime;
function deposit() public payable {
... | pragma solidity ^0.4.10;
contract TimeLock {
mapping(address => uint) public balances;
mapping(address => uint) public lockTime;
function deposit() public payable {
balances[msg.sender] += msg.value;
lockTime[msg.sender] = now + 1 weeks;
}
function increaseLockTime(uint ... |
arithmetic | integer_overflow_1.sol | /*
* @source: https://github.com/trailofbits/not-so-smart-contracts/blob/master/integer_overflow/integer_overflow_1.sol
* @author: -
* @vulnerable_at_lines: 14
*/
pragma solidity ^0.4.15;
contract Overflow {
uint private sellerBalance=0;
function add(uint value) returns (bool){
// <yes> <rep... | pragma solidity ^0.4.15;
contract Overflow {
uint private sellerBalance=0;
function add(uint value) returns (bool){
sellerBalance += value;
}
} |
arithmetic | integer_overflow_mapping_sym_1.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/integer_overflow_and_underflow/integer_overflow_mapping_sym_1.sol
* @author: -
* @vulnerable_at_lines: 16
*/
//Single transaction overflow
pragma solidity ^0.4.11;
contract IntegerOverflowMappingSym1 {
mapping(uint256 ... | pragma solidity ^0.4.11;
contract IntegerOverflowMappingSym1 {
mapping(uint256 => uint256) map;
function init(uint256 k, uint256 v) public {
map[k] -= v;
}
} |
arithmetic | overflow_simple_add.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-101#overflow-simple-addsol
* @author: -
* @vulnerable_at_lines: 14
*/
pragma solidity 0.4.25;
contract Overflow_Add {
uint public balance = 1;
function add(uint256 deposit) public {
// <yes> <report> ARITHMETIC
ba... | pragma solidity 0.4.25;
contract Overflow_Add {
uint public balance = 1;
function add(uint256 deposit) public {
balance += deposit;
}
} |
arithmetic | integer_overflow_mul.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/integer_overflow_and_underflow/integer_overflow_mul.sol
* @author: -
* @vulnerable_at_lines: 17
*/
//Single transaction overflow
//Post-transaction effect: overflow escapes to publicly-readable storage
pragma solidity ^0.4.... | pragma solidity ^0.4.19;
contract IntegerOverflowMul {
uint public count = 2;
function run(uint256 input) public {
count *= input;
}
} |
arithmetic | tokensalechallenge.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-101 // https://capturetheether.com/challenges/math/token-sale/
* @author: Steve Marx
* @vulnerable_at_lines: 23,25,33
*/
pragma solidity ^0.4.21;
contract TokenSaleChallenge {
mapping(address => uint256) public balanceOf;
uint256 ... | pragma solidity ^0.4.21;
contract TokenSaleChallenge {
mapping(address => uint256) public balanceOf;
uint256 constant PRICE_PER_TOKEN = 1 ether;
function TokenSaleChallenge(address _player) public payable {
require(msg.value == 1 ether);
}
function isComplete() public view returns (bool) ... |
arithmetic | integer_overflow_multitx_multifunc_feasible.sol | /*
* @source: https://github.com/ConsenSys/evm-analyzer-benchmark-suite
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 25
*/
//Multi-transactional, multi-function
//Arithmetic instruction reachable
pragma solidity ^0.4.23;
contract IntegerOverflowMultiTxMultiFuncFeasible {
uint256 private initialized = 0;... | pragma solidity ^0.4.23;
contract IntegerOverflowMultiTxMultiFuncFeasible {
uint256 private initialized = 0;
uint256 public count = 1;
function init() public {
initialized = 1;
}
function run(uint256 input) {
if (initialized == 0) {
return;
}
c... |
arithmetic | BECToken.sol | /*
* @source: https://smartcontractsecurity.github.io/SWC-registry/docs/SWC-101#bectokensol
* @author: -
* @vulnerable_at_lines: 264
*/
pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) interna... | pragma solidity ^0.4.16;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a / b;
return c;
... |
arithmetic | integer_overflow_multitx_onefunc_feasible.sol | /*
* @source: https://github.com/ConsenSys/evm-analyzer-benchmark-suite
* @author: Suhabe Bugrara
* @vulnerable_at_lines: 22
*/
//Multi-transactional, single function
//Arithmetic instruction reachable
pragma solidity ^0.4.23;
contract IntegerOverflowMultiTxOneFuncFeasible {
uint256 private initialized = 0;
... | pragma solidity ^0.4.23;
contract IntegerOverflowMultiTxOneFuncFeasible {
uint256 private initialized = 0;
uint256 public count = 1;
function run(uint256 input) public {
if (initialized == 0) {
initialized = 1;
return;
}
count -= input;
}
} |
time_manipulation | ether_lotto.sol | /*
* @article: https://blog.positive.com/predicting-random-numbers-in-ethereum-smart-contracts-e5358c6b8620
* @source: https://etherscan.io/address/0xa11e4ed59dc94e69612f3111942626ed513cb172#code
* @vulnerable_at_lines: 43
* @author: -
*/
pragma solidity ^0.4.15;
/// @title Ethereum Lottery Game.
contract Ethe... | pragma solidity ^0.4.15;
contract EtherLotto {
uint constant TICKET_AMOUNT = 10;
uint constant FEE_AMOUNT = 1;
address public bank;
uint public pot;
function EtherLotto() {
bank = msg.sender;
}
function play() payable {
as... |
time_manipulation | roulette.sol | /*
* @source: https://github.com/sigp/solidity-security-blog
* @author: -
* @vulnerable_at_lines: 18,20
*/
pragma solidity ^0.4.25;
contract Roulette {
uint public pastBlockTime; // Forces one bet per block
constructor() public payable {} // initially fund contract
// fallback function used to make ... | pragma solidity ^0.4.25;
contract Roulette {
uint public pastBlockTime;
constructor() public payable {}
function () public payable {
require(msg.value == 10 ether);
require(now != pastBlockTime);
pastBlockTime = now;
if(now % 15 == 0) {
... |
time_manipulation | lottopollo.sol | /*
* @source: https://github.com/seresistvanandras/EthBench/blob/master/Benchmark/Simple/timestampdependent.sol
* @author: -
* @vulnerable_at_lines: 13,27
*/
pragma solidity ^0.4.0;
contract lottopollo {
address leader;
uint timestamp;
function payOut(uint rand) internal {
// <yes> <report> TIME MANIP... | pragma solidity ^0.4.0;
contract lottopollo {
address leader;
uint timestamp;
function payOut(uint rand) internal {
if ( rand> 0 && now - rand > 24 hours ) {
msg.sender.send( msg.value );
if ( this.balance > 0 ) {
leader.send( this.balance );
}
}
else if ( msg.value ... |
time_manipulation | governmental_survey.sol | /*
* @source: http://blockchain.unica.it/projects/ethereum-survey/attacks.html#governmental
* @author: -
* @vulnerable_at_lines: 27
*/
//added pragma version
pragma solidity ^0.4.0;
contract Governmental {
address public owner;
address public lastInvestor;
uint public jackpot = 1 ether;
uint public lastIn... | pragma solidity ^0.4.0;
contract Governmental {
address public owner;
address public lastInvestor;
uint public jackpot = 1 ether;
uint public lastInvestmentTimestamp;
uint public ONE_MINUTE = 1 minutes;
function Governmental() {
owner = msg.sender;
if (msg.value<1 ether) throw;
}
function inv... |
time_manipulation | timed_crowdsale.sol | /*
* @source: https://github.com/SmartContractSecurity/SWC-registry/blob/master/test_cases/timestamp_dependence/timed_crowdsale.sol
* @author: -
* @vulnerable_at_lines: 13
*/
pragma solidity ^0.4.25;
contract TimedCrowdsale {
// Sale should finish exactly at January 1, 2019
function isSaleFinished() view publ... | pragma solidity ^0.4.25;
contract TimedCrowdsale {
function isSaleFinished() view public returns (bool) {
return block.timestamp >= 1546300800;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.