Application of Validation Obligations to Security Concerns

Our lives become increasingly dependent on safety- and security-critical systems, so formal techniques are advocated for engineering such systems. One of such techniques is validation obligations that enable formalizing requirements early in development to ensure their correctness. Furthermore, validation obligations help hold requirements consistent in an evolving model and create assurances about the model's completeness. Although initially proposed for safety properties, this paper shows how the technique of validation obligations enables us to also reason about security concerns through an example from the medical domain.


Introduction
As software systems become more and more responsible for our daily life experiences, it is natural to discuss how to engineer them to ensure their safety and security. Both safety and security are already mature disciplines, and individual processes for dealing with the domain-specific problems are available such as attack trees [14] for security concerns or model checking [7] for safety properties. However, as pointed out in literature (e.g., see [3,11]), there are a limited amount of cross-cutting techniques available at our disposal, which are capable of being used effectively in both domains.
A validation obligation (VO) [10] is a logical formula associated with the correctness claim of a given validation property. This technique helps formalize and validate software systems, thus ensuring their overall correctness. While initially proposed for the safety domain, we believe VOs are equally beneficial for validating security concerns in software systems. The benefit of applying VOs to assert the correctness of security concerns lies within the unified approach offered by VOs for modeling all sorts of proprieties, e.g., safety, security, and functional properties. In this fashion, we do not need individual correctness assurance approaches for each set of requirements, which can cause problems while keeping the model consistent. VOs, substantiated with multiple formal techniques, offer a property-agnostic approach for checking completeness and conflict freeness of models.
This paper aims to investigate the application of VOs for the correctness assurance of security concerns. The rest of the paper is structured as follows: Section 2 discusses the Event-B method -the formal method we have used in our approach. Next, Section 3 introduces the idea of VOs. Then, we exemplify the application of VOs to security concerns in Section 4 using an example from the medical domain. Next, Section 5 compares the current approaches with VOs for formal modeling of security-critical systems. Finally, we conclude the paper in Section 6 with an outlook on future work.

The Event-B method
State-based formal methods [9] enable modeling systems with a strict formal syntax, thus allowing to establish correctness assurance with techniques like model checking and theorem proving. This establishes the model's consistency and shows that the model does not lead to a faulty state. Furthermore, statebased formal methods follow the correct-by-construction approach meaning that the model is incrementally enriched with behavior while the correctness of each step is ensured.
One of the well-known state-based formal methods is Event-B [1]. In Event-B states are made up of variables that are constrained by invariants. Events define transitions between the states. A model can be refined via the refines keyword. This means the original specification is advanced concerning variables or events. This refinement relationship, however, needs to be proven to ensure that existing model constraints are not violated in the process of refinement. This is done through proofs. contexts define the static elements of a model and are seen by machines defining the dynamic behavior.

Validation obligations
A VO is composed of a model and a validation task (VT) that must be successfully executed on the model. Once a VT is successfully executed, it establishes the presence of the associated requirement. A VT comes in different forms, e.g., (LTL) model-checking, proof obligations (POs), or even manual inspection of the state space. The input parameters of each VT depend upon the associated requirement. For example, for the LTL model checking, the VT gets an LTL formula as an input parameter. It is the judgment of the designer which VT is best suited to the cause and what are its appropriate parameters. Following is the formal definition of a VO: As a VO is assigned to a requirement, an id uniquely identfies it. The assigned VT has also an id to identify it. In the area of VOs context refers not to the context of machines as defined earlier but to the context the VO is applied in, i.e., the model we investigate. Second last is the applied technique, e.g., model checking, and last are the input parameters, e.g., the LTL formula.
The concept of VOs should be seen as a carrier technology. It is not bound to a particular formal method. In fact, VOs can be applied to all state-based formal methods alike. In this paper, however, we use Event-B only to exemplify the proposed approach. Following that, we argue that we can validate everything we explicitly model.
The power of VOs comes from three aspects.

Application of VOs to security concerns
We now show the application of VOs to establish the correctness of security concerns through the example of a hemodialysis machine model. As aforementioned, we believe that security concerns can be treated like other properties when developing models, which is an advantage as there is no need for their special treatment, thus making the overall modeling process simpler.

