Cybersecurity for IoT: Verify your Software Today! Allan Blanchard, - - PowerPoint PPT Presentation

cybersecurity for iot verify your software today
SMART_READER_LITE
LIVE PREVIEW

Cybersecurity for IoT: Verify your Software Today! Allan Blanchard, - - PowerPoint PPT Presentation

Cybersecurity for IoT: Verify your Software Today! Allan Blanchard, Nikolai Kosmatov (based on a tutorial prepared with Frdric Loulergue) Outline Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive


slide-1
SLIDE 1

Cybersecurity for IoT: Verify your Software Today!

Allan Blanchard, Nikolai Kosmatov (based on a tutorial prepared with Frédéric Loulergue)

slide-2
SLIDE 2

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 2 / 48

slide-3
SLIDE 3

Introduction Security in the IoT

Outline

Introduction Security in the IoT An overview of Frama-C The Contiki operating system Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 3 / 48

slide-4
SLIDE 4

Introduction Security in the IoT

Internet of Things

(c) Internet Security Buzz

◮ connect all devices

and services

◮ 46 billions devices by

2021

◮ transport huge

amounts of data

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 4 / 48

slide-5
SLIDE 5

Introduction Security in the IoT

And Security?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 5 / 48

slide-6
SLIDE 6

Introduction Security in the IoT

And Security?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 5 / 48

slide-7
SLIDE 7

Introduction Security in the IoT

And Security?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 5 / 48

slide-8
SLIDE 8

Introduction Security in the IoT

And Security?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 5 / 48

slide-9
SLIDE 9

Introduction Security in the IoT

And Security?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 5 / 48

slide-10
SLIDE 10

Introduction An overview of Frama-C

Outline

Introduction Security in the IoT An overview of Frama-C The Contiki operating system Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 6 / 48

slide-11
SLIDE 11

Introduction An overview of Frama-C

Frama-C Open-Source Distribution

Framework for Analysis of C source code http://frama-c.com

◮ offers a specification language called ACSL ◮ targets both academic and industrial usage

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 7 / 48

slide-12
SLIDE 12

Introduction An overview of Frama-C

Frama-C, a Collection of Tools

Several tools inside a single platform

◮ plugin architecture like in Eclipse

◮ over 20 plugins in the open-source distribution ◮ also close-source plugins, either at CEA (about 20) or outside

◮ a common kernel

◮ provides a uniform setting ◮ provides general services

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 8 / 48

slide-13
SLIDE 13

Introduction An overview of Frama-C

Plugin Gallery

Plugins Dynamic Analysis PathCrawler E-ACSL StaDy Sante Ltest Specification Generation RTE Aora¨ ı Formal Methods Deductive Verification Wp Jessie Abstract Interpretation Eva Code Transformation Semantic constant folding Clang Sparecode Slicing Browsing of unfamiliar code Callgraph Scope & Data-flow browsing Occurrence Impact Metrics

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 9 / 48

slide-14
SLIDE 14

Introduction An overview of Frama-C

Use the Right Tool for the Right Task

We may want to assure different degrees of confidence:

◮ absence of runtime errors or functional correctness ◮ partial/complete analysis (testing vs. verification)

Different tools require from us more or less work:

◮ Just provide the source code ◮ Configure tool parameters ◮ Provide code annotations

The higher the confidence is, the more information we have to provide

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 10 / 48

slide-15
SLIDE 15

Introduction The Contiki operating system

Outline

Introduction Security in the IoT An overview of Frama-C The Contiki operating system Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 11 / 48

slide-16
SLIDE 16

Introduction The Contiki operating system

A lightweight OS for IoT

Contiki is a lightweight operating system for IoT It provides a lot of features:

◮ (rudimentary) memory and process management ◮ networking stack and cryptographic functions ◮ ...

Typical hardware platform:

◮ 8, 16, or 32-bit MCU (little or big-endian), ◮ low-power radio, some sensors and actuators, ...

Note for security: there is no memory protection unit.

ms Group
  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 12 / 48

slide-17
SLIDE 17

Introduction The Contiki operating system

Contiki: Typical Applications

◮ IoT scenarios: smart cities, building automation, ... ◮ Multiple hops to cover large areas ◮ Low-power for battery-powered scenarios ◮ Nodes are interoperable and addressable (IP) 5

SicsthSense SICS Networked Embedded Systems Group

5

