Consensys / mythril

Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Rootstock, Tron and other EVM-compatible blockchains.
https://mythx.io/
MIT License
3.84k stars 736 forks source link

False positive: "Integer overflow" issue in ERC20 contract function #947

Closed aarthiKannanEY closed 5 years ago

aarthiKannanEY commented 5 years ago

Description

Mythril reports Integer overflow issue with the ERC20 "increaseAllowance" function as shown in the audit result below.

How to Reproduce

Used Mythril with Truffle


$ myth --truffle
==== Exception state ====
# Analysis result for ERC20:

==== Integer Overflow ====
SWC ID: 101
Severity: High
Contract: ERC20
Function name: increaseAllowance(address,uint256)
PC address: 3645
Estimated Gas Usage: 1025 - 1500
The binary addition can overflow.
The operands of the addition operation are not sufficiently constrained. The addition could therefore result in an integer overflow. Prevent the overflow by checking inputs or ensure sure that the overflow is caught by an assertion.
--------------------
In file: ERC20.sol:46

ddres

Solidity Source: "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"

## Expected behavior

No issues found.

## Environment

- Mythril version: v0.20.0
- Solidity compiler and version: 0.5.4+commit.9549d8ff.Darwin.appleclang
- Python version: 2.7.10
- OS and Version: Mac OS Mojave
norhh commented 5 years ago

hi @aarthiKannanEY , unfortunately I couldn't generate the same issue, this PR #949 might fix it, can you check it. Currently mythril-cli doesn't go well with truffle and we are planning to remove it in the near future, you can try out truffle-security tool, it runs mythril+various other tools(uses mythx api) in the backend and is pretty cool, It can find different types of issues which mythril can't find.

JoranHonig commented 5 years ago

@norhh & @aarthiKannanEY This seems to be a problem in the mapping logic in our truffle specific code, as @norhh mentioned this functionality is being depricated, so I'm closing this issue.

If you still have this issue using truffle-security then we'd love to hear your feedback!