<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Facing the Blockchain Endpoint Vulnerability, an SGX-based Solution for Secure eHealth Auditing</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Luigi Coppolino</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Salvatore D'Antonio</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Giovanni Mazzeo</string-name>
          <email>giovanni.mazzeog@uniparthenope.it</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Luigi Romano</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Paolo Campegiani</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Bit4id S.r.l.</institution>
          ,
          <addr-line>via Diocleziano 107, 80125 Naples, IT</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Naples 'Parthenope'</institution>
          ,
          <addr-line>Naples, IT</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <abstract>
        <p>According to McAfee Labs, even in 2019, the eHealth sector is confirmed as one of the most critical in terms of cybersecurity incidents. It is estimated that more than 176 million patient records were target of attacks between 2009 and 2017, and with a single attack, in 2018, more than 1.4 million patient records were affected at UnityPoint Health. To cope with such a dramatic situation, one of the main strategic priority in the eHealth field is represented by the adoption of Blockchain. Specifically, according to a Deloittes survey, 55% of healthcare executives believe that blockchain technology will disrupt the healthcare industry. Unfortunately, while blockchain provides a valuable tool for enhancing the security of health applications and related data, it cannot be assumed as a panacea for data security. As an example, the so-called Endpoint Vulnerability issue is a well-known problem of Blockchain-based solutions: in such a case the attacker successful in gaining control of the end-point can tamper data off-chain during its generation and/or before it is sent to the chain. In this paper, we face such an issue by shielding the endpoint through the Intel Software Guard eXtension (SGX) technology. We demonstrate our solution for an auditing software belonging to the European eHealth management system (namely OpenNCP). We also discuss how our solution can be generalized to any other Blockchain-based solution. Finally, an experimental evaluation has been conducted to prove the actual feasibility of the proposed solution under the requirements of the real eHealth system.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The Blockchain technology is becoming pervasive in today's societies. It is not just a buzzword, it is the
