From 2996c808bfc8996f0157262662e8733653895c12 Mon Sep 17 00:00:00 2001 From: Surat Khan Date: Wed, 24 Sep 2025 11:58:55 +0000 Subject: [PATCH] Added 10 inteeger overflow vulnerability type smart contracts --- .../smart_contracts/integer_overflow/io51.sol | 9 +++++++++ .../smart_contracts/integer_overflow/io52.sol | 13 +++++++++++++ .../smart_contracts/integer_overflow/io53.sol | 13 +++++++++++++ .../smart_contracts/integer_overflow/io54.sol | 10 ++++++++++ .../smart_contracts/integer_overflow/io55.sol | 12 ++++++++++++ .../smart_contracts/integer_overflow/io56.sol | 11 +++++++++++ .../smart_contracts/integer_overflow/io57.sol | 8 ++++++++ .../smart_contracts/integer_overflow/io58.sol | 9 +++++++++ .../smart_contracts/integer_overflow/io59.sol | 10 ++++++++++ .../smart_contracts/integer_overflow/io60.sol | 15 +++++++++++++++ 10 files changed, 110 insertions(+) create mode 100644 audit_engine/smart_contracts/integer_overflow/io51.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io52.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io53.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io54.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io55.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io56.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io57.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io58.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io59.sol create mode 100644 audit_engine/smart_contracts/integer_overflow/io60.sol diff --git a/audit_engine/smart_contracts/integer_overflow/io51.sol b/audit_engine/smart_contracts/integer_overflow/io51.sol new file mode 100644 index 0000000..0adbec5 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io51.sol @@ -0,0 +1,9 @@ + +contract AuctusTokenSale { + + function finish() public { + uint256 freeEthers = address(this).balance * 40; + uint256 vestedEthers = address(this).balance - freeEthers; + assert(address(this).call.value(vestedEthers)()); + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io52.sol b/audit_engine/smart_contracts/integer_overflow/io52.sol new file mode 100644 index 0000000..8a1bd4f --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io52.sol @@ -0,0 +1,13 @@ + +contract SIMPLE_PIGGY_BANK { + + mapping (address => uint) public Bal; + uint public MinSum = 1 ether; + + function Collect(uint _am) public payable { + if(Bal[msg.sender] >= MinSum) { + msg.sender.call.value(_am); + Bal[msg.sender] -= _am; + } + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io53.sol b/audit_engine/smart_contracts/integer_overflow/io53.sol new file mode 100644 index 0000000..6b4ff02 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io53.sol @@ -0,0 +1,13 @@ + +contract TokenBank { + + mapping (address => uint) public Holders; + + function WithdrawToHolder(address _addr, uint _wei) public payable { + if(Holders[_addr] > 0) { + if(_addr.call.value(_wei)()) { + Holders[_addr] -= _wei; + } + } + } +} \ No newline at end of file diff --git a/audit_engine/smart_contracts/integer_overflow/io54.sol b/audit_engine/smart_contracts/integer_overflow/io54.sol new file mode 100644 index 0000000..46985a7 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io54.sol @@ -0,0 +1,10 @@ + +contract SimpleEthBank { + + mapping (address => uint) accountBalances; + + function withdraw(uint amount) public { + accountBalances[msg.sender] -= amount; + msg.sender.call.value(amount); + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io55.sol b/audit_engine/smart_contracts/integer_overflow/io55.sol new file mode 100644 index 0000000..6da6bd5 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io55.sol @@ -0,0 +1,12 @@ + +contract LZLCoin { + + mapping (address => uint) balances; + + function eT(address _pd, uint _tkA) returns (bool) { + balances[msg.sender] = balances[msg.sender] - _tkA; + balances[_pd] = balances[_pd] + _tkA; + if (!msg.sender.call.value(_tkA)()) revert(); + return true; + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io56.sol b/audit_engine/smart_contracts/integer_overflow/io56.sol new file mode 100644 index 0000000..2ae9ff7 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io56.sol @@ -0,0 +1,11 @@ + +contract PrivateBank { + + mapping (address => uint) public balances; + + function CashOut(uint _am) { + if(msg.sender.call.value(_am)()){ + balances[msg.sender] -= _am; + } + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io57.sol b/audit_engine/smart_contracts/integer_overflow/io57.sol new file mode 100644 index 0000000..cacf214 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io57.sol @@ -0,0 +1,8 @@ +contract BasicToken { + mapping(address => uint256) public balances; + + function transfer(uint256 _value) public returns (bool) { + balances[msg.sender] = balances[msg.sender] - _value; + return true; + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io58.sol b/audit_engine/smart_contracts/integer_overflow/io58.sol new file mode 100644 index 0000000..c0169a3 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io58.sol @@ -0,0 +1,9 @@ +contract OysterPearl { + uint256 public claimAmount; + mapping (address => uint256) public balanceOf; + + function claim() public { + require(block.timestamp >= 60); + balanceOf[msg.sender] -= claimAmount; + } +} \ No newline at end of file diff --git a/audit_engine/smart_contracts/integer_overflow/io59.sol b/audit_engine/smart_contracts/integer_overflow/io59.sol new file mode 100644 index 0000000..ba4c5e9 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io59.sol @@ -0,0 +1,10 @@ + +contract TokenLab { + + mapping (address => mapping (address => uint)) public tokens; + + function withdraw(uint amount) { + tokens[0][msg.sender] = tokens[0][msg.sender] - amount; + require(msg.sender.call.value(amount)()); + } +} diff --git a/audit_engine/smart_contracts/integer_overflow/io60.sol b/audit_engine/smart_contracts/integer_overflow/io60.sol new file mode 100644 index 0000000..6b81be7 --- /dev/null +++ b/audit_engine/smart_contracts/integer_overflow/io60.sol @@ -0,0 +1,15 @@ + +contract MoldCoin { + + address public founder; + uint public coinAllocation = 20 * 10**8 * 10**2; + uint public amountRaised = 0; + mapping(address => uint) balances; + + function buyRecipient(address recipient) payable { + uint tokens = msg.value * block.timestamp; + balances[recipient] = balances[recipient] + tokens; + amountRaised = amountRaised + msg.value; + if (!founder.call.value(msg.value)()) revert(); + } +}