This document is a security audit report performed by danbogd, where Adchain has been reviewed.
Сommit hash 5930cede2d533c8ee92001fd0be8eada2f2bc614.
- Disbursement.sol.
- Filter.sol.
- HumanStandardToken.sol.
- Migrations.sol.
- Sale.sol.
- StandardToken.sol.
- Token.sol.
- AttributeStore.sol.
- Challenge.sol.
- DLL.sol.
- Migrations.sol.
- PLCRVoting.sol.
- Parameterizer.sol.
- Registry.sol.
In total, 11 issues were reported including:
- 1 medium severity issues
- 3 low severity issues
- 5 owner privileges (ability of owner to manipulate contract, may be risky for investors)..
- 2 notes.
No critical security issues were found.
ERC-20 Token Standard specifies for functions transfer and transferFrom:
The function SHOULD throw if the _from account balance does not have enough tokens to spend. But in this implementation it just returns false. This can lead to serious consequences. Because checking the return value of this function is rare.
https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/StandardToken.sol#L15 https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/StandardToken.sol#L28
-
It is possible to double withdrawal attack. More details here.
-
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.
Add into a function transfer(address _to, ... )
following code:
require( _to != address(this) );
The owners can implement any logic in the new contract. And even if the new contract will be audited, at any time possible to change the address of the new contract again to not audited and insecure.
https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/Disbursement.sol#L67 https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/Filter.sol#L37
There are two/three input arrays, but no check for the same length. In this case it is possible to skip some parameters.
https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/Filter.sol#L22-L35 https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/Sale.sol#L120 https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/Sale.sol#L99
The contract owner allow himself to:
- changeOwner;
- changePrice;
- changeWallet;
- changeStartBlock at which contract will begin selling;
- emergency stop sales.
According to ERC20 standard, when initializing a token contract if any token value is set to any given address a transfer event should be emitted. An event isn't emitted when assigning the initial supply to the msg.sender.
###Code snippet
https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/HumanStandardToken.sol#L44 https://github.com/AdChain/AdChainRegistry/blob/5930cede2d533c8ee92001fd0be8eada2f2bc614/contracts/historical/Sale.sol#L92
Implementation of fallback function is redundant, because when funds are transferred to the contract without this function, exception will also be thrown.
The review did not show any critical issues, some of medium and low severity issues were found.