hottest and fastest growing technological market in the IT sector. Statistical studies said that there are
approximately 44% of companies from different fields (e.g., banks, agriculture, governments, accountants)
that adopted a blockchain [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Traditional centralized services become powered by distributed systems
based on the Distributed Ledger Technology (DLT) of the Blockchain. Distributed ledgers leverage
synchronized databases, which provide an history of information visible to anyone within the network,
rather than having a central administrator like a traditional database. Examples of blockchain-based
services range from the most famous Bitcoin and Smart Contracts up to less notorious Auditing systems.
In the healthcare context, there is a growing interest in Blockchain. In fact, the content recorded in
the blockchain cannot be tampered, thus it can be used to record sensitive information in the eHealth
management system. One of the most significant use case of blockchain in eHealth is mainly for auditing
purposes, whose main potential objective is to create a secure, unforgeable registry for all log files
regarding eHealth activities occurred, e.g., in a hospital management system. The integrity of log
records is a fundamental element for eHealth security. For instance, once suspected or actual attacks
occur, log data becomes important for identifying or isolating the malware. Thus, without solid audit
logs, an attack may go unnoticed indefinitely and the particular damages done may be irreversible. The
      </p>
      <sec id="sec-1-1">
        <title>Coppolino, D'Antonio, Mazzeo, Romano, Campegiani</title>
        <p>intrinsic distributed property of Blockchains ensures to health-related data more confidence in terms
of integrity. A successful attack should be able to modify the data retained by the Blockchain in all
the nodes belonging to the network. In spite of this, there are still open issues affecting the Blockchain
such as the Endpoint Vulnerability where data off-chain is at risk before being sent to the chain. An
attacker could tamper an audit trail in the endpoint during its acquisition and before its encryption.
The ultimate goal of this paper is to protect patient's privacy and ensure integrity of patients' data,
while keeping track of critical operations in order to provide secure traceability support. We propose
a solution for a Blockchain-based logging system that leverages hardware-assisted trusted computing to
address the Endpoint Vulnerability. Sensitive functionalities carried out before sending the health-related
logs to the Blockchain are executed within the Trusted Execution Environment (TEE) of Intel Software
Guard eXtension, i.e., the widely-accepted technology of trusted computing released by Intel. Our work
demonstrates through a security analysis and a performance evaluation that the proposed approach
results usable in real contexts. Using requirements coming from a real healthcare management system,
we demonstrate that the overhead introduced in the system is acceptable and does not alter the
compliance with time-related constraints.</p>
        <p>
          The proposed approach has been validated in the context of the KONFIDO project1, whose main goal
is to enhance security of the European eHealth system for cross-border data exchange, better known
as OpenNCP [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. This is a real healthcare management system, currently adopted by 11 EU member
states to enable Patient Summary and ePrescription exchange accross countries. In the European Union,
over 1.4 million people are working in a country different than those of residence [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ], so they are natural
possibile beneficiaries from this system, like also European citizens visiting a EU country. OpenNCP uses
an ATNA-based auditing system, which is vulnerable to integrity attacks. For this reason, in KONFIDO,
a blockchain-based service has been used to create a tamper-proof logging solution, as already explained
by Castaldo et al. [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]. The only missing piece for closing the security loop is the protection from attacks
targeting the Blockchain endpoint, which lies in the National Contact Point (NCP) of OpenNCP.
        </p>
        <p>The remainder of this work is organized as follows. Section 2 overviews other research papers that used
SGX with blockchain in other contexts. Then, Section 3 presents the two core technologies we adopted.
Afterwards, Section 4 describes the OpenNCP eHealth system and provides pillars on the blockchain-based
auditing service. Section 5 defines the problem and the challenges we face in this paper. The design
and implementation details will be reported in Sections 6-7. Finally, Section 9 concludes the document.
2</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>Other research works leveraged the security features of TEEs, in general, and of Intel SGX, in particular,
for hardening blockchain-based services such as Bitcoin and Smart Contracts. Different security aspects
of the blockchain have been covered by these works. To the best of our knowledge, this is the first
research that faced the Endpoint Vulnerability and that propose the marriage of SGX and Blockchain
in the eHealth sector. The security coming from their combination is extremely important in such
a context where privacy and integrity requirements are particularly stringent.</p>
      <p>
        Lind et al. [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] propose TEEChain, a payment solution that performs off-chain transactions
asynchronously with respect to the underlying blockchain. The proposed idea wants to address
the security of those payment networks that realize off-chain transactions instead of writing to the
blockchain for each transaction in order to reduce the overhead. Authors propose an approach to
prevent parties from misbehaving by hardening the transactions in SGX.
      </p>
      <p>
        Yuan et al. [
        <xref ref-type="bibr" rid="ref26">26</xref>
        ] presents ShadowEth, a system where TEE and blockchain are combined to enable
private smart contract based on public blockchains. The idea is to create a public smart contract named
\bounty contract" which performs the process of deployment and verification and stores the metadata
of private contract. Additionally, they proposed an off-chain distributed storage named TEE-DS to
store binary and states of private contracts.
      </p>
      <p>
        Hardjono et al. [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] only explored how TEEs can be useful to harden individual nodes and systems in
the blockchain infrastructure, and be the basis for secure group-oriented computations. Authors propose
possible case studies such as the adoption of TEE to enable secure gateways for trust establishment
across distinct blockchain systems.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Technologies Background</title>
      <p>In the following, we present the core technologies used in this paper to build a trustworthy eHealth
auditing system.
3.1</p>
      <sec id="sec-3-1">
        <title>Blockchain</title>
        <p>
          Blockchain is still an innovative technology which has yet to be properly sistematized. The current
definition from the ISO/TC 307 on "Blockchain and Distributed Ledger Technologies" [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] provides for
a tentative definition based on the concept of ledger. From ISO/TC307, a distributed ledger is a ledger
shared across a set of nodes and synchronized between them using a consensus mechanism. Built on these
definitions, a blockchain is a distributed ledger structured in blocks, organized in an append-only chain
with cryptographic links, designed to be tamper-resistant, to create a definitive, final, and immutable
ledger. These distinctive properties come from the clever combination of cryptographic techniques
and incentive mechanisms for the different kind of players to keep the blockchain running and actively
contribute towards its accessibility and availability, providing for an innovative solutions for the Byzantine
Fault Tolerance problem [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ] where different and isolated parties should reach consensus on a private value
of information. The blockchain creates a chain of blocks ordered in a network of non-trusted peers. Every
block points to the previous one and contains data, its own hash, and the hash of the previous block. A
block stores encrypted details about the parties whose interaction resulted in the data stored in the block.
BFT has been a research area for decades, when in 2009 Satoshi Nakamoto (a pseudonym for probably a
group of people) came out with the original Bitcoin paper [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ] where he proposed a crytpographic way to
reach consensus between different parties with a so called Proof-of-Work (PoW) algorithm. As blockchains
and distributed ledgers are being adopted in new areas, different and more specialized systems are put in
place, including permissioned systems (when only authorized players could add transactions) and private
ones (when authorization is required to read the transactions). An initial taxonomy is provided in [
          <xref ref-type="bibr" rid="ref25">25</xref>
          ].
3.2
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>Hardware-assisted TEE and Intel SGX</title>
        <p>
          A Hardware-assisted Trusted Execution Environment (HTEE) has started to be widely adopted [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ][
          <xref ref-type="bibr" rid="ref8">8</xref>
          ][
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]
|including in eHealth sector| to ensure that the confidentiality and integrity of both code and data are
protected by means of hardware mechanisms. Unlike software-based solutions [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ][
          <xref ref-type="bibr" rid="ref18">18</xref>
          ], a HTEE is able to
guarantee security against attackers who have full control over the system, e.g., a malevolent cloud service
provider exploiting its privileged position. Above all, a HTEE guarantees security features [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ] such as i)
Isolation of code and data residing inside against unauthorized access and modification; ii) Attestation
of OS and/or application software; iii) Dynamic Root of Trust that builds trust chains. Over the years
many HTEE implementations were released such as Intel SGX, AMD SEV, ARM TrustZone [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ].
In this work, the focus is on the Software Guard eXtension (SGX) of Intel's CPUs [
          <xref ref-type="bibr" rid="ref19">19</xref>
          ], which allows the
