The B2Scala Tool: Integrating Bach in Scala with Security in Mind
Doha Ouardi, Manel Barkallah, Jean-Marie Jacquet · 2024
Read The B2Scala Tool: Integrating Bach in Scala with Security in Mind by Doha Ouardi, Manel Barkallah, Jean-Marie Jacquet (2024) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2412-08235.txt.
Introduction
Doha Ouardi, Manel Barkallah, and Jean-Marie Jacquet introduce a software tool called B2Scala in this 2024 paper. The tool brings Bach, a small language for programs that share data through a common space, into the Scala programming language. Programs written this way pass notes by placing and reading items in the shared space rather than sending direct messages.
The authors also add a logic that limits program runs to those that meet stated rules. As a test, they model a classic security protocol with two parties and a secret exchange. Their setup found again, on its own, the well-known man-in-the-middle attack on that protocol.
Catalog record
| CREATOR | Doha Ouardi, Manel Barkallah, Jean-Marie Jacquet |
|---|---|
| YEAR | 2024 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 53 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2412-08235
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
The B2Scala Tool: Integrating Bach in Scala with Security in Mind Doha Ouardi, Manel Barkallah, Jean-Marie Jacquet Abstract Process algebras have been widely used to verify security protocols in a formal manner. However they mostly focus on synchronous communication based on the exchange of messages. We present an alternative approach relying on asynchronous communication obtained through information available on a shared space. More precisely this paper first proposes an embedding in Scala of a Linda-like language, called Bach. It consists of a Domain Specific Language, internal to Scala, that allows us to experiment programs developed in Bach while benefiting from the Scala eco-system, in particular from its type system as well as program fragments developed in Scala. Moreover, we introduce a logic that allows to restrict the executions of programs to those meeting logic formulae. Our work is illustrated on the Needham-Schroeder security protocol, for which we manage to automatically rediscover the man-in-the-middle attack first put in evidence by G. Lowe. 1 Introduction Besides the use of theorem provers, process algebras have been widely used to verify security protocols in a formal manner. A seminal effort in this direction is reported in [ 20 ] . There the author illustrates how modeling in CSP [ 13 ] and utilizing the FDR tool [ 11 ] can be used to produce an attack on the Needham-Schroeder protocol. As another example, the article [ 3 ] demonstrates how state reduction techniques can be applied to analyze a model of the Bilateral Key Exchange protocol written in mCRL [ 7 ] . In these two cases the models rely on synchronous communication obtained by the exchange of messages. Although this type of communication has been fundamental in the theory of concurrency and has consequently benefited from extensive research support, it is not necessarily intuitive for analyzing security protocols. Indeed, the idea of exchanging messages in a synchronous manner between partners rests on the assumption that the communication takes place instantaneously on agreed actions and thus does not naturally leave room for an intruder to intercept messages. As an evidence at the programming level, in the above two pieces of work, this has lead the authors to duplicate the exchange of messages in their model. Another path of research has been initiated by Gelernter and Carriero, who advocated in [ 10 ] that a clear separation between the interactional and the computational aspects of software components has to take place in order to build interactive distributed systems. Their claim has been supported by the design of a model, Linda [ 4 ] , originally presented as a set of inter-agent communication primitives which may be added to almost any programming language. Besides process creation, this set includes primitives for adding, deleting, and testing the presence/absence of data in a shared dataspace. In doing so they proposed a new form of synchronization of processes, occurring asynchronously, through the availability or absence of pieces of information on a shared space. A number of other models, now referred to as coordination models, have been proposed afterwards. These models seem highly attractive to us because, in practice, message exchanges do not occur atomically through the synchronous communication of actors. Instead, they must happen through a medium – such as a network – which can be easily modeled as a shared space. The aim of this paper is to explore how coordination models can be used to analyze security protocols. More concretely, we will focus on a specific coordination model, named Bach, will derive a tool, named B2Scala, and will employ it to produce the attack on the Needham-Schroeder protocol [ 21 ] first put in evidence by G. Lowe (see [ 20 ] ). Implementing coordination models can be done in three different ways. First, as illustrated by Tucson [ 8 ] , one may provide an implementation as a stand alone language. This has the advantage of offering support for a complete algebra-like incarnation of Linda but at the expense of having to re-implement classical programming constructs that are proposed in conventional languages (like variables, loops, lists, …). The second approach, illustrated by pSpaces [ 19 ] is to provide a set of APIs in a conventional language in order to access the shared space through dedicated functions or methods. This approach benefits from the converse characteristics of the first one: it is easy to access classical programming constructs but the abstract control flow that is offered at a process algebraic level, like non-deterministic choice and parallel composition, is to be coded in an ad hoc manner. Finally, a third approach consists in using a domain specific language embedded inside an existing language. We will turn to this approach since, in principle, it enjoys the benefits of the first two approaches. More specifically, this paper proposes to embody the Bach coordination language inside Scala. In doing so we will profit from the Scala eco-system while benefiting from all the abstractions offered by the Bach coordination language. A key feature is that we will interpret control flow structures, which we put in good use to restrict computations to those verifying logic formulae. As an interesting consequence, we shall be able to produce the man-in-the-middle attack of the Needham-Schroeder security protocol first put in evidence by G. Lowe. The rest of the paper is structured as follows. Section 2 presents the Needham-Schroeder use-case as well as the Bach and Scala languages. Section 3 describes the B2Scala tool, both from the point of view of its usage by programmers and from the implementation point of view. A logic is proposed in Section 4 together with its effect on reducing executions. Section 5 illustrates how B2Scala coupled to constraint executions can be used to analyze the Needham-Schroeder protocol. Finally Section 6 draws our conclusions and compares our work with related work. 2 Background 2.1 Use-case: the Needham-Schroeder Protocol The Needham-Schroeder protocol, developed by Roger Needham and Michael Schroeder in 1978 [ 21 ] , is a pioneering cryptographic solution aimed at ensuring secure authentication and key distribution within network environments. Its primary objective is to establish a shared session key between two parties, typically referred to as the principal entities, facilitating encrypted communication to safeguard data confidentiality and integrity. The protocol unfolds in a series of steps: initialization, where a client (A) requests access to another client (B) from a trusted server (S), followed by the server’s response, which involves authentication, session key generation, and ticket encryption. Subsequently, communication with party B ensues, facilitated by the transmission of the encrypted ticket, along with nonces to ensure freshness. Parties exchange messages encrypted with the session key and incorporate nonces to prevent replay attacks. Mutual authentication is achieved through encrypted messages exchanged between A and B, leveraging the established session key and nonces. Despite its early contributions, the original protocol exhibited vulnerabilities, notably the reflection attack. In response, refined versions have emerged, such as the Needham-Schroeder-Lowe [ 20 ] and Otway-Rees protocols [ 18 ] . The description of the Needham-Schroeder public key protocol is often slimmed down to the three following actions: \begin{array}[]{rcll}\mathit{Alice}\longrightarrow\mathit{Bob}&:&\mathit{message}(na:a)_{pkb}\\ \mathit{Bob}\longrightarrow\mathit{Alice}&:&\mathit{message}(na:nb)_{pka}\\ \mathit{Alice}\longrightarrow\mathit{Bob}&:&\mathit{message}(nb)_{pkb}\end{array} where each transition of the form X\rightarrow Y:m represents message m being sent from X to Y