iosiro
blockchain security

WIN Token Smart Contract

Audit Results

wawllet-logo-black.png
 
 

Disclaimer

This is a limited report on our findings based on our analysis, in accordance with good industry practice as at the date of this report, in relation to: (i) cybersecurity vulnerabilities and issues in the smart contract source code analysed, the details of which are set out in this report, (Source Code); and (ii) the Source Code compiling, deploying and performing the intended functions. In order to get a full view of our findings and the scope of our analysis, it is crucial for you to read the full report. While we have done our best in conducting our analysis and producing this report, it is important to note that you should not rely on this report and cannot claim against us on the basis of what it says or doesn’t say, or how we produced it, and it is important for you to conduct your own independent investigations before making any decisions. We go into more detail on this in the below disclaimer below – please make sure to read it in full.

DISCLAIMER: By reading this report or any part of it, you agree to the terms of this disclaimer. If you do not agree to the terms, then please immediately cease reading this report, and delete and destroy any and all copies of this report downloaded and/or printed by you. This report is provided for information purposes only and on a non-reliance basis, and does not constitute investment advice. No one shall have any right to rely on the report or its contents, and Zenoic Proprietary Limited trading as “Iosiro” and its affiliates (including holding companies, shareholders, subsidiaries, employees, directors, officers and other representatives) (Iosiro) owe no duty of care towards you or any other person, nor does Iosiro make any warranty or representation to any person on the accuracy or completeness of the report. The report is provided "as is", without any conditions, warranties or other terms of any kind except as set out in this disclaimer, and Iosiro hereby excludes all representations, warranties, conditions and other terms (including, without limitation, the warranties implied by law of satisfactory quality, fitness for purpose and the use of reasonable care and skill) which, but for this clause, might have effect in relation to the report. Except and only to the extent that it is prohibited by law, Iosiro hereby excludes all liability and responsibility, and neither you nor any other person shall have any claim against Iosiro, for any amount or kind of loss or damage that may result to you or any other person (including without limitation, any direct, indirect, special, punitive, consequential or pure economic loss or damages, or any loss of income, profits, goodwill, data, contracts, use of money, or business interruption, and whether in delict, tort (including without limitation negligence), contract, breach of statutory duty, misrepresentation (whether innocent or negligent) or otherwise under any claim of any nature whatsoever in any jurisdiction) in any way arising from or connected with this report and the use, inability to use or the results of use of this report, and any reliance on this report.

Table of Contents

1. Introduction
2. Executive Summary
3. Audit Details
    3.1 Scope
        3.1.1 WIN Token
    3.2 Methodology
        3.2.1 Dynamic Analysis
        3.2.2 Automated Analysis
        3.2.3 Code Review
    3.3 Risk Ratings
4. Smart Contract Descriptions
    4.1 WINCrowdSaleToken.sol
5. Detailed Findings
    5.1 High Risk
    5.2 Medium Risk
    5.3 Low Risk
    5.4 Informational Risk
    5.5 Closed
        5.5.1 No Ability to Control Minting Process (High) [Closed as of 04 April 2018]
        5.5.2 Tokens Immediately Transferable (Medium) [Fixed as of 04 April 2018]

1. Introduction

iosiro was commissioned by WAWLLET Enterprises Limited to conduct an audit on the WIN token smart contracts. The audit was performed between 13 March 2018 and 16 March 2018. On 4 April 2018 issues in this report were addressed and documented herein.

The report is organized into the following sections.

Section 2 - Executive Summary: A high-level description of the findings of the audit.
Section 3 - Audit Details: A description of the scope and methodology of the audit. 
Section 4 - Smart Contract Descriptions: Descriptions of the intended functionality of the smart contracts.
Section 5 - Detailed Findings:  Detailed descriptions of the findings of the audit.

The information in this report should be used to understand the risk exposure of the smart contracts, and as a guide to improve the security posture of the smart contracts by remediating the issues that were identified. The results of this audit are only a reflection of the source code reviewed at the time of the audit and of the source code that was determined to be in-scope. 
 

2. Executive Summary

This report presents the findings of an audit performed by iosiro on the WIN token smart contracts. The purpose of the audit was to achieve the following.

  • Ensure that the smart contracts function as intended.  
  • Identify potential security issues with the smart contracts. 

Due to the unregulated nature and ease of transfer of cryptocurrencies, operations that store or interact with these assets are considered very high risk with regards to cyber attacks. As such, the highest level of security should be observed when interacting with these assets. This requires a forward-thinking approach, which takes into account the new and experimental nature of blockchain technologies. There are a number of techniques that can help to achieve this, some of which are described below. 

  • Security should be integrated into the development lifecycle. 
  • Defensive programming should be employed to account for unforeseen circumstances. 
  • Current best practices should be followed wherever possible.  

The following table outlines the findings of the audit.

Issue Risk Status
No Ability to Control Minting Process High Closed
Tokens Immediately Transferable Medium Closed

The smart contracts were found to use standard libraries, such as OpenZeppelin and TokenMarket, with slight modifications for custom functionality. The use of these libraries led to good design patterns, including highly modularized code that prioritized readability. 

The risk posed by the smart contracts can be further mitigated by using the following controls prior to releasing the contracts to a production environment. 

  • Develop a test suite with close to complete test coverage.
  • Perform multiple audits using different teams.
  • Use a bug bounty program to identify security vulnerabilities.
     

3. Audit Details

3.1 Scope

The source code considered in-scope for the assessment is described below. Code from any other files are considered to be out-of-scope.

3.1.1 WIN Token

Address: 0x899338b84d25ac505a332adce7402d697d947494
Files: WINCrowdSaleToken.sol

