Abstract
Today, the manner in which we communicate has greatly advanced. The technology is not just about machines, but people with technology together. Machine-to-machine (M2M) communication is unavoidable in the Internet of things. However, at the same time, there are more attacks against the M2M system. Therefore, a reliable and secure authentication mechanism is required. Blockchain technology is decentralized and highly secure while being tamper-proof. This protects M2M service providers by eliminating the single point of failures. This paper proposes a blockchain-based authentication scheme that uses a practical Byzantine fault tolerance (pBFT) consensus mechanism for M2M security in cyber physical systems. By implementing a blockchain to an M2M system, it provides an ID for devices on the blockchain. Simulation results have shown that the data on the chain cannot be altered. A pBFT consensus algorithm also ensures that the blockchain network is able to come to a consensus with faults.
Introduction
With the advancement of communication technology, a cyber physical system (CPS) expands across multiple devices and systems. In the future, CPS aims to integrate millions of devices to establish a dynamic network of devices communicating and interacting with each other in real time. There are three major types of components that form the three different tiers in a CPS [1]. Sensors are the first type of components and form the environmental tier. Actuators are the second type and form the service tier. Finally, controllers form the control tier. Information is collected via the sensors from the physical system and then sent through the network to the distributed controllers in the cyber world. After the information is processed, the controller communicates with the actuators in the service tier to issue the appropriate commands, which will then activate the related operations and generate feedback. As such, the CPS can achieve self-awareness, self-adjustment, and self-judgment [2]. In an M2M system, devices such as sensors utilize wireless and wired communication channels to communicate with each other. There are three interlinked domains that make up an M2M communication system: (1) its gateway and area network; (2) a network domain that includes a wireless/wired communication network; and (3) an application service domain consisting of applications required in the CPS as well as end users [3].
The authentication issue will be focused on in this work because it is one of the necessary security requirements in communication. Without a secure authentication system, hackers can masquerade as users and steal or change information. Furthermore, they can overload the server by sending redundant data, causing servers to crash. The M2M communication network has the following problems, which make the M2M system insecure [4]. Firstly, the majority of M2M communication is through radio, which can be eavesdropped. In addition, the sensors used for gathering information are usually unattended and could be easily hacked. They also have limited computing power, and therefore complex algorithms used to protect them would not be feasible. Finally, M2M integrates different types of communication medium with different security schemes into the core communication network. Different security schemes generate different protocols, resulting in a potential threat to the M2M communication system. Such examples prove that there are several potential threats that could endanger the M2M communication system. Thus, it is important to create an effective authentication scheme that would help protect the M2M system.
This paper focuses on using a blockchain to replace M2M and improve the distribution and to solve the single point of failures of the service provider. The paper is organized as follows. Section 2 introduces some related work. Next, the system model and the authentication scheme are proposed with security analysis in sections 3 and 4, respectively. Finally, section 5 concludes.
Related work
A bandwidth-efficient cooperative authentication (BECAN) scheme was proposed in reference [5] to filter out false reports in M2M communication. The scheme was designed to prevent undetectable compromising attacks on the nodes when the M2M nodes are in sleep mode. BECAN adopted the cooperative neighbor router-based filtering mechanism, which helps to filter false data considering there are unaffected neighboring nodes. However, this scheme proved to be ineffective as it did not protect the system from other attacks such as replay attacks. The use of an automated authentication and verification of the M2M network over-the-air was also proposed [6]. Furthermore, an identity-based authentication scheme was proposed to support an application in the hospital [7]. However, it was unable to handle denial of service (DoS) attacks and replay attacks. Another paper proposed a password mutual authentication and key establishment protocol [8]. Mobile users are connected to the home network using TD-SCDMA. The protocol helps to identify and secure communicating parties for data transmission. However, it did not consider the mutual authentication between M2M systems and home devices. In addition, it runs into key escrow problems. Reference [9] proposed an authentication process in M2M communication, using theoretic cryptography to analyze the security functions of an authentication process. However the data only involve a generic authentication model and lack details in the specific authentication protocol. Another authentication design was proposed in reference [10] to support the certification process between device and user, ensuring that the integrity of privacy information is safe from machine in the muddle attack. However, the work has not considered attacks other than machine in the middle attack. In reference [11], the M2M Service Provider (MSP) plays a crucial role of private key generator. It generates the security perimeters, public parameters, master keys, private keys as well as the different identities. The M2M service provider then publishes the public parameters, identities, and private keys to corresponding mobile devices while retaining the master secret keys. However, as the MSP contains all the key security information, the M2M service provider is the single point of failure as it contains the authentication process and it generates the security and public parameters, master keys, private keys etc.
System model
We illustrate the system model as in Fig. 1. The M2M system model comprises four parties: mobile devices, environmental devices, the gateway, and the blockchain. Mobile devices act as nodes and are carried by users that send data to the environmental devices. The environmental device relays messages to the gateway, and the gateway connects the blockchain to the network of devices; it is also in charge of sending data from the nodes to the blockchain. The blockchain plays an important role as it stores all the information, and it is run with a master and slave configuration. The reason for the master and slave configuration is that it uses the practical Byzantine fault tolerance (pBFT) consensus mechanism. Byzantine fault tolerance is a consensus mechanism used in a distributed computer network to reach a consensus despite having malicious nodes. Its goal is to reduce the impact of malicious nodes and protect the system against major failures.

