tomation methods are proposed. Oyente (Luu et al.,
2016), the first tool in detecting vulnerabilities in
Solidity, uses symbolic execution to test for vulnera-
bilities. SmartCheck (Tikhomirov et al., 2018) uses
static analysis, which parses the source code of the
smart contract to find out whether the code contains
common vulnerability patterns.
Although many works are invented to detect
vulnerabilities of smart contracts, there is still no re-
search in investigating the current state of vulnera-
ble smart contracts. Our research aims to discover
common occurrences and trends of vulnerabilities in
smart contracts as well as identify common charac-
teristics of vulnerable smart contracts. We have col-
lected the source code of 38,982 smart contracts from
Etherscan.com. We analyze smart contracts written
in Solidity in the Ethereum blockchain as it is widely
well-adopted. From those smart contracts, we have
found common occurrences and trends of vulnera-
bilities in already deployed smart contracts. In ad-
dition, we have suggestions for developers when de-
veloping a smart contract.
The remainder of this paper is organized as fol-
lows. Section 2 gives the background of smart
contract vulnerabilities. Section 3 explains the pro-
posed work of this research. Section 4 shows the re-
sults and discussions. Finally, we conclude our work
in Section 5.
2 LITERATURE REVIEW
2.1 Ethereum Smart Contract
Unlike Bitcoin, the most successful implementation
of a blockchain system, that only uses the blockchain
to store currency-transferring transactions, and the ac-
cumulation of those transactions becomes a ledger
where the balance of every account on the system
is kept. The goal of Ethereum(Wood, 2014) is to
use a blockchain to implement distributed applica-
tions. In Ethereum, an account’s balance is a state
that changes values by transactions. In other words,
a transaction is a state transition operator. The global
state is where Ethereum uses to store its own currency,
Ether, on each account. Moreover, Ethereum allows
each account to store code and has inner state vari-
ables, and that becomes a smart contract. The inner
state variables are changed by processing a transac-
tion that contains a function call, probably with ar-
guments, against the account’s code as shown in Fig-
ure 1. All Ethereum’s transactions, including smart
contracts, are operated by Ethereum virtual machine
(EVM).
Figure 1: Ethereum State Transition.
EVM operates on the machine-level code, called byte-
code, which is difficult for a human to write. There-
fore, Ethereum invented several new programming
languages for developers to use and later compiled
to bytecode for deployment. These languages are
LLL, Serpent, Tiger, Solidity and Vyper, and Solidity
which is currently the most popular language.
Calling to a function in a smart contract is a form
of a transaction. The caller can create a transaction
with data part containing function signature and ar-
guments. The caller can choose to send some Ether
along with the transaction. When a transaction is
committed to a block and distributed to nodes in the
network, each EVM will extract calling function and
arguments, and then execute the callee function with
the extracted information. The Ether sent along with
the transaction will be added to the smart contract’s
account balance.
2.2 Smart Contract’s Vulnerabilities
Analysis
Information on vulnerabilities of Solidity Smart
Contracts has been collected ( (Ethereum, 2019),
(Consensys, 2019), (Atzei et al., 2017), (Luu et al.,
2016), (Tikhomirov et al., 2018)). Most studies focus
on the analysis of previous weaknesses found in var-
ious incidents such as the DAO case (Siegel, 2016),
King of Ether case (King of Ether Throne, 2016), and
Parity case (Parity Technologies, 2017). The follow-
ings explain the most important vulnerabilities.
2.2.1 Re-entrancy
In Solidity, there are three functions used to transfer
some currency to an external address; they are send,
transfer, and call. However, in a case that the
destination address is a smart contract, these func-
tions also act as a function call to “fallback func-
tion” in the destination smart contract. A malicious
contract might use this fact to create a “crafted fall-
back function” to execute something back in the orig-
inal contract.
Figure 2 shows an example of the re-entrancy
attack on a withdrawing function, and it is similar
to the cause of the incident happened in the DAO
case (Siegel, 2016). The attacker starts by creat-
ICISSP 2020 - 6th International Conference on Information Systems Security and Privacy
318