Illustrative example
Hemodialysis is a medical treatment that uses a device to clean the blood. The hemodialysis device transports the blood from and to the patient, filters waste and salts from the blood, and regulates the fluid level of the blood. Due to the involved complexity of the dialysis process, the resulted medical treatment is monitored by a professional caregiver for treatment compliance and desired output. Traditionally hemodialysis is performed in a standalone mode, i.e., patients come to a medical facility, get connected to the device, and let dialysis be performed. However, this monitoring is also possible via remote access but demands additional security precautions. The basic architecture of hemodialysis machines is depicted in Figure 1. The requirements specification of hemodialysis machines is discussed in detail in the work of Mashkoor [8]. We first design an abstract model and then refine it to show that VOs can be used to gain confidence in the soundness and conflict freeness of the requirements. We then extend the example a second time to show the advantages of creating views on a model. Creating a view means in our context that we keep the abstract model in the background but only focus on one detailed aspect of the model at a time. This helps better understand a model's behavior or debug it by only viewing what is necessary to satisfy a particular requirement.

Formal model
We start the modeling process with a small subset of the hemodialysis machine requirements specification. We also add some additional security concerns as follows.
-SAF1: In order to start the treatment, the parameters must be within the permissible range. -FUN1: There are three types of staff IDs: maintenance, nurses, and doctors.
-SEC1: The staff has to log in to start the treatment.
-SEC2: Only doctors and nurses are allowed to start the treatment. Figure 2a shows the base model of the system. It models the SAF1 safety requirement. In the original specification multiple parameters depending on the patients condition can be set thus ensuring a personalized treatment. SAF1 is an abstract reference to that, we enter a treatment value which serves as a token  for more complex parameters requiered in the original specification. We model SAF1 along with the SEC1 security requirement. There is an Event-B context ctx modeling the login status. The corresponding machine m1 models two events: login and startSystem. Guards, namely @grd1 and @grd2, of the startSystem event prevent the event from being fired prematurely. Figure 2b shows how the model looks after the refinement. It introduces FUN1 and SEC2 requirements into the model. We add roles as data type in the refined context ctx1 and configure the set of roles that are allowed to perform a treatment in @inv4. The login event ensures that the role logged into the system is now tracked via id. @grd3 in startSystem checks that only allowed ids are able to start the treatment. Also note that the startSystem event in m2 extends the event from m1 meaning that @grd1 and @grd2 are still present and active but are hidden form this view of the model to avoid confusion.

Ensuring soundness and conflict freeness of requirements
To each requirement, we associate a VT with which we ensure the presence of this requirement in the model. The VTs can be formulated as: -SAF1/m1/PO: treatmentParameters ∈ 1..5 -SEC1/m1/LTL:G({loggedIn = yes} ⇒ e(startSystem)) 1 PO means we have a proof obligation that treatmentParameters ∈ 1..5 is true in every state of the model, meaning the patients treatment parameters are within the allowed range. For the LTL formula G(lobally) means the condition in the brackets is always true. The term inside states that when loggedIn = yes the event startSystem is enabled. m1 is the model or in our case the machine we apply the VT to as laid out in Section 3.
The proof of the VT for SAF1 is relatively simple. We can use the Event-B tool support, i.e., the Rodin platform [2], to show that @inv1 holds in every state of the model. The proof can be discharged automatically by the tool. The VT regarding SEC1 was established using the LTL formula with the ProB [7] model checker, which we employed to do LTL model checking of the model. With both VOs discharged, we can be confident that the concerning requirements are correctly modeled. Now we tackle FUN1 and SEC2. For those requirements we write the following VTs: We demand proof that the set of roles consists only of doctors, nurses, and maintenance for FUN1. For SEC2 we demand that globally the system can only be started if the logged-in role is registered in the set of roles that are allowed to perform treatment, i.e., doctors or nurses. Again with the help of the corresponding tools, we see that both VTs on the model are executed and satisfied, thus ensuring the soundness of the model m2 regarding the requested requirements, i.e., FUN1 and SEC2. However, if we run our VTs for SEC1 and SAF1 previously established on m1 on m2 to ensure that these requirements are also present in the refinement, we spot a problem. The VT representing SEC1 fails. We can find an instance where we are logged into the system but not allowed to start the treatment. This is the case with the login of the maintenance role.
A failing VT helps us discover a flawed requirement/design in the model, provided that the task was correctly chosen and the parameter was correctly formulated. In our example the requirement encoded as the VT for SAF1 is no longer satisfiable as loggedIn = yes is no longer sufficient for starting the system. We could draw three consequences from this: 1. Requirements SEC1 and SEC2 may be contradicting each other. However, this is is not the case here. 2. We could adjust the model by removing the event guard that controls the startSystem event allowing every loggedIn person to start treatment. However, this will lead SEC2 to fail; hence the formulation of the requirement as a VO prevented us from introducing new bugs when trying to fix the existing ones. 3. Requirements SEC1 and SEC2 are ambiguous in how they are formulated and need to be clarified. In our case, SEC1 is indeed very broad. We can solve the issue by either making SEC1 more explicit by stating that the allowed staff has to be logged in or merging the requirement entirely with SEC2.
In our example, we settle for option (3) to clarify requirements: we refactor the corresponding VO, and the fixed VO passes without any new conflict.

