Skip to content

Instantly share code, notes, and snippets.

@RideSolo
Created December 31, 2019 15:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RideSolo/29b0bc7bdf12f9512c314d7ca320daa8 to your computer and use it in GitHub Desktop.
Save RideSolo/29b0bc7bdf12f9512c314d7ca320daa8 to your computer and use it in GitHub Desktop.

Jointer Token Audit Report.

1. Summary

This document is a security audit report performed by RideSolo, where Jointer Token has been reviewed.

2. In scope

  • ERC20.sol github commit hash f86d15275b7a902c839a8ae45d959549dda09df1.
  • MultiOwnable.sol github commit hash f86d15275b7a902c839a8ae45d959549dda09df1.
  • Ownable.sol github commit hash f86d15275b7a902c839a8ae45d959549dda09df1.
  • SafeMath.sol github commit hash f86d15275b7a902c839a8ae45d959549dda09df1.
  • StandardToken.sol github commit hash 35c2f9ba264ac722e8c57966ca820e8dc6b93fb0.
  • Token.sol github commit hash 35c2f9ba264ac722e8c57966ca820e8dc6b93fb0.
  • TokenUtil.sol github commit hash f86d15275b7a902c839a8ae45d959549dda09df1.
  • WhiteList.sol github commit hash 095929d0b080ec9541f7847487e8363fb251446b.
  • github commit hash .

3. Findings

11 issues were reported including:

  • 2 high severity issues.
  • 1 medium severity issues.
  • 2 low severity issues.
  • 4 Owner privileges.
  • 2 notes.

3.1 Wallet White Listing

severity: High

Description

Following the document provided, as example "If Investors purchase through third party exchanges like, national stock exchanges, tZero, and other exchanges should be able to check and update the whitelist through a secure API"; however, any address added to the whitlist will be able to add other addresses following the logic implemented in addMoreWallets

    function addMoreWallets(address _which) public returns (bool){
        require(address_belongs[_which] == address(0));
        address sender = msg.sender;
        address primaryAddress = address_belongs[sender];
        require(is_whiteListed[primaryAddress]);
        address_belongs[_which] = primaryAddress;
        emit WalletAdded(primaryAddress,_which);
        return true;
    }

address_belongs[_which] is always set to primaryAddress, meaning that the require(is_whiteListed[primaryAddress]) will never throw, since address_belongs[_which] is always set to the first address that was whitlisted by the owner using addNewWallet. The result of such implementation is that any address will be able to whitlist other addresses recursively.

The contract function description state that "once user whiltelisted it can add more address itself", but even addresses not listed in is_whiteListed mapping will be able to add other addresses, since whitelisting allow to manage KYC user onchain, this issue can have a bad legal impact on the project.

Developers should re-think the function logic.

3.2 Force Swap

severity: High

Description

When owners enforce user token swap using forceSwapWallet, token.swapForToken is called using balances[_address] parameter but user balance was previously burned through and set to zero _burn(_address,balances[_address]) meaning that his balance is equal to zero, the swap will occure with zero value, user balance should be saved first in a memory variable then burned and the the newly created variable assigned for swap.

3.3 Send Restriction

severity: medium

Description

setCansent function member of WhiteList is setting recive_block instead of sent_block, where canSentToken is checking sent_block.

3.4 Zero Address Verification

severity: low

Description

  • systemAddress is set inside the constructor, but the input variable is not checked.

3.5 Readability

severity: note

Description

In [acceptSystemAddressOwnership][https://github.com/ridesoloAudit/JntrToken/blob/35c2f9ba264ac722e8c57966ca820e8dc6b93fb0/MultiOwnable.sol#L89), systemAddress is set to msg.sender. Even if msg.sender is equal to systemAddressAllowed, msg.sender should be replaced by systemAddressAllowed for better logic understanding.

3.6 Doc Parsing

severity: note

Description

Doc parsing errors are raised for addMoreWallets and setCansent since the documention to be generated contains invalid parameters name _address and _recive that should be replaced with _which and sent.

3.7 Owner Privileges

severity: High

Description

  • Owner can block a use from receiving tokens using setCanRecive.
  • If issue Send Restriction is solved, the owner will be able to block a use from sending tokens using setCanRecive.
  • forceSwapWallet allow the owner to force user address balance swap.
  • Owner can change whitlist address and util address.

3.8. 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

4. Conclusion

The audited contracts aren't safe for deployement.

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