Light bulbs Thermostat Power sockets CO2 sensors Door locks Smoke detectors … Traffjc lights Parking spots Public transport Street lights Smart metering …

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 13 / 48

slide-18
SLIDE 18

Verification of absence of runtime errors using Frama-C/Eva Runtime errors and the Eva plugin

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Runtime errors and the Eva plugin Simple Example An application to Contiki Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 14 / 48

slide-19
SLIDE 19

Verification of absence of runtime errors using Frama-C/Eva Runtime errors and the Eva plugin

Runtime errors

Runtime errors in C are undefined behaviors:

◮ out-of-bound accesses, ◮ integer overflows, ◮ division by 0, ◮ invalid pointers ◮ . . .

They can raise important security issues

◮ For example, HeartBleed vulnerability (found in 2014 in OpenSSL)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 15 / 48

slide-20
SLIDE 20

Verification of absence of runtime errors using Frama-C/Eva Runtime errors and the Eva plugin

Value Analysis Overview

Compute possible values of variables at each program point

◮ an automatic analysis based on abstract interpretation ◮ computes a correct over-approximation ◮ reports alarms for potential runtime errors ◮ reports alarms for potentially invalid annotations ◮ can prove the absence of runtime errors ◮ graphical interface: displays the domains of each variable

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 16 / 48

slide-21
SLIDE 21

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Runtime errors and the Eva plugin Simple Example An application to Contiki Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 17 / 48

slide-22
SLIDE 22

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Example 1