Creating views
Different views help designers spot flaws in the model or help non-technical stakeholders better understand the model. Views are a unique form of refinement that aims not to introduce new behavior but to how the model is perceived. VOs help create views by showing their soundness and conflict freeness. However, views affect the associated VT, i.e., the model changes, and the output which decides VT's success or failure also changes accordingly. While the output of a VT is more concrete on an instantiation view, and thus, depending on the task, it can provide a concrete example of why the VT succeeds or fails. The stakeholders can then easily understand the scenario. The knowledge gained from the view can be feedback on the requirements of the model and may result in new VOs to ensure the presence of the emerging requirements.
Creating a scenario-view in Event-B is achieved by replacing deferred constructs with concrete ones, thus adapting the model for a specific scenario. Let us consider our hemodialysis example again. Figure 3 shows a created view. Instead of reusing a deferred function where we map arbitrary ids to roles as we did in INITIALISATION/@act4 of m2 we use concrete mappings as one can see in @act4 of theINITIALISATION of m2Concrete. We successfully execute the VTs and establish conflict freeness and soundness of the requirements for this view.
The state-space of the model m2Concrete is visualized in Figure 4 2 . It shows two states. One can switch between the states via logging in as a different user or looping back to them by logging in as the same user. From this view, the stakeholder may discover a flaw in the model, for example, the fact that startSystem in the upper state is a loop that always ends in the same state. The consequence of this is that after startSystem was fired by the logged-in role, the logged-in role can be changed. For further treatment, this might be unwanted as the responsible role should not be changed mid-session, nor should the maintenance be able to log in after treatment is started. From this we can formulate a new requirement, for example: -FUN2 Once the treatment is started, the logged in ID can not change.
This requirement can then be encoded into a VO and run against the original model m2. A VT for this requirement could look like this: This formula would check that after the firing of the startSystem event, the login event cannot occur, of course, until the treatment is over.
We can go even a step further. Suppose we find a property of a scenario desirable for all scenarios that are created in the same way, i.e., by using the concrete mapping of ids to roles we used in the example. In that case, we can translate this property into a VO that has to hold for all scenarios that are created, relying on this mapping for initializing the treatmentAllowed variable. Every time we create a scenario view the same way, it must comply with this VO.

Related work
The Tokeneer case study [12] is a well-known example of the application of formal methods to the security domain. Tokeener is an extensive system that provides safety for a network of workstations in a protected room, which can only be entered via verified bio-metric scans and id cards. In addition, the Tokeneer system has the task of verifying access for persons and checking certificates for credentials. The case study was modeled in different languages like the modeling language Z [4]. For this implementation, there exist several approaches to verify the system, e.g., Cristiá and Rossi [5]. The specification was also translated from Z to Event-B by Rivera et al. [13]. While these contributions show that formal methods can be successfully applied to help design and implement securitycritical systems, they only tackle the problem from the verification side. The question of validation is mainly unaddressed.
VOs aim to complement by showing that the actual requirements specified by stakeholders are present in the model. Up to now, many techniques in formal methods have aimed to show the absence of faulty behavior. For example, model checking traverses the state space to check if a state violates a previously defined invariant. Another example is proofs that can show if the access to data structures is well defined. However, verification, i.e., checking whether faulty behavior is absent in the model, is not enough as a designer has no feedback on what the model is capable of. For this, we need validation, and while there exist validation approaches, e.g., proposed by Fitzgerald et al. [6], these are tool and languagespecific. That is where VOs are a valuable addition, as they provide a tool and language-independent formalism. Requirements are formulated as VOs, which evolve with the model while remaining traceable. Additionally, different model views enable other stakeholders to understand the model and reason about the requirements relevant to them without going into unnecessary details.

Conclusion and future work
This paper shows how the VO approach can validate security concerns alongside safety and functional properties in a formal model. A uniform approach for validating different system properties is a big plus, thus making the overall development process more straightforward. Furthermore, the VO approach helps spot conflicting requirements and existing bugs and prevents from introducing the new ones. Additionally, we can create views on a model that facilitate the model's understanding by all stakeholders. From views, we can extract knowledge that we can feedback into the model. Finally, we can formulate VOs that describe the scenario's desired outcomes, thus ensuring compliance for the whole development cycle.
In the future, we want to apply the VO approach to large-scale case studies and show the multitude of VOs in different settings. In such a study, we would like to investigate the following research questions: -What are the limitations of the VO approach? -Is the VO approach equally beneficial to formal methods which are not statebased? -How does the approach scale in large-scale case studies?