Overview of the M2M blockchain authentication scheme for the CPS system.
pBFT is an algorithm that optimizes various aspects of BFT. The pBFT model is essentially made up of one primary node (master) and other backup nodes (slaves). All the nodes work together in the system to come to a consensus, ensuring everything is in order through verification. When a new mobile device applies for access, the master nodes select several nodes from the blockchain to form the authentication group. The group conducts a distributed authentication algorithm for the node. The digital certificate of the node is generated and recorded and then the new mobile devices will then get a copy of the ledger and be able to add data on the blockchain.
Overview of the blockchain-based system
In this section, the blockchain authentication scheme is introduced. But before describing details of the authentication process, a system implementation overview is given. The blockchain is a distributed network that integrates asymmetric encryption, a time stamp, and the consensus algorithm [12]. Once information is stored on the blockchain, it cannot be altered retroactively without affecting all the subsequent blocks [13]. This makes the tampering of data difficult and thus secure.
The structure of a block is illustrated in Fig. 2. A block contains a head and a body. The head contains information such as ID, time stamp, hash value of the target block, and Merkle root of the previous block. The body contains the remaining information such as node ID, operation status, privilege level, access time, service type, public key, and certificate.

Structure of a block.
The interactive process of access authentication based on the pBFT consensus mechanism is shown in Fig. 3.

Interactive process of access authentication based on pBFT consensus.
Assume that nodes/devices that are on the blockchain already have their own ID and digital signature for verification. When the new node needs access authentication, a request is sent to the master (primary) node, which performs the first authentication. At the same time, the master node selects appropriate nodes in the authentication group to form a distribution authentication group. It then sends the request to the authentication group to initiate the distributed authentication through its multicast mode. The nodes execute the request and send it back to the node accessing the authentication. The client waits for f + 1 (f represents the maximum number of nodes that could be faulty). By using the public key, certificate, and consensus algorithm, the new block is formed and added to the chain. Furthermore, the authentication process is separated into four different stages. Firstly, let f represent the faulty replicas; thus, the system would require
We have definitions of view
Request stage: The node initiates authentication access to the primary node. The primary validates the request and initiates a three-phase protocol (pre-prepare>prepare>commit) to ensure consensus among all non-faulty replicas. The replicas then execute and send the results back to the client. The client waits for at least
The authentication scheme mentioned above is based on a normal operation, omitting the discussion on how the node would recover from faults due to dropping out related to Internet connection or related to message retransmission. Furthermore, it is assumed that message authentication is based on digital signatures. With each node having a unique ID and digital certificate, hackers cannot masquerade as another user. Moreover, one of the benefits of using a blockchain is that data are stored and added to the block. It is impossible to alter without changing subsequent blocks.
Against manipulation attacks such as a man-in-the-middle attack
A man-in-the-middle attack means the attacker attacks in between the sender and the receiver, trying to tamper and alter the message. Even if the attacker obtains the ID of the sender or receiver, they cannot alter the blocks; the record cannot be altered retroactively without altering all the subsequent blocks and the consensus of the network [12].
Against replay attacks
Replay attacks are a type of attack whereby an attacker disguises as the sender and replies to the receiver pretending to be the legitimate sender. However, there are time stamps in each block of transactions as well as the sender’s ID. Thus, even if the attackers pretend to be the sender, this could be verified on the blockchain, making this type of attack impossible.
Against service-based attacks such as DoS
DoS attacks are a type of attack whereby an attacker prevents legitimate users from accessing the service. In a Dos attack, attackers send excessive messages to the network, trying to crash the system. However, because the blockchain is not centralized and the nodes work together to come to a consensus, it is hard for the DoS attack to affect the system. Furthermore, even if a node is brought down by a DoS attack, the node gets replaced by another node to form the authentication group.
Against identity attacks such as impersonation
Impersonation attacks are a type of attack whereby an attacker attempts to disguise as a legitimate user trying to gain access to data. However, when a new user wants to gain access, they must first request access, where the master node would initiate the authentication. After authentication, there would be an ID as well as a digital certificate for each user. Thus, this type of attack would not succeed.
Performance model of the blockchain network
To test the system’s robustness and practicality, a blockchain system with at least 100 other peers would be needed. This project refers to [14] the performance modeling of pBFT consensus process for permission blockchain network. In this paper, a pBFT consensus network was built with a sample size of up to 100 peers. IBM bluemix service and stochastic reward nets were used to run production-grade Internet of things applications and examine the performance of larger networks.
The performance modeling graph states the number of peers against the mean time to achieve consensus, as shown in Fig. 4. As predicted, as the number of peers increases, the time taken to achieve consensus will increase as the time to transmit T messages across the three phases increases. Each node that accepts the pre-prepare message would follow up and would be required to send a prepare message of its own. The nodes that are prepared would then send out a commit message. Likewise, if we increase the time it takes to prepare the message, the transmission time would increase too. Furthermore, there is an increasing queueing delay for messages that also increases T. Eventually, the average time in which to achieve consensus when N is 100 is 5.34 times larger as compared to when N is 4.

Illustration of the pBFT performance model.
In this paper, we have involved blockchain technology in an authentication scheme for M2M communication in CPS. By implementing a blockchain to an M2M system, it provides an ID for devices on the blockchain. If a new node wants to join the network, the node must send a request. This request is then processed and a master node is initiated. Then, it is validated by a group of nodes using the pBFT consensus algorithm. The new node will be added to the block if there are at least 2f+1 replies that validate the block. It proves to be a viable authentication scheme as impersonation attacks are not possible due to the storing of the ID on the chain.