Run Eva: frama-c-gui div1.c -val -main=f int f ( int a ) { int x, y; int sum, result; if(a == 0){ x = 0; y = 0; }else{ x = 5; y = 5; } sum = x + y; // sum can be 0 result = 10/sum; // risk of division by 0 return result; }

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 18 / 48

slide-23
SLIDE 23

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Example 1

Run Eva: frama-c-gui div1.c -val -main=f int f ( int a ) { int x, y; int sum, result; if(a == 0){ x = 0; y = 0; }else{ x = 5; y = 5; } sum = x + y; // sum can be 0 result = 10/sum; // risk of division by 0 return result; } Risk of division by 0 is detected, it is real.

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 18 / 48

slide-24
SLIDE 24

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Example 2

Run Eva: frama-c-gui div2.c -val -main=f int f ( int a ) { int x, y; int sum, result; if(a == 0){ x = 0; y = 5; }else{ x = 5; y = 0; } sum = x + y; // sum cannot be 0 result = 10/sum; // no div. by 0 return result; }

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 19 / 48

slide-25
SLIDE 25

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Example 2

Run Eva: frama-c-gui div2.c -val -main=f int f ( int a ) { int x, y; int sum, result; if(a == 0){ x = 0; y = 5; }else{ x = 5; y = 0; } sum = x + y; // sum cannot be 0 result = 10/sum; // no div. by 0 return result; } Risk of division by 0 is detected, but it is a false alarm.

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 19 / 48

slide-26
SLIDE 26

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Eva Parameterization

◮ Eva is automatic, but can be imprecise due to over-approximation ◮ a fine-tuned parameterization for a trade-off precision / efficiency

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 20 / 48

slide-27
SLIDE 27

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Example 2, cont’d

Run Eva: frama-c-gui div2.c -val -main=f -slevel 2 int f ( int a ) { int x, y; int sum, result; if(a == 0){ x = 0; y = 5; }else{ x = 5; y = 0; } sum = x + y; // sum cannot be 0 result = 10/sum; // no div. by 0 return result; }

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 21 / 48

slide-28
SLIDE 28

Verification of absence of runtime errors using Frama-C/Eva Simple Example

Example 2, cont’d

Run Eva: frama-c-gui div2.c -val -main=f -slevel 2 int f ( int a ) { int x, y; int sum, result; if(a == 0){ x = 0; y = 5; }else{ x = 5; y = 0; } sum = x + y; // sum cannot be 0 result = 10/sum; // no div. by 0 return result; } Absence of division by 0 is proved, no false alarm.

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 21 / 48

slide-29
SLIDE 29

Verification of absence of runtime errors using Frama-C/Eva An application to Contiki

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Runtime errors and the Eva plugin Simple Example An application to Contiki Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 22 / 48

slide-30
SLIDE 30

Verification of absence of runtime errors using Frama-C/Eva An application to Contiki

Overview of the aes-ccm Modules

◮ Critical! – Used for communication security

◮ end-to-end confidentiality and integrity

◮ Advanced Encryption Standard (AES): a symmetric encryption algo.

◮ AES replaced in 2002 Data Encryption Standard (DES)

◮ Modular API – independent from the OS ◮ Two modules:

◮ AES-128 ◮ AES-CCM* block cypher mode ◮ A few hundreds of LoC

◮ High complexity crypto code

◮ Intensive integer arithmetics ◮ Intricate indexing ◮ based on multiplication over finite field GF(28)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 23 / 48

slide-31
SLIDE 31

Verification of absence of runtime errors using Frama-C/Eva An application to Contiki

Example 3

We analyze two versions of a part of the aes module

◮ frama-c-gui aes1.c -val ◮ frama-c-gui aes2.c -val

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 24 / 48

slide-32
SLIDE 32

Deductive verification using Frama-C/WP Functional properties and the WP plugin

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Functional properties and the WP plugin An application to Contiki Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 25 / 48

slide-33
SLIDE 33

Deductive verification using Frama-C/WP Functional properties and the WP plugin

Functional properties

With Eva, we can prove that no bad things can happen Can we go further and prove that good things will eventually happen?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 26 / 48

slide-34
SLIDE 34

Deductive verification using Frama-C/WP Functional properties and the WP plugin

Functional properties

With Eva, we can prove that no bad things can happen Can we go further and prove that good things will eventually happen?

Yes!

◮ we have to define what we mean by “good things” ◮ we still have to show that no bad things happen Legend: Bad things = runtime errors, good things = expected behavior

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 26 / 48

slide-35
SLIDE 35

Deductive verification using Frama-C/WP Functional properties and the WP plugin

Objectives of Deductive Verification

Rigorous, mathematical proof of semantic properties of a program

◮ functional properties ◮ absence of runtime errors ◮ termination

Requires some extra work from us to define the expected properties...

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 27 / 48

slide-36
SLIDE 36

Deductive verification using Frama-C/WP Functional properties and the WP plugin

WP plugin

◮ Modular deductive verification (function by function) ◮ Input: a program and its specification written in ACSL ◮ If the proof succeeds, the program respects the given specification

◮ Does it mean that the program is correct?

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 28 / 48

slide-37
SLIDE 37

Deductive verification using Frama-C/WP Functional properties and the WP plugin

WP plugin

◮ Modular deductive verification (function by function) ◮ Input: a program and its specification written in ACSL ◮ If the proof succeeds, the program respects the given specification

◮ Does it mean that the program is correct? ◮ NO! If the specification is wrong, the program can be wrong!

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 28 / 48

slide-38
SLIDE 38

Deductive verification using Frama-C/WP Functional properties and the WP plugin

Function contracts

◮ Goal: specification of imperative functions ◮ Approach: give assertions (i.e. properties) about the functions

◮ Precondition is supposed to be true on entry (ensured by the caller) ◮ Postcondition must be true on exit (ensured by the function)

◮ Nothing is guaranteed when the precondition is not satisfied

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 29 / 48

slide-39
SLIDE 39

Deductive verification using Frama-C/WP Functional properties and the WP plugin

Example 1

Run WP: frama-c-gui -wp -wp-rte all zeros.c

/∗@ requires n>=0 && \valid(t+(0..n−1)); assigns \nothing; ensures \result != 0 <==> (\forall integer j; 0 <= j < n ==> t[j] == 0); ∗/ int all zeros(int t[], int n) { int k; /∗@ loop invariant 0 <= k <= n; loop invariant \forall integer j; 0<=j<k ==> t[j]==0; loop assigns k; loop variant n−k; ∗/ for(k = 0; k < n; k++) if (t[k] != 0) return 0; return 1; }

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 30 / 48

slide-40
SLIDE 40

Deductive verification using Frama-C/WP An application to Contiki

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Functional properties and the WP plugin An application to Contiki Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 31 / 48

slide-41
SLIDE 41

Deductive verification using Frama-C/WP An application to Contiki

Overview of the memb Module

◮ No dynamic allocation in Contiki

◮ to avoid fragmentation of memory in long-lasting systems

◮ Memory is pre-allocated (in arrays of blocks) and attributed on

demand

◮ The management of such blocks is realized by the memb module

The memb module API allows the user to

◮ initialize a memb store (i.e. pre-allocate an array of blocks), ◮ allocate or free a block, ◮ check if a pointer refers to a block inside the store ◮ count the number of allocated blocks

We specified and verified the memb module with Frama-C/WP

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 32 / 48

slide-42
SLIDE 42

Deductive verification using Frama-C/WP An application to Contiki

The textual contract of memb alloc

  • 1. If the store is full, then leave it intact and return NULL (lines 12–15)
  • 2. If the store has a free block, then return a free block b such that:

◮ b is properly aligned in the block array (line 8) ◮ b was marked as free, and is now marked as allocated (line 7) ◮ b is valid, i.e. points to a valid memory space of a block size that can

be safely read or written to (line 10)

◮ the states of the other blocks have not changed (line 9) ◮ the number of free blocks is decremented (line 11)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 33 / 48

slide-43
SLIDE 43

Deductive verification using Frama-C/WP An application to Contiki

The contract of memb alloc

/∗@ requires valid memb(m); ensures valid memb(m); assigns m−>count[0 .. (m−>num − 1)]; behavior free found: assumes ∃Zi; 0 ≤ i <m−>num ∧m−>count[i] ==0; ensures ∃Zi; 0 ≤ i <m−>num ∧\old(m−>count[i]) ==0 ∧m−>count[i] ==1 ∧ \result ==(char∗) m−>mem + (i ∗ m−>size) ∧ ∀Zj; (0 ≤ j <i ∨i <j <m−>num) ⇒m−>count[j] ==\old(m−>count[j]); ensures \valid((char∗) \result + (0 .. (m−>size − 1))); ensures memb numfree(m) ==\old( memb numfree(m)) − 1; ensures memb allocated(m, \result); behavior full: assumes memb full(m); ensures ∀Zi; 0 ≤ i <m−>num ⇒m−>count[i] ==\old(m−>count[i]); ensures memb numfree(m) ==\old( memb numfree(m)); ensures \result ==NULL; complete behaviors; disjoint behaviors; ∗/ void ∗memb alloc(struct memb ∗m);

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 34 / 48

slide-44
SLIDE 44

Deductive verification using Frama-C/WP An application to Contiki

Other modules of Contiki analyzed with WP

Absence of security vulnerabilities coming from runtime errors :

◮ for several low-level modules of the core part of Contiki

Functional verification of the list module:

◮ a buggy function found and fixed ◮ different verification techniques studied and compared

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 35 / 48

slide-45
SLIDE 45

Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL An application to Contiki Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 36 / 48

slide-46
SLIDE 46

Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL

Completeness

A complete static analysis (for all inputs) can be hard and costly A partial, dynamic analysis (for selected inputs) is usually easier

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 37 / 48

slide-47
SLIDE 47

Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL

Objectives of E-ACSL

◮ E-ACSL is a runtime assertion checking tool

◮ detect runtime errors ◮ detect annotation failures ◮ treat a concrete program run (i.e. with concrete inputs)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 38 / 48

slide-48
SLIDE 48

Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL

E-ACSL plugin at a Glance

http://frama-c.com/eacsl.html

◮ Main idea: convert annotations into C code

int div(int x, int y) { /*@ assert y-1 != 0; */ return x / (y−1); } int div(int x, int y) { /*@ assert y-1 != 0; */ e acsl assert(y-1 != 0); return x / (y−1); }

E-ACSL

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 39 / 48

slide-49
SLIDE 49

Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL

E-ACSL plugin at a Glance

http://frama-c.com/eacsl.html

◮ Main idea: convert annotations into C code

int div(int x, int y) { /*@ assert y-1 != 0; */ return x / (y−1); } int div(int x, int y) { /*@ assert y-1 != 0; */ e acsl assert(y-1 != 0); return x / (y−1); }

E-ACSL

◮ The real translation is more complex than it may look

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 39 / 48

slide-50
SLIDE 50

Runtime Verification using Frama-C/E-ACSL An application to Contiki

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Dynamic analysis and E-ACSL An application to Contiki Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 40 / 48

slide-51
SLIDE 51

Runtime Verification using Frama-C/E-ACSL An application to Contiki

E-ACSL applied to the AES module

Remember our previous analysis on aes2.c ... We can check this at runtime: $ e-acsl-gcc.sh aes2.c --rte=all -c -Omonitored-aes2 $ ./monitored-aes2 $ ./monitored-aes2.e-acsl Assertion failed at line 37 in function aes_128_set_key. The failing predicate is: rte: mem_access: \valid_read(key + i). Abandon (core dumped)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 41 / 48

slide-52
SLIDE 52

Runtime Verification using Frama-C/E-ACSL An application to Contiki

Possible Usages in Combination with Other Tools

◮ check properties unproved by static analyzers (e.g. Eva, WP) ◮ check the absence of runtime errors ◮ check memory consumption and violations (use-after-free) ◮ help testing tools to check properties which are not easy to observe

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 42 / 48

slide-53
SLIDE 53

Conclusion

Outline

Introduction Verification of absence of runtime errors using Frama-C/Eva Deductive verification using Frama-C/WP Runtime Verification using Frama-C/E-ACSL Conclusion

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 43 / 48

slide-54
SLIDE 54

Conclusion

Conclusion

Frama-C allows us to:

◮ verify the absence of runtime errors with Eva ◮ formally specify functional properties with ACSL ◮ prove a program respects its specification with WP ◮ verify annotations at runtime or detect runtime errors with E-ACSL

All of these and much more inside Frama-C

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 44 / 48

slide-55
SLIDE 55

Conclusion

Conclusion

IoT software is critical

◮ Connected devices are used in many critical domains today ◮ Their usage is rapidly expanding

Formal verification tools can be helpful

◮ Verification tools have become more efficient in practice: faster

hardware, more memory...

◮ Formal methods are successfully used in several critical domains

(avionics, energy, rail,...)

◮ Applying formal methods improves software quality in 92% of projects

Source: Formal Methods Practice and Experiments, ACM Comp.Surveys

Verify your IoT software today!

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 45 / 48

slide-56
SLIDE 56

Conclusion

Further reading

User manuals:

◮ user manuals for Frama-C and its different analyzers, on the website:

http://frama-c.com

About the use of WP:

◮ Introduction to C program proof using Frama-C and its WP plugin

Allan Blanchard

https://allan-blanchard.fr/publis/frama-c-wp-tutorial-en.pdf

◮ ACSL by Example

Jochen Burghardt, Jens Gerlach

https://github.com/fraunhoferfokus/acsl-by-example

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 46 / 48

slide-57
SLIDE 57

Conclusion

Further reading

Tutorial papers:

◮ A. Blanchard, N. Kosmatov, and F. Loulergue. A Lesson on Verification of

IoT Software with Frama-C (HPCS 2018)

◮ on deductive verification:

  • N. Kosmatov, V. Prevosto, and J. Signoles. A lesson on proof of programs

with Frama-C (TAP 2013)

◮ on runtime verification:

◮ N. Kosmatov and J. Signoles. A lesson on runtime assertion checking

with Frama-C (RV 2013)

◮ N. Kosmatov and J. Signoles. Runtime assertion checking and its

combinations with static and dynamic analyses (TAP 2014)

◮ on test generation:

  • N. Kosmatov, N. Williams, B. Botella, M. Roger, and O. Chebaro. A lesson
  • n structural testing with PathCrawler-online.com (TAP 2012)

◮ on analysis combinations:

  • N. Kosmatov and J. Signoles. Frama-C, A collaborative framework for C

code verification: Tutorial synopsis (RV 2016)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 47 / 48

slide-58
SLIDE 58

Conclusion

Further reading

On the verification of Contiki:

◮ on the MEMB module:

  • F. Mangano, S. Duquennoy, and N. Kosmatov. A memory allocation module
  • f Contiki formally verified with Frama-C. A case study (CRiSIS 2016)

◮ on the AES-CCM* module:

  • A. Peyrard, S. Duquennoy, N. Kosmatov, and S. Raza. Towards formal

verification of Contiki: Analysis of the AES–CCM* modules with Frama-C (RED-IoT 2017)

◮ on the LIST module:

◮ A. Blanchard, N. Kosmatov, and F. Loulergue. Ghosts for lists: A

critical module of contiki verified in Frama-C (NFM 2018)

◮ F. Loulergue, A. Blanchard, and N. Kosmatov. Ghosts for lists: from

axiomatic to executable specifications (TAP 2018)

◮ A. Blanchard, N. Kosmatov, and F. Loulergue. Logic against Ghosts:

Comparison of Two Proof Approaches for a List Module (SAC 2019)

  • A. Blanchard, N. Kosmatov

Cybersecurity for IoT: Verify your Software Today! FIC 2019 48 / 48