creation of protected memory regions, namely enclaves. In such HTEEs, code and data are protected
from disclosure or modification thanks to address regions whose content is protected { via encryption
Copyright © 2021 for this paper by its authors. Use permitted under Creative Commons License 3
Attribution 4.0 International (CC BY 4.0).
        </p>
        <sec id="sec-3-2-1">
          <title>Coppolino, D'Antonio, Mazzeo, Romano, Campegiani</title>
          <p>
            and hashing { from any software outside the enclave, included privileged ones (e.g., OS or Hypervisor).
Only the enclave code can access any part of the address space, except those areas belonging to other
enclaves. The boundary between enclave and non-enclave sections is governed by the processor who
blocks any access attempt from unauthorized processes. An interface { defined in a domain-specific
C language { is declared by the programmer to establish entry points, i.e., calls to/from an enclave
(namely ECALLS and OCALLS). A HTEE such as SGX can be formalized as follows [
            <xref ref-type="bibr" rid="ref23">23</xref>
            ]. We define
the enclave program as the tuple:
          </p>
          <p>e = hinite;configei
where confige includes the entrypoints confige:entrypoint, the virtual address range confige:evrange,
the access permissions confige:acl, and other application-specific configuration data confige:app. While
inite brings the initial state of SGX such as values of memory pages pointed by confige:evrange that
contains code and data. We define the enclave state in some instant of time as Ee( ), which is a
projection of the machine state. Finally, enclaves' inputs are specified as Ie( ), i.e., a partial map from
virtual addresses (outside confige:evrange) to machine words. Enclaves' outputs are defined as Oe( ),
i.e., a partial map from virtual addresses (outside confige:evrange) to words. The semantics of enclave
execution is the set of execution traces, containing an execution trace for each input sequence, i.e., for
each value of non-enclave memory.</p>
          <p>[[e]] = fh(Ie( 0);Ee( 0);Oe( 0));:::ijinite(Ee( 0))g
The determinism property of SGX programs entails that a specific sequence of inputs hIe( 0);Ie( 1);Ie( n)i
uniquely identifies a particular execution trace of [[e]] under that sequence of inputs. An important
feature of SGX is the remote attestation, which enables the integrity verification of an enclave residing in
external domains via Intel's third-party server. Let (e)D be the quote of a generic enclave e generated
in some domains D, we say that attestation is verified when:</p>
          <p>Att([[e]])D , (Ee( ))I = (Ee( ))D
where (Ee( ))I is the quote generated in Intel's Attestation Service of the enclave [[e]] in a determined
state Ee( ).
4</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>The Blockchain Auditing for the eHealth OpenNCP System</title>
      <p>
        The current deficiencies in security logging and analysis allow attackers to hide their location, malicious
software, and activities on victim machines. Even if the victims know that their systems have been
compromised, without protected and complete logging records they are blind to the details of the attack
and to subsequent actions taken by the attackers. Without solid audit logs, an attack may go unnoticed
indefinitely and the particular damages done may be irreversible. Logging records could also be the
only evidence of a successful attack. Moreover, many healthcare organizations keep audit records for
compliance purposes. Because of poor or nonexistent log analysis processes and log integrity, attackers
sometimes control victim machines for months or years without anyone in the target organization
knowing, even though the evidence of the attack has been recorded in unexamined log files.
Such issues also affected the logging system of the European eHealth management system, namely
OpenNCP [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. This is an implementation of the NCPeH protocol, adopted by National Contact
Points (NCPs) to securely exchange eHealth data between European Union Member States (EU MSs).
The NCPeH manages the exchanges of Patient Summary (PS) and exchange of Prescription (eP) as
requested by a physician or a pharmacist who are providing health treatments in a EU MS B, where a
citizen, originated from an EU MS A, is seeking medical assistance. An OpenNCP node interacts with
the national infrastructure of EU MS B (where the requests for eHealth data are originated) and with
the OpenNCP of EU MS A, which is in charge of providing data by asking the national infrastructure
of EU MS B. An OpenNCP node plays both these two roles, according to the flow of requests. NCPeH
comprises many IHE specific protocols, as shown in figure 1, from [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>
        OpenNCP acts as an ATNA [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] client, to implement an Audit trail. The internal Audit Manager provides
an interface for the Audit Trail Service, that keeps tracks of all of the security relevant events by logging
them using the built-in OpenATNA server. In the context of the aforementioned KONFIDO project,
the OpenATNA server has been replaced with the proprietary Hylos log server [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], which is IHE certified
and has been extended to store a subset of all of the relevant logs inside a private blockchain system (Fig.
2). These logs, describing a transaction between two different EU MSs, are stored encrypted in a way
that each one of the two MSs could decrypt them autonomously, while the actual content of the data are
not available to the other EU MSs not participating in the transaction. As a result of that, each EU MS
directly contributes towards the resilience and tamper-proof property of the blockchain, while privacy
of the transactions is preserved. Should a contrast between two countries arise in the future regarding a
specific transaction (as an example, Country B wants to show that data have been asked but not provided
by Country A, resulting in a more complex health treatment for the citizen of Country A) each country
(A and B) could access the data of its interest, being sure that they have not been tampered with (as
the blockchain with the data is replicated by all the EU MSs). Details for the implementation are in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>OpenNCP
SmartLog</p>
      <p>Country A
Enc.</p>
      <p>Module</p>
    </sec>
    <sec id="sec-5">
      <title>Problem Definition</title>
      <p>The distributed properties typical of the blockchain provide more security guarantees to the sensitive
health-related logs acquired by the system previously described, which creates tamper-proof audit trails
of the OpenNCP activities. More precisely, the distributed consensus and storage of the blockchain
ensure that information cannot be modified unless it is agreed across the entire DLT. In a nutshell,
several nodes have the same information, thus an attacker should be able to get access and change
all these distributed data in order to launch an attack to the data integrity. Even identities are usually
held on the DLT. When a user has to be authenticated, there is no more a centralised party that checks
and verifies data of individuals. Thanks to the DLT, the credential information are distributed. The
possibility that an attacker manipulates identification data is highly reduced.</p>
      <p>Copyright © 2021 for this paper by its authors. Use permitted under Creative Commons License 5
Attribution 4.0 International (CC BY 4.0).</p>
      <sec id="sec-5-1">
        <title>Coppolino, D'Antonio, Mazzeo, Romano, Campegiani</title>
        <p>
          Even if a blockchain increases the resistance to considerable category of attacks, it does not make it
immune against security vulnerabilities, which are still considered today as the most critical open issues
of this technology [
          <xref ref-type="bibr" rid="ref24">24</xref>
          ]. It is important that these security risks are properly recognized and mitigated,
especially when blockchain systems manage data subjected to strict privacy requirements such as in the
eHealth sector. One relevant vulnerability of DLT is outside the blockchain itself. It is usually known as
Endpoint Vulnerability [
          <xref ref-type="bibr" rid="ref22">22</xref>
          ]. Such an issue arises when new information of a blockchain-enabled service is
inserted or withdrawn into/from the DLT. In such a situation, the endpoint represents the place where
an individual or another software use to access the blockchain-based service. It is during the process
of getting access to the blockchain that the data is most vulnerable. The Endpoint Vulnerability could
lead to threatening the personal user security, stealing the private key, or introducing new malware.
In the blockchain-based auditing system presented before, the audit trail is at risk in the NCP endpoint
when it needs to be ciphered before being sent to the blockchain. Figure 2 depicts the specific weak
points where the attacker could tamper the log. The integrity of the log may be affected. Something
similar could happen even for other services. For example, it may occur in Smart Contract systems
during the contract setting up process, and before this is deployed on the blockchain. Users' sensitive
inputs are at risk off the blockchain. The attacker could inject fake data in the contract.
The goal of this work is to design a solution to the Endpoint Vulnerability by leveraging isolation and
attestation features typical of the Intel SGX extension. The security-enhanced logging system should
be able to:
(1) Securely acquire and generate an audit trail
(2) Shield the data ciphering procedure
(3) Protect the keys used for the encryption
(4) Harden the Endpoint-Blockchain communication
6
6.1
        </p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Solution Design</title>
      <sec id="sec-6-1">
        <title>Dataflow Overview</title>
        <p>Figure 3 shows the location of the SGX-enabled auditing system based on Blockchain in a typical
healthcare dataflow such as a clinical document acquisition in OpenNCP. The prerequisite is the
availability of the SGX hardware extension in each national gateway (i.e., the NCP node). When
new events occur, e.g., a patient summary request or a document transformation, the auditing system
has to securely store the activities in the Blockchain. The SmartLog and Encryption modules do not
exist anymore. Instead, an SGX enclave responsible for the log generation is instantiated internally
by OpenNCP. The audit record is securely built in the trusted execution environment with all the
necessary information such as the event timestamp. In this regard, as explained below, our solution uses
a trusted time source since a compromised timestamp could be harmful for the system. At this point,
not even an attacker with root privileges can tamper the log during its generation. Then, the log must
be sent to the Blockchain. Hence, the enclave encrypts and signs the audit record with a key stored
in the SGX secure perimeter. From now on, logs content is confidential even off SGX and the integrity
of the events as well as their order is ensured. The key management in terms of generation, distribution,
and storage, is discussed further below. The cryptographic operations are shielded from any privileged
insider thanks to the SGX hardware-enabled isolation features. Finally, in order to ensure the security
of the communication channel, an SGX-secured TLS is established with the Blockchain. This means
that the communication terminates directly in the enclave, which is also responsible of keeping the
TLS private key. With our solution, we eliminate the risk of privileged attackers such as malicious
insiders by enabling independent log integrity and time verification which cannot be backdated.</p>
        <sec id="sec-6-1-1">
          <title>Coppolino, D'Antonio, Mazzeo, Romano, Campegiani</title>
          <p>Query
patient
data</p>
          <p>NCP Node Country A
-Search for the
document.
-Register the
query event</p>
          <p>OpenNCP</p>
          <p>SGX
SGX
--EGnecnreyrpatte&amp;LSoiggn Log
-Hold PK
-Send Enc(Log)</p>
          <p>
            NCP Node Country B
-Retrieve and
Transform the
document.
-Register the
document
acquisition
event
For security reasons, most of the fields of a log record are directly generated in the SGX enclave,
thus avoiding the risk of tampered entrypoints, e.g., malicious outputs returned to an OCALL (i.e.,
the function called from within the enclave). The only source of attack may be represented by the
timestamp. In fact, services such as timer and monotonic counters are not supported inside the Intel
SGX technology [
            <xref ref-type="bibr" rid="ref13">13</xref>
            ]. When a request for the timestamp is made, the enclave performs the untrusted
OCALL. The attacker could manipulate the time value in order to generate a misalignement in the
log system. For this reason, in our solution, the timestamp is provided by a separate TEE, and securely
made available to Intel SGX enclaves. According to Intel [
            <xref ref-type="bibr" rid="ref13">13</xref>
            ], the Intel SGX software supports the
implementation of such a secure service. It leverages the security capabilities of the Intel Converged
Security and Management Engine (CSME). The CSME is an embedded engine running its dedicated
firmware in the Platform Control Hub (PCH) on Intel platforms, and is separate from the CPU. Hence,
the SGX enclave responsible for the OpenNCP log generation communicates over a secure channel with
the CSME Protected Real-Time Clock (PRTC). The only issue is that the trusted time service provides
coarse-grain timer values relative to a reference point. It does not provide a trusted wall clock time. The
idea is that the trusted time service uses an epoch value to enable the enclave in detecting if there is
discontinuity between different timer reads. A change of the timer source epoch value between two reads
indicates that either the PRTC in the paired CSME has been reset due to events like battery replacement,
or the PSE has paired with a different CSME due to unexpected event such as software attack.
6.3
          </p>
        </sec>
      </sec>
      <sec id="sec-6-2">
        <title>Key Management</title>
        <p>We implemented a dedicated approach for what regards the key management and distribution. The
idea is to leverage the attestation features of SGX to avoid the use of a third-party key management
server that could be potentially untrusted. At startup time, when the NCPs are setup, every enclave
starts performing the remote attestation procedure to verify that all the other enclaves in the NCP
nodes have not been tampered. Once completed this phase, keys are exchanged. Particularly, the way
we do this is through the Diffie-Hellman scheme, which allows the exchange of keys over untrusted
channels. At the end of this process, all the SGX enclaves will have a list of keys for all the involved
countries. Keys are finally saved in a persistent storage after being ciphered.</p>
        <p>It is important to notice that such an approach fits well for this particular case study where there is a
limited amount of Blockchain endpoints involved. In a different situation, another possibility may be to
Copyright © 2021 for this paper by its authors. Use permitted under Creative Commons License 7
Attribution 4.0 International (CC BY 4.0).</p>
        <sec id="sec-6-2-1">
          <title>Coppolino, D'Antonio, Mazzeo, Romano, Campegiani</title>
          <p>leverage a typical key management solution in which a third-party is responsible for the key generation
and distribution.
7</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>Implementation Details</title>
      <p>Designing an SGX-based solution requires a fundamental decision, i.e., what should be placed inside and
outside an enclave. Or better, which functions should be exposed to the outside world and to the enclave in
the SGX interface. This is particularly important since the decision affects both the security properties in
terms of Trusted Computing Base (TCB) size, and the performance overhead. The methodology pursued
for porting the C++ SGX enclaves in the Java-based OpenNCP is the Ad-Hoc approach that requires
manual and dedicated partitioning of the Java software. We used a Java Native Interface (JNI) bridge to
link the trusted and untrusted worlds. The Java code runs outside the enclave, and uses the JNI bridge to
interact with trusted code components running within SGX secure enclaves. While this approach entails a
non-trivial development activity on the software to be secured, it ensures a much smaller size of protected
code and, at the same time, a reduced number of transitions between secure and insecure worlds.
Figure 4 shows a simplified call graph of the implemented solution in the extended OpenNCP system.
When the user (e.g., a doctor) performs the query through the WebPortal, then the function query()
is called in the endpoint node (PTA: the protocol terminator of the NCP A). The execution control will
be directly moved into the SGX enclave via the init function sgx init() that launches the key exchange
procedure, in case keys have not been assigned yet. Afterwards, the query is carried out by the enclave
and the event is registered in the blockchain by the SGXLogger object.</p>
      <p>class WebPortal{</p>
      <p>void onSubmitButton(){
} } query(RSSMAR89P0J4aCv7a82)</p>
      <p>1
class OpenNCP_PTA{</p>
      <p>PSummary query(pID){ 2
sgx_init();
sgx_ps_q(pID);</p>
      <p>3</p>
      <p>Java
}</p>
      <p>}
}</p>
      <p>}
class OpenNCP_PTB{</p>
      <p>PSummary retrieve(pID){
sgx_init();
sgx_ps_r(pID);
void sgx_init(){</p>
      <p>if(first) key_exchnge();
} else readSK();
PSummary sgx_ps_q(pID){
//Perform the query
…
regActivity(“someEvnt”);
} return result;4 C++
class SGXLogger{
void reg_activity(e){
t=sgx_trusttime();
log.time=t;
log.event=e;
…
clog=cipher(log,sk);
sgx_ssl_send(clog);</p>
      <p>C++</p>
      <p>Java } }
Off-SGX</p>
      <p>SGX</p>
    </sec>
    <sec id="sec-8">
      <title>Performance Evaluation</title>
      <p>In this section, we present the evaluation activity conducted on the SGX-enabled auditing solution based
on Blockchain, which has been realized using workloads typical of the OpenNCP eHealth system. We
report the findings on transaction throughput and transaction latency measurements that we conducted
using the Bit4id proprietary Blockchain Hylos. Our goal was to verify that the overhead introduced
by the SGX component in terms of log generation and sending is acceptable and does not alter the
compliance of the auditing system with OpenNCP requirements.</p>
      <p>The experimental setup must include the OpenNCP endpoints and the Blockchain network. The former</p>
      <sec id="sec-8-1">
        <title>Coppolino, D'Antonio, Mazzeo, Romano, Campegiani</title>
        <p>was simulated in a single node, which is SGX-enabled. This is reasonable since the transmission latency
between the two NCP nodes is not of interest for the purpose of this evaluation. Such a node has the
following specifications: an Intel Xeon E3-1270 v5 CPU with 4 cores at 3.6 GHz with SGX extension
enabled, 8 hyper-threads (2 per core), and 8 MB cache. The host has 64 GB of memory and runs
Ubuntu 16.04 LTS with Linux kernel version 4.2. The Intel SGX PSW and SDK v2.6 have been used
for implementing and launching the SGX enclave. Regarding the Blockchain, the proprietary Bit4id
Hylos based on Proof of Work (PoW) consensus algorithm and configured with 20 peers has been used.
All peers ran on hardware machines belonging to the Italian Veneto eHealth system. Each machine
had 8 vCPUs (4 cores at 3.6 GHz) and 16 GB RAM.</p>
        <p>
          Our goal is to observe the impact given by SGX to the processing phases occurring in the endpoint before
the data is sent to the Blockchain. To this end, we measure the throughput t of requests served per second,
and the service (or response) time s that represents the interval of time needed to perform the log-related
subroutines in the endpoint. The idea is to compare the performance of the native auditing system
with the solution using SGX. The goal is to characterize the level of system performance given a specific
workload that is typically the one expected for the immediate future. The workload in terms of events
arrival rate depends on the number of requests typically made to the NCP endpoints. Such a number
unfortunately is not available to the public, thus our approach is to start from EU statistics, similarly to
[
          <xref ref-type="bibr" rid="ref5">5</xref>
          ], and estimate the possible workload scenarios. The worst case is given by the endpoint with the highest
number of document requests in both directions. This means that we need to look at the country with
high percentages of EU immigrants and large number of people accessing the health service. According to
migration and migrant population statistics, Germany has 7:2% of immigrants. Furthermore, according
to the 2018 health report of the German health ministry [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ] the number of patients in a year is around
20M. Considering the peak in February it can be deduced that in this month there are about 1'214'000
patients, applying to these the percentage of foreigners originating from another EU country (i.e. 7:2%),
87408 request are obtained in one month; distributing them evenly per day and per hour the result
is 130 requests per hour or 2.17 requests per minute. We derived the Usable capacity and the Knee
capacity: the first represents the maximum throughput achievable without exceeding a pre-specified
response-time limit, the latter is the point beyond which the response time increases rapidly but the gain
in throughput is small. The measurements obtained here can be then used for the design of experiments.
In Figure 5, it is possible to observe the graphs of throughput and response time as the request rates
vary. In the native auditing system without SGX, the Usable capacity is 180req=min, while the Knee
capacity is 160 req/min. In the other case, the Usable capacity is 85 req/min and the Knee capacity
is 45 req/min. The comparison of such results shows that there is a non-negligible overhead in the
auditing system. In spite of this, the solution ensures performance compliant with the considered worst
case of system workload.
        </p>
        <p>Copyright © 2021 for this paper by its authors. Use permitted under Creative Commons License 9
Attribution 4.0 International (CC BY 4.0).
9</p>
      </sec>
    </sec>
    <sec id="sec-9">
      <title>Conclusion</title>
      <p>This paper proposed a promising approach to address the well-known Endpoint Vulnerability affecting the
majority of Blockchain-based services. It described a solution based on the Intel SGX technology in which
data is protected from tampering within the SGX trusted execution environment. Sensitive phases of data
acquisition and encryption | occurring in the endpoint before sending to the Blockchain | are realized
in the SGX enclaves. We implemented the proposed approach for a Blockchain-based auditing system
used in the context of the European eHealth system, namely OpenNCP. The performance evaluation
demonstrated that the SGX-enabled logging introduces an overhead, which is acceptable for the specific
eHealth system requirements. It is important to notice that our approach is easily usable to any other
Blockchain-based service where the Endpoint Vulnerability could pose at risk the integrity of data.</p>
    </sec>
    <sec id="sec-10">
      <title>Acknowledgments References</title>
      <p>This project received funding from the European Union's Horizon 2020 Framework Programme for
Research and Innovation under grant agreement No 727528 (KONFIDO).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <article-title>[1] ISO/TC 307 Blockchain and distributed ledger technologies</article-title>
          . https://www.iso.org/committee/6266604. html. Accessed:
          <fpage>2019</fpage>
          -09-27.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Bit4id. Hylos - Secure Log Server</surname>
          </string-name>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>F.</given-names>
            <surname>Campanile</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Coppolino</surname>
          </string-name>
          , S. DAntonio, L. Lev,
          <string-name>
            <given-names>G.</given-names>
            <surname>Mazzeo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Romano</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sgaglione</surname>
          </string-name>
          , and
          <string-name>
            <given-names>F.</given-names>
            <surname>Tessitore</surname>
          </string-name>
          .
          <article-title>Cloudifying critical applications: A use case from the power grid domain</article-title>
          .
          <source>In 2017 25th Euromicro International Conference on Parallel, Distributed and Network-based Processing (PDP)</source>
          , pages
          <fpage>363</fpage>
          {
          <fpage>370</fpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Luigi</given-names>
            <surname>Castaldo</surname>
          </string-name>
          and
          <string-name>
            <given-names>Vincenzo</given-names>
            <surname>Cinque</surname>
          </string-name>
          .
          <article-title>Blockchain-based logging for the cross-border exchange of ehealth data in europe</article-title>
          . In Erol Gelenbe, Paolo Campegiani, Tadeusz Czachorski,
          <string-name>
            <surname>Sokratis K. Katsikas</surname>
          </string-name>
          , Ioannis Komnios, Luigi Romano, and Dimitrios Tzovaras, editors,
          <source>Security in Computer and Information Sciences</source>
          , pages
          <volume>46</volume>
          {
          <fpage>56</fpage>
          ,
          <string-name>
            <surname>Cham</surname>
          </string-name>
          ,
          <year>2018</year>
          . Springer International Publishing.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>L.</given-names>
            <surname>Coppolino</surname>
          </string-name>
          , S. DAntonio, G. Mazzeo,
          <string-name>
            <given-names>L.</given-names>
            <surname>Romano</surname>
          </string-name>
          , and
          <string-name>
            <given-names>L.</given-names>
            <surname>Sgaglione</surname>
          </string-name>
          .
          <article-title>Exploiting new cpu extensions for secure exchange of ehealth data at the eu level</article-title>
          .
          <source>In 2018 14th European Dependable Computing Conference (EDCC)</source>
          , pages
          <fpage>17</fpage>
          {
          <fpage>24</fpage>
          ,
          <string-name>
            <surname>Sep</surname>
          </string-name>
          .
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Deloitte</surname>
          </string-name>
          .
          <source>Global blockchain survey</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>A. Markowska M. Jones E. Fries-Tersch</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          <string-name>
            <surname>Tugran</surname>
          </string-name>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Christof</given-names>
            <surname>Fetzer</surname>
          </string-name>
          , Giovanni Mazzeo, John Oliver, Luigi Romano, and
          <string-name>
            <given-names>Martijn</given-names>
            <surname>Verburg</surname>
          </string-name>
          .
          <article-title>Integrating reactive cloud applications in sereca</article-title>
          .
          <source>In Proceedings of the 12th International Conference on Availability, Reliability and Security</source>
          ,
          <source>ARES '17</source>
          , pages
          <issue>39:1</issue>
          {
          <issue>39</issue>
          :
          <fpage>8</fpage>
          , New York, NY, USA,
          <year>2017</year>
          . ACM.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Marcelo</given-names>
            <surname>Fonseca</surname>
          </string-name>
          , Kostas Karkaletsis, Isabel A.
          <string-name>
            <surname>Cruz</surname>
          </string-name>
          , Alexander Berler, and
          <article-title>Il dio Castro Oliveira</article-title>
          .
          <article-title>OpenNCP: a novel framework to foster cross-border e-health services</article-title>
          .
          <source>Studies in health technology and informatics</source>
          ,
          <volume>210</volume>
          :
          <fpage>617</fpage>
          {
          <fpage>21</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Marcelo</surname>
            <given-names>Fonseca</given-names>
          </string-name>
          , Kostas Karkaletsis,
          <article-title>Isabel A Cruz, Alexander Berler, and Il dio Castro Oliveira. Openncp: a novel framework to foster cross-border e-health services</article-title>
          .
          <source>In MIE</source>
          , pages
          <volume>617</volume>
          {
          <fpage>621</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>Thomas</given-names>
            <surname>Hardjono and Ned M. Smith.</surname>
          </string-name>
          <article-title>Decentralized trusted computing base for blockchain infrastructure security</article-title>
          .
          <source>CoRR</source>
          , abs/
          <year>1905</year>
          .04412,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <article-title>[12] Integrating the Healthcare Enterprise IHE</article-title>
          .
          <source>Audit Trail and Node Authentication</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Intel</surname>
          </string-name>
          .
          <article-title>Trusted time and monotonic counters with intel software guard extensions platform services</article-title>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>Ramya</given-names>
            <surname>Jayaram</surname>
          </string-name>
          <string-name>
            <surname>Masti</surname>
          </string-name>
          , Claudio Marforio, and
          <string-name>
            <given-names>Srdjan</given-names>
            <surname>Capkun</surname>
          </string-name>
          .
          <article-title>An architecture for concurrent execution of secure environments in clouds</article-title>
          .
          <source>In Proceedings of the 2013 ACM Workshop on Cloud Computing Security Workshop</source>
          , CCSW '
          <volume>13</volume>
          , pages
          <fpage>11</fpage>
          {
          <fpage>22</fpage>
          , New York, NY, USA,
          <year>2013</year>
          . ACM.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Leslie</surname>
            <given-names>Lamport</given-names>
          </string-name>
          , Robert Shostak, and
          <string-name>
            <given-names>Marshall</given-names>
            <surname>Pease</surname>
          </string-name>
          .
          <article-title>The byzantine generals problem</article-title>
          .
          <source>ACM Transactions on Programming Languages and Systems (TOPLAS)</source>
          ,
          <volume>4</volume>
          (
          <issue>3</issue>
          ):
          <volume>382</volume>
          {
          <fpage>401</fpage>
          ,
          <year>1982</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <surname>Joshua</surname>
            <given-names>Lind</given-names>
          </string-name>
          , Ittay Eyal, Florian Kelbert, Oded Naor,
          <string-name>
            <surname>Peter R. Pietzuch</surname>
          </string-name>
          , and Emin Gun Sirer.
          <article-title>Teechain: Scalable blockchain payments using trusted execution environments</article-title>
          .
          <source>ArXiv, abs/1707.05454</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>P.</given-names>
            <surname>Maene</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Gotzfried</surname>
          </string-name>
          , R. de Clercq,
          <string-name>
            <given-names>T.</given-names>
            <surname>Muller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Freiling</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and I.</given-names>
            <surname>Verbauwhede</surname>
          </string-name>
          .
          <article-title>Hardware-based trusted computing architectures for isolation and attestation</article-title>
          .
          <source>IEEE Transactions on Computers</source>
          ,
          <source>PP(99):1{1</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>Lorenzo</surname>
            <given-names>Martignoni</given-names>
          </string-name>
          , Roberto Paleari, and
          <string-name>
            <given-names>Danilo</given-names>
            <surname>Bruschi</surname>
          </string-name>
          . Conqueror:
          <article-title>Tamper-proof code execution on legacy systems</article-title>
          .
          <source>In Proceedings of the 7th International Conference on Detection of Intrusions and Malware, and Vulnerability Assessment</source>
          ,
          <source>DIMVA'10</source>
          , pages
          <fpage>21</fpage>
          {
          <fpage>40</fpage>
          , Berlin, Heidelberg,
          <year>2010</year>
          . Springer-Verlag.
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <surname>Frank</surname>
            <given-names>McKeen</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Ilya</given-names>
            <surname>Alexandrovich</surname>
          </string-name>
          , Alex Berenzon, Carlos V Rozas, Hisham Shafi, Vedvyas Shanbhogue, and
          <string-name>
            <surname>Uday R Savagaonkar.</surname>
          </string-name>
          <article-title>Innovative Instructions and Software Model for Isolated Execution</article-title>
          .
          <source>In Proceedings of the 2nd International Workshop on Hardware and Architectural Support for Security and Privacy</source>
          ,
          <string-name>
            <surname>HASP</surname>
          </string-name>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>Satoshi</given-names>
            <surname>Nakamoto</surname>
          </string-name>
          et al.
          <article-title>Bitcoin: A peer-to-peer electronic cash system</article-title>
          .
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          <source>[21] German Ministry of Health. Report on patients accessing health services</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <surname>Muhammad</surname>
            <given-names>Saad</given-names>
          </string-name>
          , Jeffrey Spaulding, Laurent Njilla, Charles A.
          <string-name>
            <surname>Kamhoua</surname>
            , Sachin Shetty, DaeHun Nyang, and
            <given-names>Aziz</given-names>
          </string-name>
          <string-name>
            <surname>Mohaisen</surname>
          </string-name>
          .
          <article-title>Exploring the attack surface of blockchain: A systematic overview</article-title>
          . CoRR, abs/
          <year>1904</year>
          .03487,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <surname>Pramod</surname>
            <given-names>Subramanyan</given-names>
          </string-name>
          , Rohit Sinha, Ilia Lebedev, Srinivas Devadas, and
          <string-name>
            <surname>Sanjit</surname>
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Seshia</surname>
          </string-name>
          .
          <article-title>A formal foundation for secure remote execution of enclaves</article-title>
          .
          <source>In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, CCS '17</source>
          , pages
          <fpage>2435</fpage>
          {
          <fpage>2450</fpage>
          , New York, NY, USA,
          <year>2017</year>
          . ACM.
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>Paul J.</given-names>
            <surname>Taylor</surname>
          </string-name>
          , Tooska Dargahi, Ali Dehghantanha,
          <string-name>
            <surname>Reza M. Parizi</surname>
          </string-name>
          , and
          <string-name>
            <surname>Kim-Kwang Raymond Choo</surname>
          </string-name>
          .
          <article-title>A systematic literature review of blockchain cyber security</article-title>
          .
          <source>Digital Communications and Networks</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          [25]
          <string-name>
            <given-names>UK</given-names>
            <surname>Government</surname>
          </string-name>
          <article-title>Office for Science</article-title>
          .
          <source>Distributed Ledger Technology: beyond block chain</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          [26]
          <string-name>
            <surname>Rui</surname>
            <given-names>Yuan</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yu-Bin</surname>
            <given-names>Xia</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hai-Bo</surname>
            <given-names>Chen</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bin-Yu Zang</surname>
            , and
            <given-names>Jan</given-names>
          </string-name>
          <string-name>
            <surname>Xie</surname>
          </string-name>
          . Shadoweth:
          <article-title>Private smart contract on public blockchain</article-title>
          .
          <source>Journal of Computer Science and Technology</source>
          ,
          <volume>33</volume>
          (
          <issue>3</issue>
          ):
          <volume>542</volume>
          {
          <fpage>556</fpage>
          , May
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>