Skip to content

Instantly share code, notes, and snippets.

@danbogd
Created July 1, 2019 08:57
Show Gist options
  • Save danbogd/0ea275b159821b443b9817df67fcdde3 to your computer and use it in GitHub Desktop.
Save danbogd/0ea275b159821b443b9817df67fcdde3 to your computer and use it in GitHub Desktop.

Burn token audit report.

1. Summary

This document is a security audit report performed by danbogd, where Burn token has been reviewed.

2. In scope

Сommit hash .

3. Findings

In total, 4 issues were reported including:

  • 1 medium severity issues
  • 3 low severity issues
  • 0 owner privileges (ability of owner to manipulate contract, may be risky for investors)..
  • 0 notes.

No critical security issues were found.

3.1. Out of gas.

Severity: medium

Description

There is no upper limit on receivers.length. Eventually, as the length of arrays increases, gas cost of smart contract calls will raise. This can lead to "Out of Gas" error or to "Block Gas Limit".

Code snippet

Line 128

    function multiTransfer(address[] memory receivers, uint256[] memory amounts) public {
    for (uint256 i = 0; i < receivers.length; i++) {
    transfer(receivers[i], amounts[i]);
    }
    }

3.2. Known vulnerabilities of ERC-20 token

Severity: low

Description

  1. It is possible to double withdrawal attack. More details here.

  2. Lack of transaction handling mechanism issue. WARNING! This is a very common issue and it already caused millions of dollars losses for lots of token users! More details here.

Recommendation

Add into a function transfer(address _to, ... ) following code:

require( _to != address(this) );

3.3. Multi Transfer arrays length check.

Severity: low

Description

There are two input arrays, but no check for the same length. In this case it is possible to skip some recipient or token amount and to transfer wrong amount to wrong recipient.

Code snippet

Line 128

    function multiTransfer(address[] memory receivers, uint256[] memory amounts) public {
    for (uint256 i = 0; i < receivers.length; i++) {
    transfer(receivers[i], amounts[i]);
    }
    }

3.4. Decrease Allowance

Severity: low

Description

decreaseAllowance throw in case if the value to be subtracted is higher than the amount that is allowed, if the address owner wants to change the value allowed by reducing it and the spender withdraw a part of it before, the function might throw and give more chances for the spender to take the rest of the allowed value.

The value should be set to zero if the value to be subtracted is higher than the allowance.

Code snippet

Line 169.

    function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
    require(spender != address(0));
    _allowed[msg.sender][spender] = (_allowed[msg.sender][spender].sub(subtractedValue));
    emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
    return true;
    }

4. Conclusion

The review did not show any critical issues, some of medium and low severity issues were found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment