Skip to content

Instantly share code, notes, and snippets.

@yuriy77k
Forked from danbogd/Projecton_audit_report.md
Created March 12, 2019 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuriy77k/f2ac4f8e9eb0cab6c9e67adb3746508f to your computer and use it in GitHub Desktop.
Save yuriy77k/f2ac4f8e9eb0cab6c9e67adb3746508f to your computer and use it in GitHub Desktop.

Projecton audit report.

1. Summary

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

2. In scope

Commit hash:fed7803c48d517f5aee9d787e54d3bebf3106d44

3. Findings

In total, 6 issues were reported including:

  • 3 low severity issues.
  • 3 minor observation.

3.1. Transfer ownership to zero address.

Severity: low

Description

Possibility of setting zero address as newOwner at transferOwnership function.

Recommendation

Need to check if newOwner address is not zero address.

require(newOwner != address(0));

Code snippet

https://github.com/danbogd/XN35_Standard_Tokens/blob/fed7803c48d517f5aee9d787e54d3bebf3106d44/LICENSE#L50

3.2. ERC20 Compliance.

Severity: low

Description

Accroding to ERC20 standard, when initializing a token contract if any token value is set to any given address a transfer event should be emited. An event isn't emited when assigning the initial supply to the msg.sender.

Code snippet

https://github.com/danbogd/XN35_Standard_Tokens/blob/fed7803c48d517f5aee9d787e54d3bebf3106d44/LICENSE#L71

3.3. 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.4. Constant functions have incorrect type

Severity: minor observation

Description

Constant functions have incorrect type. They should be changed to view type instead. Starting from Solidity 0.4.16, functions that do not modify the blockchain can have two modifiers: pure or view. Pure functions cannot modify or read data from blockchain. View functions have the same semantics as constant, but they can read data from blockchain.

3.5. Provide meaningful error messages for every exeption.

Severity: minor observation

Description

It is recommended to provide meaningful error messages along with each require statement. This will help the user to understand what went wrong more easily since there are many validations happening for each buy.

3.6. Consider using latest version of solidity.

Severity: minor observation

Description

The contracts use solidity version 0.4.25. It is suggested to use the latest version and fix all compiler warnings that arise. Compiler version should be fixed to avoid any potential discrepancies in smart contract behavior caused by different versions of compiler.

4. Conclusion

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

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