Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BNB Token #177

Closed
yuriy77k opened this issue Mar 15, 2019 · 8 comments
Closed

BNB Token #177

yuriy77k opened this issue Mar 15, 2019 · 8 comments
Labels
approved Auditors can begin to audit this smart contract. solidity Smart-contract is written in solidity (Ethereum) language.

Comments

@yuriy77k
Copy link
Contributor

yuriy77k commented Mar 15, 2019

Audit request

Audit Top 200 CoinMarketCap tokens.

BNB Token BNB
Circulating Supply 141 175 490 BNB
Total Supply 189 175 490 BNB
Max Supply No Data

Deployed at https://etherscan.io/address/0xB8c77482e45F1F44dE1745F52C74426C631bDD52#code

Source code

https://gist.github.com/yuriy77k/7612e9b1f915f169542e711dd6a29166

Disclosure policy

public

Platform

ETH

Number of lines

119

@yuriy77k yuriy77k added solidity Smart-contract is written in solidity (Ethereum) language. approved Auditors can begin to audit this smart contract. labels Mar 15, 2019
@gorbunovperm
Copy link

Estimated auditing time is 2 days.

@danbogd
Copy link

danbogd commented Mar 16, 2019

Estimated auditing time is 3 days.

@yuriy77k
Copy link
Contributor Author

@gorbunovperm @danbogd assigned

@MrCrambo
Copy link

Auditing time 2 days

@yuriy77k
Copy link
Contributor Author

@MrCrambo assigned

@gorbunovperm
Copy link

My report is finished.

1 similar comment
@danbogd
Copy link

danbogd commented Mar 19, 2019

My report is finished.

@yuriy77k
Copy link
Contributor Author

Security Audit Report

1. Summary

Binance token (BNB) smart contract security audit report performed by Callisto Security Audit Department

2. In scope

bnb.sol

3. Findings

In total, 5 issues were reported including:

  • 5 low severity issues.

No critical security issues were found.

3.1. 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 the following code to the transfer(_to address, ...) function:

require( _to != address(this) );

3.2. ERC20 Compliance — event missing

Severity: low

Description

  1. According to ERC20 standard when coins are minted a Transfer event should be emitted.

  2. There is no Approval event call at approve function. And EIP20 says:

MUST trigger on any successful call to approve(address _spender, uint256 _value).

  1. The burn function also should emit the Transfer event.

Code snippet

  1. initial supply
  2. Approval event
  3. burn function and Transfer event

3.3. ERC20 Compliance — zero-value transfers rejecting

Severity: low

Description

EIP20 says that:

Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.
But in this contract, function transfer has a condition:

if (_value <= 0) throw;

Code snippet

3.4. ERC20 Compliance — approve issues

Severity: low

Code snippet

Description

  1. There is no way to reset approved value to 0, because approve function contains:
if (_value <= 0) throw; 
  1. Also it breaks the EIP20 security recommendation:

To prevent attack vectors like the one described here and discussed here, clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to 0 before setting it to another value for the same spender. THOUGH The contract itself shouldn't enforce it, to allow backwards compatibility with contracts deployed before

3.5. Fallback Function

Severity: low

Description

Any ether sent directly to the contract through the fallback function will not result in an automatic buy of tokens but instead is directly sent to the contract balance.

Code snippet

https://gist.github.com/yuriy77k/7612e9b1f915f169542e711dd6a29166#file-bnb-sol-L144

4. Conclusion

The audited smart contract can be deployed. Only low severity issues were found during the audit.

5. Revealing audit reports

https://gist.github.com/yuriy77k/b228e8df2aa47aef84e91423dd340894

https://gist.github.com/yuriy77k/ee463004023c4caee3b36bea30deb32f

https://gist.github.com/yuriy77k/b15d652f64211b51711f0648cdab6000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Auditors can begin to audit this smart contract. solidity Smart-contract is written in solidity (Ethereum) language.
Projects
None yet
Development

No branches or pull requests

4 participants