3.2  Methodology

A variety of techniques were used to perform the audit, these are outlined below. 

3.2.1 Dynamic Analysis

The contracts were compiled, deployed, and tested using both Truffle tests and manually on a local test network. A test suite was developed by the review team during the audit to test various attack paths. 

3.2.2 Automated Analysis

Tools were used to automatically detect the presence of potential vulnerabilities, such as reentrancy, timestamp dependency bugs, transaction-ordering dependency bugs, and so on. Static analysis was conducted using Oyente. Additional tools, such as the Remix IDE, compilation output and linters were used to identify potential security flaws.

3.2.3 Code Review

Source code was manually reviewed to identify potential security flaws. This type of analysis is useful for detecting business logic flaws and edge-cases that may not be detected through dynamic or static analysis. 

3.3  Risk Ratings

Each Issue identified during the audit is assigned a risk rating. The rating is dependent on the criteria outlined below..

  • High Risk - The issue could result in a loss of funds for the contract owner or users.
  • Medium Risk - The issue results in the code specification operating incorrectly. 
  • Low Risk - A best practice or design issue that could affect the security standard of the contract.
  • Informational - The issue was a lapse in best practice or a suboptimal design pattern that has a minimal risk of affecting the security of the contract.
  • Closed - A previously identified issue was addressed, removing the potential risk that it posed.

4. Smart Contract Descriptions

The following section outlines the functionality available in the smart contracts. A description of how the token was intended to function is available in the white paper

4.1 WINCrowdSaleToken.sol

The token was implemented in WINCrowdSaleToken.sol. The token code was largely based on the popular OpenZeppelin and TokenMarket libraries, however, some custom functionality was also included. 

Notable design decisions of the smart contracts are outlined below.  

Name: WCOIN
Symbol: WIN
Decimals: 8

ERC20 Token
The token was designed to follow the ERC20 specification.

Mintable
Tokens were mintable, meaning that tokens were created when required, rather than creating a lump sum of initial tokens that were then distributed.

Burnable
Tokens were burnable, meaning that the tokens could be destroyed and removed from the total supply.
 

5. Detailed Findings

The following section outlines the findings of the audit.

5.1 High Risk

No high risk issues were present at the conclusion of the audit.

5.3 Medium Risk

No medium risk issues were present at the conclusion of the audit.

5.3 Low Risk 

No low risk issues were present at the conclusion of the audit.

5.4 Informational

No informational risk issues were present at the conclusion of the audit.

5.5 Closed

5.5.1 No Ability to Control Minting Process [Fixed as of 04 April 2018]

WINCrowdSaleToken.sol

Description
It was found during the audit that no functionality was included in the smart contract to control the token minting process. As a result, any amount of new tokens could be created at any time, including after the crowdsale had ended. If this were to be exploited, WIN token holders could see their stake in the token diluted by newly created tokens. Additionally, the original token allocations described in the white paper could be bypassed, as entities could be assigned additional tokens at a later stage.

The variable mintingFinished, which was used in the modifier canMint to determine whether new tokens could be minted, was found to have no method of being changed in code. As a result, mintingFinished was always set to false and canMint always returned true.

In the original TokenMarket implementation of CrowdsaleToken.sol, a function titled releaseTokenTransfer was used to both release the token and prevent any new tokens from being minted once the crowdsale had finished. This function is given below.

  function releaseTokenTransfer() public onlyReleaseAgent {
    mintingFinished = true;
    super.releaseTokenTransfer();
  }

This would stop the minting process once the token had been released at the end of a crowdsale. In the WIN token, no such functionality was present.

An example of how one may exploit this vulnerability is outlined below.

  1. Owner of the token calls setMintAgent(attackerAddress, true) with a new address attackerAddress. 
  2. attackerAddress can then call mint(attackerAddress, numTokens) to send themselves numTokens  number of tokens, as both onlyMintAgent and canMint will return true.

Remedial Action
As the token had already been deployed at the time of testing and there being no ability to upgrade the token, there are limited options to address this issue. One approach would be to ensure that all addresses are set to not be minting agents at the end of the crowdsale, and then transfer ownership of the token to 0x0 or another address that is known to not be controlled by the company - preventing any new minting agents from being set. The risk with this approach is that there is a large assumption that no one will ever be able to control that address. Additionally, once ownership is transferred, it won’t be possible to transfer ownership back, losing the ability to perform operations such as updating the token name and symbol.

Any minting of new tokens will be publicly seen on the blockchain through the transfer event with a from address of 0x0. Using this information token holders would be able to see whether this has been exploited after the crowdsale has ended.

Implemented Action
All of the minting agents were disabled and ownership of the token contract was transferred to the contract itself, resulting in the inability to mint new tokens.
 

5.5.2 Tokens Immediately Transferable [Closed as of 04 April 2018]

WINCrowdSaleToken.sol

Description
The white paper stated in Section 9.3 that “no Tokens may be transferred or traded until completion of the Token Sale Session”, however, no functionality was available in the token smart contract to enforce this behaviour. As such, holders of WIN tokens could immediately transfer tokens.  

Remedial Action
As the token had already been deployed at the time of testing and there being no ability to upgrade the token, there are limited options to address this issue. However, the impact of this issue is relatively low and marked as medium risk as it contradicts the information provided in the white paper. 

If the token had not yet been deployed to a live environment, it would be possible to use the OpenZeppelin releasable mixin to prevent holders from transferring tokens until the crowdsale had ended, unless they were explicitly whitelisted to do so. A snippet of how this would be used in practice is given in Section 5.1.1.

Implemented Action
No action was required.