Blockchain for IoT Access Control
Blockchain for IoT Access Control
1 Introduction
Internet-Of-Things concept can be defined as a system of connected comput-
ing devices in various fields and forms that can be deployed everywhere. These
devices can communicate with other devices, gather, share, and process informa-
tion to deliver a certain service [12]. According to experts from CISCO, Ericsson
and other companies, by the year 2020, we will have over 50 billion devices
connected to the INTERNET [3,18]. IOT devices are functioning in all fields
nowadays: house appliances, medical area, personal accessories, etc. To allow
such functionality, these devices must have certain characteristics. They should
posses the abilities of operating using low energy and communicating with other
heterogeneous devices. Also, They should maintain stable connection with the
back-end if existed and be able to receive patches when necessary.
Authentication and access control are key concepts to securely manage com-
puter resources and networks. Based on the previously mentioned characteris-
tics, these concepts should be redefined in the context of IOT. Authentication
c Springer International Publishing AG, part of Springer Nature 2018
D. Georgakopoulos and L.-J. Zhang (Eds.): ICIOT 2018, LNCS 10972, pp. 150–164, 2018.
[Link]
Using Blockchain for IOT Access Control and Authentication Management 151
techniques and access control policies need to take the limited resources draw-
back into consideration. Likewise, when it comes to IOT conditions, classical
approaches for access control like ABAC (Attribute-based access control) and
RBAC (Role-based access control) are proven to be inflexible, unscalable and
difficult to upgrade [6,13].
In addition, the centralized perception of authentication where all devices
have to contact a certain entity creates a major drawback. Building a sys-
tem that depends on a trusted third party implies the assumption of a TTP
that is always available and authentic. This creates a bottleneck around the
trusted party which affects availability. Also, the model fails when the central-
ized entity is compromised. Additionally, the TTP can tamper records without
accountability. Such disadvantages in the IOT design can be overcome using the
blockchain technology.
Blockchain is known as the underlying technology for Bitcoin [9]. It can be
defined as a growing chain of records. By design, the blockchain inherits effective
characteristics in which the blocks of records are decentralized, tamper-proof and
can be accessed by all nodes equally. This concept can be extended to all types of
applications that require a trusted third party to validate records or transactions.
Blockchain made it possible to replace the trusted third party with a transparent
untampered block of records that is available via a distributed form, hence, the
trust is moved from a single entity to a decentralized community of blockchain
nodes.
An effective method that utilizes blockchain concept is the smart-contract.
Smart-Contract was first defined in 1996 as a self-operating or self-executing
program [16]. This method was reintroduced in Ethereum blockchain to facilitate
the development of blockchain automated applications.
Events and logs are Ethereum blockchain features. An event is a reply
(returned value) from the smart contract to the user interface interacting with
it. The main goal of using events and logs is to ease the communication between
smart contracts and programs communicating with them.
Figure 1 demonstrates a sample scenario for an Ethereum Smart Contract
Application. First, the client requests access for a certain resource/asset from
the smart contract. Second, the smart contract checks if the asset is free then
books the fee from the client. For this example, the client is paying via Ethereum
crypto-currency. Third, the smart contract reserves the resource for the current
client. Fourth, The client uses the resource as approved. Finally, if everything
went according to the contract rules, the smart contract charges the client as
agreed. It is important to note that the smart contract acts fully autonomously
and the owner is not involved in any steps.
The rest of the paper is organized as follows. Section 2 will review various
implementations of IOT authentication solutions. Then, Sect. 3 will explain the
detailed design of the proposed solution. Section 4 will clarify the implementa-
tion phases, elements, technologies and techniques. After that, Sect. 5 will illus-
trate the tests performed on this paper’s approach, and the outcome results and
152 A. Z. Ourad et al.
evaluation. Finally, the paper is concluded with the lessons learned and future
plans that will help improving this solution in Sect. 6.
2 Related Work
Using such approach saves time and effort since the user accesses multiple
entities by authenticating to a single entity. Also, the oauth2 provider is usually
a trusted third party with a high reputation which eases the integration of such
solution [14].
On the other hand, trusting a centralized entity increases the threat of hav-
ing a single point of failure which threatens the availability of the presented
approach. Moreover, if the user’s account or the centralized entity were compro-
mised, the whole system is affected. An essential attack vector that may lead
to this model’s failure is phishing which has a high successful rate. In addition,
spear phishing campaigns are getting more intensive, precise and sophisticated
nowadays which may even trick the educated users [2]. According to Symantec
Latest Intelligence Report for June 2017, 76% of organizations came forward of
being phishing victims in 2016 [11].
The approaches discussed so far present a valid implementation for IOT
authentication. However, they suffer from some drawbacks that may affect scala-
bility, performance and availability. The following approaches have the potential
for an IOT authentication management and access control solution that uses
blockchain technology.
154 A. Z. Ourad et al.
The paper offers a blockchain based solution with distinct system architecture. It
addresses the drawbacks of current solutions. Also, it should be portable and run
on any network with minimum dependencies unlike blockstack. It is targeting
IOT devices that lack strong processing power. It is also presenting the idea
of Oauth implementation via smart contract to login once and control all the
authorized devices without the need to login separately for each IOT device.
In addition, the IOT devices can run smart contracts to become self profiting
devices.
Section 5.1 will discuss the costs of this solution. Section 5.2 will go over the
tests operated on a running prototype in addition to the test outcome. Tests
will include performance experiments and crafted attacks against them. Then,
Sect. 5.3 will evaluate in terms of availability, scalability, decentralization, tamper
proof and performance advantages and drawback.
There are many advantages for using Ethereum blockchain as a platform
for this solution. Ethereum has a stable development framework with existing
Using Blockchain for IOT Access Control and Authentication Management 155
incentive for miners to solve challenge hashes. Also, Ethereum light client pro-
tocol can run on IOT devices with low processing power and memory which is
essential for the proposed solution [8].
3.1 Assumptions
To implement such solution, the following assumptions must be taken into con-
sideration:
– The user owns one or more IOT devices.
– The user’s Ethereum keystore is not compromised i.e. the private key is pro-
tected.
– The user has an Ethereum account.
– The user and the IOT device are connected to the Ethereum blockchain
– The user will deploy his smart contract.
The system can budge the last assumption with full functionality. A central-
ized smart contract that authenticate users to their respective IOT devices can
be created. However, since one of the goals of this paper is to avoid depending
on a central entity. It is more suitable to ask users to deploy their own smart
contracts so they can achieve full control of their own systems. This will shape
a system of decentralized smart contracts running on a decentralized blockchain
where each user owns his/her smart contract.
4. When the IOT device receives the package, it verifies its content. If succeeded,
the device grants access to the user from the sender’s IP for the duration
specified. Otherwise, if any of those checks fails, the request is dropped. The
verification phase is described in Sect. 4.2.
The smart contract completes its authentication task in the first step. It is
noted that the IOT device needs to perform many verification steps. However,
as discussed in Sect. 5, this solution runs successfully on a standard raspberry
Pie 3 Model B. More details on the technical specifications of the smart contract
and the IOT server are explained in Sect. 4.
the source code of the smart contract. This version of the smart contract only
considers the admin user as a legitimate user. In other words, the user who
deployed this smart contract on the blockchain is the admin user. Adding more
users can be achieved by adding an addUser() method to the smart contract.
The Smart Contract of the Proposed Solution:
contract Login2
Declare Private owner, hash, token_raw, random_number
//begin constructor:
owner = [Link];
End Constructor
When phase 1 is completed successfully, the user and the IOT device receive an
authentication token and the Ethereum address of the authorized user. Phase 2
connects the two entities together. Note that this solution assumes that the user
knows the address - ip or domain name - of the IOT device. In case this wasn’t
true, the device address can be sent by event LoginAttempt.
key pass in order to perform such action. Then, the script extracts the public
key from the private key. The public key is hashed using keccak256 algorithm.
The last 40 bytes of the resulting hash is the Ethereum address of the user.
This Ethereum address is compared with the one received from the smart con-
tract event. This is the formal method to obtain an Ethereum address from a
keystore directory. Note that the public key usage is minimized and replaced
by the Ethereum address since the address is shorter and easier to use. This
is achieved using keythereum to access the private key and elliptic to derive
the public key. Those nodejs libraries can be found online [4,17]. Figure 4 shows
a message sequence diagram for the process of extracting Ethereum addresses
from keystores [4,17].
Fig. 4. The process of deriving the Ethereum address from the user’s ethereum keystore
After assuring that the Ethereum address received from smart contract is
the user’s address. The script starts crafting the authentication message. The
message can be described as following:
Finally, the message is signed using the private key of the user’s ethereum
account. The following authentication package is sent to the IOT device:
IOT Side Implementation Flow: The IOT device script starts in a similar
manner to the user script. It connects to the smart contract deployed in phase
1 and listens for the desired event. When the event occurs, the script gets the
authentication token and the Ethereum address of the authenticated user. The
script waits for the user’s authentication package to arrive. If the package arrived,
the verification phase starts. If any of the verification steps fail to succeed, the
authentication package is dropped to minimize the workload on the IOT device
processing power. The process moves to the next step only if the current step is
verified.
5.1 Costs
Table 1 illustrate the transaction cost, execution cost and the equivalent price in
US dollars for deploying and using the smart contract.
First rows show the price of deploying the smart contract which is only done
once. It is clear that deploying the smart contract is more expensive since it
writes it on the blockchain. On the other side, the login functionality is cheaper.
Using Blockchain for IOT Access Control and Authentication Management 161
The login function can be optimized to cost less. The reason for current price is
that it generates the authentication token by hashing, generating a random num-
ber and retrieving the block hash. These prices represent the cost of using the
traditional proof-of-work consensus protocol. With Ethereum moving to stan-
dardizing the proof-of-authority protocol, these costs will decrease noticeably
since the miners’ work load will decrease too.
5.2 Testing
The testing phase was divided into different subsections. First, manual tests are
performed against the proposed solution to assure its robustness, security and
performance. Manual tests include malicious scenarios in additional to the ideal
test cases. Second, static analysis tools are used to perform automated security
assessment for the smart contracts.
Manual Testing: After running the solution prototype, the ideal scenario was
tested first. A legitimate user calls the smart contract function: login admin
using his/her MIST Ethereum client. The smart contract sends the authen-
tication token and the user’s Ethereum address to the user and IOT device
simultaneously. According to the test, the first phase was completed in less than
4 s on a private blockchain. Then, the user connects to the IOT device by sending
the authentication package explained in Eq. 2.
Bypassing the verification steps in the IOT authentication script were tested
by performing few malicious attacks as explained below:
The outcome of the test phase proves that this solution is secure as long as
the user’s keypairs are not compromised. The authentication tokens should be
invalidated and replaced once the authentication is successfully completed. The
next steps are outside the scope of this paper.
When testing the current solution, the test environment varies. First, most
tests are conducted in a private ethereum blockchain. This eases the process of
mining and validating transactions. After that, when the smart contract is tested
in the public Ethereum blockchain test-net, it is recommended to use Rinkeby
instead of Ropsten since it uses Proof-of-Authority instead of Proof-Of-Work
which is used in Ropsten. This will also ease the public testing process.
162 A. Z. Ourad et al.
The proof of work concept is the current method used in Ethereum main net-
work and Ropsten network to confirm transactions. A miner solves a mathemat-
ical puzzle to validate the transaction for an incentive. This approach requires
a lot of processing power to execute. On the other hand, the proof of authority
implemented in the Rinkeby test-net depends on a set of explicitly authorized
nodes instead of miners solving mathematical problems therefore, it is considered
the future of mining techniques where mining doesn’t require as much processing
power [19].
Finally, another metric that can be proposed for future testing is performing
formal method tests on the smart contract to verify that all possible execution
paths are covered and anticipated. Current efforts are documented in [5,15].
5.3 Evaluation
To assure the quality of the proposed solution, the next step is to compare
it to previous solutions presented in Sect. 2. The evaluation metric is based on
Using Blockchain for IOT Access Control and Authentication Management 163
whether the offered authentication scheme solved problems occurring in the other
authentication mechanisms proposed for the IOT devices.
Table 2 shows a comparison between the proposed solution based on Avail-
ability, Scalability, decentralization and tamper proof. For this comparison, the
evaluation metrics is defined more specifically. Availability is described as remov-
ing the bottleneck and functioning without a single point of failure. Scalability
is used here to explain the added overhead to the usage of the application when
more devices are added. Decentralization is the ability for the authentication
application to run without depending on a central entity that may break the
system if taken down. Tamper proof is the assurance that saved data and trans-
actions cannot be tampered once registered in the logs of the system.
6 Conclusion
References
1. Al-Bassam, M.: SCPKI: a smart contract-based PKI and Identity System (2017)
2. Amadeo, R.: Don’t trust OAuth: why the “Google Docs” worm was so convinc-
ing. [Link]
docs-worm-was-so-convincing/
3. Evans, D.: The Internet of Things. How the Next Evolution of the Internet Is
Changing Everything (2011)
4. George V.: A Next-Generation Smart Contract and Decentralized Application
Platform (2018)
5. Hirai, Y.: Formal Verification of Ethereum Contracts (2018)
6. Liu, J., Xiao, Y., Chen, C.: Authentication and access control in the Internet of
Things. In: 2012 32nd International Conference on Distributed Computing Systems
Workshops, pp. 588–592 (2012)
7. Ali, M., Shea, R., Nelson, J.: Blockstack: A New Internet for Decentralized Appli-
cations (2017)
8. McKinney, J.: Light client protocol (2017)
9. Nakamoto, S.: Bitcoin: a peer-to-peer electronic cash system (2008)
10. Peyrott, S.: An Introduction to Ethereum and Smart Contracts: an Authentica-
tion Solution. [Link]
contracts-part-3/
11. Symantec: Latest Intelligence for June 2017. [Link]
blogs/latest-intelligence-june-2017
12. Minerva, R., Biru, A., Rotondi, D.: Towards a definition of the Internet of Things
(IoT) (2015)
13. Gusmeroli, S., Piccione, S., Rotondi, D.: IoT access control issues: a capability
based approach. In: Sixth International Conference on Innovative Mobile and Inter-
net Services in Ubiquitous Computing (2012)
14. Sandoval, K.: Why OAuth 2.0 Is Vital to IoT Security. [Link]
why-oauth-2-0-is-vital-to-iot-security/
15. Swamy, N., Hriţcu, C., Keller, C., Rastogi, A., Delignat-Lavaud, A., Forest, S.,
Bhargavan, K., Fournet, C., Strub, P., Kohlweiss, M., Zinzindohoue, J., Zanella-
Béguelin, S.: Dependent types and multi-monadic effects in F*. SIGPLAN Not.
51, 256–270 (2016)
16. Szabo, N.: Smart Contracts: Building Blocks for Digital Markets (1996)
17. theethereum: Accounts, Addresses, Public and Private Keys, and Tokens. https://
[Link]/w/[Link]/Accounts, Addresses, Public And Private Keys,
And Tokens
18. Thomson, D.: IoT and the problem of identity. [Link]
connect/blogs/iot-and-problem-identity
19. Tosh, D., Shetty, S., Liang, X., Kamhoua, C., Njilla, L.: Consensus protocols for
blockchain-based data provenance: Challenges and opportunities. In: 2017 IEEE
8th Annual Ubiquitous Computing, Electronics and Mobile Communication Con-
ference (UEMCON), pp. 469–474. IEEE (2017)