Bills of exchange factory smart contract security audit report performed by Callisto Security Audit Department
'Bills Of Exchange Factory' is a smart contracts based service that allows user to draw electronic bills or exchange.
https://cryptonomica.net/bills-of-exchange/
In total, 9 issues were reported including:
-
1 medium severity issues.
-
3 low severity issues.
-
1 notes.
-
4 owner privileges (the ability of an owner to manipulate contract, may be risky for investors).
No critical security issues were found.
While the specification defined the number of token decimals to be 18, no decimals were found to be used. This can cause problems when interacting with other smart contracts as tokens with 0 decimals can cause rounding errors. For example, many exchanges charge a small fee based on the tokens exchanged. As such, using no decimals will either make it impossible to list the token on these exchanges or it will result in having expensive fees compared to other tokens.
Line 153.
The reviewed token contract is not ERC223 fully compliant.
-
The function transfer(address _to, uint _value, bytes _data) call tokenFallback external function on the receiver contract without adding the value to balances[_to]. The original implementation adds the token value to the balance before making the external call here
-
ERC223 does not implement an approve/transferFrom mechanism.
-
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) );
In this functions there are no checking for zero address.
initToken
at line 187,changeCryptonomicaVerificationContractAddress
at line 430,signDisputeResolutionAgreementFor
at line 737,initBillsOfExchange
at line 786,setLegal
at line 851,createBillsOfExchange
at line 981.
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.
Line 200.
Contract owner allow himself to:
-
Owner can upgrade contract and 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. (line 430)
-
fix or not fix withdraw address depends from owner.(line 541)
-
change price (line 614)
-
Any admin can remove the contract creator from admin list. (line 487) Together with the ability to change the withdrawal address by admin, this can be quite dangerous.
The audited smart contract must not be deployed. Reported issues must be fixed prior to the usage of this contract.
https://gist.github.com/yuriy77k/26e2ee2e96ecb93091c5efbc2bddc7a4
https://gist.github.com/yuriy77k/adbf6e55c290b1382bf9c9dfea2c9ad2
https://gist.github.com/yuriy77k/135a6003cd890ee02a3edd90e566388a
https://gist.github.com/yuriy77k/fa0bcf86093ada4e7ba06e9bedb1bd81