-
Notifications
You must be signed in to change notification settings - Fork 5
/
2021-1 Formal Methods for Information Security.fex
1723 lines (1627 loc) · 66.9 KB
/
2021-1 Formal Methods for Information Security.fex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
introduction
===
history:
1983 dolvey-yao attacker model (symbolic execution abstraction)
1983 proof that secrecy is undecidable
1989 BAN logic applicable for security protocol analysis
1995 Casper used for MitM in needham schroeder
1998 inductive approach to verify security protocols
2001 ProVerif as efficient symbolic verification tool
2001 constraint-solving for bounded sessions
2001 NP-completeness of protocol insecurity for bounded sessions
2005 avispa verification tools
2006 scyther verification tools
2012 tamarin verification tools
literature:
term rewriting and all that (Baader, Nipkow, 1998)
operational semantics and verification (cremers, mauw, 2012)
formal analysis of key exchange protocols (schmidt, 2012)
protocol:
distributed algorithm with emphasis on communication
set of rules determining messages between principals
small receipts but non-trivial to design
security protocol:
uses cryptographic mechanisms to archive security goals
like authentication, integrity, non-repudiation
security defined relative to assumptions & goals
principles (abadi, needham):
every message should say what it means
specific clear conditions for a message to be acted on
mention names explicitly if essential to meaning
clarify why crypto is used (confidentiality, authentication, binding)
be clear which properties are assumed
beware of clock variations
security protocol analysis:
analysis types often incomparable, with its own results / attacks
computational:
fine-grained, but manual reduction to security
argue with probability / bitstrings
formal:
coarser, but able to analyse more
use deductive or automatic reasoning
automatic formal reasoning with bounded or unbounded sessions
alice and bob notation:
S -> R: M for sender S sending message M to receiver R
I(A) means I poses as A
{M}_K for asymmetric encryption under key K, {|M|}_K for symmetric
messages do not contain identities (unless explicitly specified)
omitted:
internal actions of principals
missing / invalid message actions
protocol run info (roles simply "know")
adversary:
assumptions:
passive (eavesdropping only)
active (intercept & send messages to anyone)
participating (legitimate use of system and/or external party)
can break old session keys
can start parallel sessions
perfect cryptography assumption:
encrypted messages require decryption key to be read
hence has to be known to receiver (honest one or adversary)
assumes confidential & integer encryption
generic attacks:
man-in-the-middle (A <-> I <-> B)
replay (reuse (parts of) old messages)
masquerading (pretend to be other principal)
reflection (replay messages back to originator; like from parallel runs)
oracle (use normal protocol responses as enc/dec services)
binding (use messages in different context / purpose)
type flaw (substitute different message field type; abuse parsing)
(some may overlap)
MitM example (Diffie-Hellman):
A -> B: g^x
B -> A: g^y
but I(B) and I(A) can sit in between, respond with g^z
then A,B still believe key shared, but actually with I
need to authenticate half-keys with signatures
reflection example:
A -> B: {N_A}_AB
B -> A: {N_A + 1}_AB
but I(B) can intercept (1) then start parallel execution
I(B) sends (1) to A, which will increment and respond
then I(B) can resume original execution with incremented response
type flaw example (Otway-Rees):
A -> B: M, A, B, {N_A, M, A, B}_AS
B -> S: M, A, B, {N_A, M, A, B}_AS, {N_B, M, A, B}_BS
S -> B: M, {N_A, K_AB}_AS, {N_B, K_AB}_BS
B -> A: M, {N_A, K_AB}_AS
but I(B) can replay (1) as (4)
then A mistakes M,A,B as the K_AB
or I(S) replays (2) as (3)
then both A,B mistake M, A, B as K_AB
generic defenses:
evesdropping -> encrypt session keys with long-term keys
binding/reflection attack -> cryptographically bind names
replay attacks -> use challenge-response based on nonces
key establishment protocol example:
users want to archive a session key, can use honest server
roles are initiator (A), responder (B), server (S)
intruder I (while I is not identified by others)
session key advantages:
encrypted messages vulnerable to time-intensive attacks
relieves key distribution problem (for n principals, need n^2 keys)
messages from previous sessions cannot be replayed
security goals:
key secrecy (key known only to A, B and S)
key freshness (A, B know key is freshly generated)
key confirmation (A, B know the other party knows the same key)
simplifications:
only successful received messages are specified
roles detect which protocol run they are part of
1st attempt:
A -> S: A, B
S -> A: K_AB
A -> B: K_AB, A
but eavesdropping breaks secrecy (passive adversary)
2nd attempt:
assume S has key shared with each participant
(1) A -> S: A,B
(2) S -> A: {K_AB}_SA, {K_AB}_SB
(3) A -> B: {K_AB}_SB, A
but binding attack impersonates B (active adversary)
by capturing all messages sent by A ("injecting at (1) and (3)")
at (1) request instead (A,I) from S
at (3) capture A's forwarded {K_AI}_SI
3rd attempt:
like 2nd + include other party in encrypted payload
but replay attack enforces old session key (active adversary)
by injecting at (1), and replying with a old messages
Needham-Schroeder conventional keys (NSCK):
use nonce (number used only once) to ensure freshness
A -> S: A,B,N_A
S -> A: {K_AB, B, N_A, {K_AB, A}_SB}_AS
A -> B: {K_AB, A}_SB
B -> A: {N_B}_AB
A -> B: {N_B-1}_AB
but able to convince B to use old session key
by injecting at (3) and sending old {K_AB, A}_SB to B
5th attempt:
can guarantee fresh keys when both parties use nonce
B -> A: A, B, N_B
A -> S: A, B, N_B, N_A
S -> A: {K_AB, B, N_A}_SA, {K_AB, A, N_B}_SB
A -> B: {K_AB, A, N_B}_SB
but key confirmation missing (which NSCK supports)
Needham-Schroeder public key (NSPK)
(1) A -> B: {n_a, A}_pk(B)
(2) B -> A: {n_a, n_b}_pk(A)
(3) A -> B: {n_b}_pk(B)
want mutual authentication of A,B
MitM:
A -> I: {n_a, A}_pk(I)
I(A) -> B: {n_a, A}_pk(B)
B -> I(A): {n_a, n_b}_pk(A)
I -> A: {n_a, n_b}_pk(A)
A -> I: {n_b}_pk(I)
I(A) -> B: {n_b}_pk(B)
but now B does not authenticate A
as B believes to be talking to A, but talks to I(A)
prevent MitM:
core issue is that message (2) can be forwarded
hence (2) must include sender {n_a, n_b, B}_pk(A)
term rewriting and protocol syntax
===
towards formalization:
formal language:
if it has well-defined syntax and semantics
additionally often deductive system to determine truth of statements
like propositional logic, first-order logic
formal model:
if defined by formal language
for example of protocol & their properties
to provide mathematically sound means to reason about it
required tools for formal protocol:
system specification (how it operates on suitable abstraction)
security properties (target achievements)
proof (show satisfaction)
from sequence charts to execution:
sequence charts usually visualize only sender & receiver
messages are sent and received by specified parties
but execution over untrusted network, parallel executions
hence sequence chart into execution per role
instead "A -> B: X" write "A sends X, B receives X"
A&B specification:
model involved roles and their respectively expected / sent messages
Dolev-Yao attacker might be able to intersect / inject messages
as sender / receive decoupled, might need to alter protocol
like checking message format late when all values known
semi-formal NSPK:
types:
Agents A, B
Number NA, NB
Function pk
knowledge:
A: A, B, pk, sk(A)
B: B, pk, sk(B)
note that nonces are not part of knowledge
actions:
A -> B: {NA, A}_pk(B)
B -> A: {NA, NB}_pk(A)
A -> B: {NB}_pk(B)
term rewriting:
generally useful & flexible mechanism
used here to represent protocols formally
signature (\Sigma):
set of function symbols, each with arity n >= 0
functions with n = 0 called constants
like 0/0, increment/1, add/2; \Sigma = {0, increment, add}
term algebra (T_{\Sigma}):
for \Sigma signature, X variables, N names (all mutually disjoint)
algebra over \Sigma is least set such that
(1) X \cup N \subset T{_\Sigma}(X, N)
(2) if t_1, ..., t_n \in T_{\Sigma}(X, N) and f \in \Sigma of arity n
(2) then f(t_1, ..., t_n) \in T_{\Sigma}(X, N)
T_{\Sigma}(\emptyset, N) (terms without variables) called ground terms
like natural numbers s(0) + s(X) + s(s(0)) \in T{_\Sigma}
equation (E):
pair of terms t = t'
set of equations called equation theory (\Sigma, E)
oriented equations (t -> t', t <- t') called a rewriting rule
like E = {X + 0 = X, X + s(Y) = s(X + Y), s(0) + s(0) = s(s(0))}
like for \Sigma = {add, sub} then E = {add(sub(X, Y), Y) = X}
quotient algebra (T_{\Sigma}/=_E):
interprets term by its equivalence class
equivalence class [t]_E of term t with all terms by =_E
for =_E congruence relation given by equations E
if only interpreted syntactically called free algebra
like [{{M}_K}_K^-1]_E = M
substitution (\sigma):
function \sigma: X -> T_{\Sigma}
where \sigma(x) != x for finitely many x
written in postfix notation (after value)
applied homomorphically (on function arguments)
like f(t_1, t_2) \sigma = f(t_1 \sigma, t_2 \sigma)
substitution composition:
multiple substitutions tied together called
like for \sigma = [x -> y], \tau = [y -> z]
then \sigma \tau = [x -> z, y -> z] (apply \tau homomorphically to \sigma)
position (p):
term position defined by tree coordinate (as sequence of integer)
(base case) p = [] then t|p = t
(expansion) [i]*p' then t|p = t_i|p'
like for (A, (B, C)) then p = [2,1] gives B
matching:
term t matches term l if substitution \sigma exists (t = l \sigma)
applying \sigma called matching substitution
term replacement:
t[u]_p denotes term t after replacing t|p with u
rewriting:
for rewrite rule l -> r replacing l by r
applicable if t|p = l \sigma exists for some p, \sigma
rewrite step of applying l -> r is t -> t[r \sigma]_p
unification:
if substitution \sigma exists such that t \sigma =_E t' \sigma
most general substitution if extends all others with some substitution
for E=0 ("syntactic unification"), decidable & mgu exists if unifiable
else likely undecidable (like addition + distribution)
even if decidable (associativity), can be infinitary (arbitrarily long)
equational proofs:
u <->_E v called E-equality step (consist of u -> v and u <- v)
transitive clousure of <->_E is E-equality relation =_E
t_0 <->_E t_1 <->_E ... <->_E t_n called an equality proof
to avoid lengthy equational proofs require convergence
convergence:
requires termination (finite transitions; not like E={a=b, b=a})
requires confluence (order of applying transitions irrelevant)
if both termination and confluence, then convergent
now every term has unique normal form t \downarrow
for convergent (\Sigma, E) then t =_E u iff t \downarrow = u \downarrow
like for t = s(0) + s(s(0)), then t \downarrow = s(s(s(0)))
model protocols:
message (t \in T_{\Sigma}):
let PV \cup FV \subseteq N
for X set of variables (denoted uppercase A, B, ...)
for PV set of public values (denoted lowercase a,b; like agents)
for FV set of fresh values (denoted lowercase na, nb, ...; like nonces, keys)
let \Sigma = {pair, fst, snd, pk, sk, aenc, adec, senc, sdec}
for pair, fst, snd pair operations
for pk(t), sk(t) public/private key
for aenc(m, k), adec(c, k) asymmetric encryption/decryption
for senc(m, k), sdec(c, k) symmetric encryption/decryption
dolev-yao:
public key system:
for encryption E_X and decryption D_X
any user can apply E_X, only X can apply D_X
it holds that E_X D_X = D_X E_X = 1
adversary:
controls the network (read, intercept, send)
has knowledge K with learned terms during execution
derivations:
can generate fresh values (Fr(x) -> K(x))
learns all messages sent (Out(x) -> K(x))
sends any message (K(x) -> In(x))
freely combines knowledge (K(t_1) ... K(t_n) -> K(f(t_1, ..., t_n)))
multi-set rewriting protocol syntax
===
multi-set rewriting (MSR):
multiset:
set of elements; each assigned a multiplicity m: X -> N
like [0 -> 1, 1 -> 3] = [0, 3, 3, 3]
union U# and difference # works on elements
fact F:
F(t_1, ..., t_k) \in \Sigma_fact
takes k terms t \in T_{\Sigma} as arguments for k > 0
note that facts cannot be applied recursively (contrary to terms)
labeled multiset rewriting:
l -a> r called labeled multiset rewriting rule
for l,r multiset of facts called state facts
for a multiset of facts called action facts or events
many such rules called labeled multiset rewrite system
example NSPK:
[St_A_1(A, tid, skA, B, pkB), Fr(NA)]
- Send(A, {NA, A}_pkB) ->
[St_A_2(A, tid, skA, B, pkB, NA), Out({NA, A}_pkB)]
adversary rules:
to determine which messages adversary can derive
modelled as knowledge facts K(t) (representing knowledge of term t)
knowledge derivations:
learns all messages sent (Out(x) -> K(x))
sends any message (K(x) -> In(x); labelled with K(x))
generates fresh values (Fr(x) -> K(x))
combines knowledge (K(t_1) ... K(t_n) -> K(f(t_1, ..., t_n)))
notes:
labels have different namespace, hence overloading K(x) is fine
to combine knowledge, applies equational theory
fresh rule:
to formalize unique, fresh values for nonces or thread identifiers
modelled as fresh facts F(X)
fresh & public values:
fresh (FV) and public values (PV) are disjoint, countable finite
FV U PV \subset N of N in T_{\Sigma}(X, N)
fresh rule:
rule [] -> [Fr(N)]
no precondition; single rule which can produce such facts
each created nonce N is unique semantically
protocol rules:
to formalize sending, receiving of messages & progress of protocol
use state facts to track role's progress
use Out, In facts to send / receive message
role:
protocol rules (send, receive, use of fresh values, ...)
uses agent state facts to track progress
agent actually executes the role
agent state fact (St_R_s(...)):
St_R_s(A, id, k_1, ..., k_n)
St for state, R for role, s number of protocol step
A agent executing, id threat identifier, k_i terms in agents knowledge
protocol rule restriction:
restrict ourselves to subset of tamarin to reduce hassle
[some facts] -[label]> [some other facts]
l -a-> r is protocol rule iff (except initialization rules)
(1) only In, Fr, agent state facts in l
(2) only Out, agent state facts in r
(3) either In or Out occur in single rule, never both
(4.1) single agent state fact in each l and r
(4.2) if left contains St_R_s(A, id, k_1, ..., k_n)
then right contains St_R_s'(A, id, k_1', ..., k_m') for s' = s+1
(note that some k_i might be missing right, but not other way around)
(5) every variable in r must occur in l
protocol rule examples:
receive rule [St_A_1(...), In(m)] - Recv(A, m) -> [St_A_2(...)]
send rule [St_A_2(...)] - Send(A, m) -> [St_A_3(...), Out(m)]
hence either send value, or receive value (do not do both)
and always create new state out of old knowledge (to progress protocol)
executable rule (l -> r):
if all knowledge terms k_i' and out terms Out(t) \in r
are derivable from knowledge terms k_i, In(u), Fr(x) \in l
well-formedness:
a rule is well-formed if it is a protocol rule and executable
hence check protocol rule definition matches
check if initialization rule -> anything goes
check state incremented (St_R_s(...) -> St_R_s'(...) for s' = s + 1)
check only allowed facts left and right
check only valid equational rules applied
check all knowledge present to apply equational rules
check only either In or Out used
infrastructure rules:
to formalize generation of cryptographic keys
like public key infrastructure (PKI)
key-generation rule:
to model PKI
[Fr(sk)] -> [Ltk(A, sk), Pk(A, pk(sk)), Out(pk(sk))]
for Ltk long-term key, Pk public key, Out publish public key
initialization rule:
creates new thread with some id, role R, owned by some agent
[Fr(id), Ltk(A, skA), Pk(B, pkB)]
- Create_R(A, id) ->
[St_I_0(A, id, skA, B, pkB), Ltk(A, skA), Pk(B, pkB)]
protocol semantics and properties
===
protocol semantics:
instance:
for X being term, fact or rewrite rule
instance is result of substitution to all terms in X
when all terms are ground called ground instance
ginsts(R):
set of all ground instances of rules of multiset rewriting system R
G is set of all ground facts (and G# its respective multiset)
state:
finite multiset of ground facts, state \in G#
like [St_R_1(alice, 17, k_1), Out(k_1)]
fact types:
linear if consumed by application (removed from state)
else persistent (prepended with bang ! in tamarin)
labeled multiset rewriting step:
l -a> r \in ginsts(R) (ground instance of rule)
lin(I) \subseteq^# S (multiset of linear facts)
per(I) \subseteq S (set of persistent facts)
S' = S \sim^# lin(I)) \cup^# r (new state without linear facts)
---- (preconditions above, rule below)
(S, l -a> r, S') \in steps(R)
execution R:
alternating sequence S_0, (l_1 -a_1-> r_1), S_1, ..., S_k
for S_0 initial empty state
transition sequences valid (S_{i-1}, l_i - a_i -> r_i, S_i) \in steps(R)
fresh names are unique (for two transitions using same ([] -> [Fr[n]]), must be equal)
trace:
one execution
defined by multiset of its action labels
protocol security goals:
protocol goals:
authenticate messages (to bind to originator, ...)
timeliness of messages (recent, fresh, ...)
secrecy (generated keys, ...)
anonymity
non-repudiation (receipt, submission, delivery, ...)
fairness
availability
sender invariance (always same sender)
properties:
semantics of protocol P is set traces(P) = || P ||
security goal also defines set traces(\phi) = || \phi ||
correctness:
property satisfied if || P || \subseteq || \phi ||
attack traces are || P || - || \phi ||
formalizing security properties:
using direct formulation:
in terms of send/receive events
but properties are heavily protocol-dependent
using protocol instrumentation:
add special claim events into protocol roles
then can express properties independently of protocol
like Claim_secret(A, N_A) to say that N_A is only known to A
claim events:
part of the protocol rules (the "labels")
cannot be observed, modified, generated by adversary
allows to formulate secrecy, authenticity, ...
frequently used events:
Send(A, t), Recv(A, T), Create_R(A, id) for protocol events
Claim_claimtype(A, t) for claim event
Honest(A), Rev(A) for honesty / reveal events
K(t) for adversary knowledge
property specification language:
F@i for timestamped event (has to hold at position i in trace)
t = u for term equality
i = j for timepoint equality
i < j for timepoint inequality
secrecy:
target that adversary cannot discover guarded data
role instrumentation:
insert Claim_secret(A,M) to claim M of A secret
add at end of the role
within graphs, visualize as hexagon with text secret(M)
first definition attempt:
\forall A, M, i. Claim_secret(A, M)@i
=> not (\exists j. K(M)@j)
but works only for passive adversary (active breaks this)
model compromised agent:
by explicitly sharing long-term secrets with adversary
[Ltk(A, skA)] -Rev(A)> [Ltk(a, skA), Out(skA)]
model honest agent:
agent is honest in trace tr if Rev(A) \notin tr
must accompany any Claims to prevent trivial adversary
definition:
\forall A, M, i. Claim_secret(A, M)@i
=> not (\exists j. K(M)@j) or (\exists B k. Rev(B, M)@k ^ Honest(B)@i)
so either attacker did not learn secret
or some B exists which revealed secret besides declared honest
note that k, i, j unordered, as has to hold on all traces
authentication & other properties
===
authentication:
guarantees existence or presence of intended communication partner
may includes an agreement on protocol execution elements
many definitions:
multiple classifications / specifications worked out
Lowe's authentication hierarchy used in this course
examples:
ping authentication, aliveness
weak / non-injective / injective agreement
weak and strong authentication
synchronization
matching histories
authentication hierarchy (Lowe):
increasingly stronger authentication properties
all include recentness (B was run within t time units)
aliveness:
when a (role A) completes run of protocol with b (apparently role B)
then b has run protocol at some point in time
weak agreement:
when a (role A) completes run of protocol with b (apparently role B)
then b has run protocol at some point in time with a
non-injective agreement:
when a (role A) completes run of protocol with b (role B)
then b has run protocol at some point in time with a
both a and b agree on some message m
b was running in role B (not required before)
injective agreement:
non-injective agreement + one-to-one correspondence guarantee
requires run of a (role A) and b (role B) one-to-one match
role instrumentation for authentication:
commit claim (owner) authenticates running claim (peer)
formalize as term t (for A) and term u (t's view of B)
add Claim_commit(A, B, t) to A (after A can construct t)
add Claim_running(B, A, u) to B (after B can construct u, casually preceeding commit)
content of claimed term:
may include claimed roles R_1, R_2 (usually I, R)
may include claimed message t (by A) and u (by B)
aliveness:
assure that b has started (nothing more)
model by requiring b's Create label
Claim_commit(a, b, <>)@i
=> (\exists R j. Create(b, id, R)@j) or
(\exists X r. Rev(X)@r ^ Honest(X)@i)
weak agreement:
no agreement on term or roles (but require b talking to a)
Claim_commit(a, b, <>)@i
=> (\exists j. Claim_running(b, a, <>)@j) or
(\exists X r. Rev(X)@r ^ Honest(X)@i)
non-injective agreement:
agreement on R_1, R_2 and t
Claim_commit(a, b, <R_1, R_2, t>)@i
=> (\exists j. Claim_running(b, a, <R_1, R_2, t>)@j) or
(\exists X r. Rev(X)@r ^ Honest(X)@i)
injective agreement:
additionally requires only single commit claim in trace
not (\exists a2 b2 i2. Claim_commit(a2, b2, <R_1, R_2, t>)@i2 ^ not (i2 = i))
examples:
insert running as soon as able to construct t
insert commit as soon as able to construct u
agreement might not always be possible (due to causal dependencies)
(shorthand notation here omits implicit arguments to claims)
non-injective vs injective:
A: Claim_running(B, {A,B})_sk(A)
A -> B: {A,B}_sk(A)
B: Claim_commit(A, {A,B}_sk(A))
non-injective is fulfilled
but injcetive fails (attacher replays message)
aliveness vs weak-agreement:
A -> B: A, {N_A}_pk(B)
B: Claim_running(A)
B -> A: N_A
A: Claim_commit(B)
aliveness fulfilled
but weak-agreement fails (attacker MitM & replaces first message A by I)
then A claims with B, but B claims with I
aliveness fails:
A -> B: {|N_A|}_k(A,B)
B: Claim_running(A)
B -> A: {|N_A|}_k(A,B), N_A
A: Claim_commit(B)
A -> B: {|N_A|}_k(A,B)
but attacker can reflect message 2
then A claims Claim_commit(A) (instead of B)
key-related properties:
basic goals:
key freshness
key authentication (only known to communicating parties A, B)
key confirmation of A to B (if B knows that A possesses K)
explicit key authentication = key authentication + confirmation
can be expressed with secrecy and agreement
goals for compromised keys:
(perfect) forward secrecy
when long-term key reveal does not compromise previous session keys
resistance against key-compromise impersonation
when A's keys do not allow others to impersonate as different principle to A
forward secrecy:
\forall A, M, i. Claim_secret(A, M)@i
=> not (\exists j. K(M)@j) or (\exists B k. Rev(B)@k ^ Honest(B)@i ^ k < j)
so M is secret unless previously compromised
but M stays secret if afterwards compromised
modified station-to-station protocol:
A -> B: g^x
B -> A: g^y, {g^y, g^x, A}_sk(B)
A -> B: {g^x, g^y, B}_sk(A)
provides forward secrecy
MTI A(0) protocol:
combination of long-term & session DH keys
A has u, g^v; B has v, g^u
A -> B: g^x
B -> A: g^y
K_AB = (g^y)^u * (g^v)^x
but attacker compromising A & B can reconstruct
key transport w/o DH:
A -> B: A, N_A, {pk(K), B}_sk(A)
B generates K_AB
B -> A: {K_AB}_pk(T), {h(K_AB), A, N_A}_sk(B)
provides forward secrecy without DH
key compromise impersonation (KCI):
KCI-resistance as additional property for authentication property
if adversary learns private key of A
must not be able to impersonate others to A
example (NSL):
A -> B: {na, A}_pk(B)
B -> I: {na, nb, B}_pk(A)
but now can simulate B against A (hence not KCI-resistant)
algorithmic verification of security protocols
===
hard problems:
post correspondence problem (PCP):
given list of pairs of words ((u_1, v_1), ..., (u_n, v_n))
find ordering such that u_1 ... u_nb ... = v_1 ... v_n
like (u_1, v_1) = (ab, b), (u_2, v_2) = (b, ba) has solution 2, 1
undecidability:
input program P and functional specification S
output if P satisfies S or not
rice theorem:
for S as non-empty, proper subset of computable functions
then verification problems of S (using programs P) are undecidable
source of unboundedness:
state space can be inifinite
messages (as adversary can form arbitrary complex messages)
sessions (arbitrary number of threads)
nonces (unbounded fresh nonces)
can freely combine which dimension is bounded or unbounded
(except if sessions bounded, then nonces must also be bounded)
undecidability of secrecy (threads, messages unbounded):
undecidable with unbounded threads and messages (1983)
shown by reduction on PCP generated protocols
but artificial (require intruder intervention for execution)
undecidable when restricting to executable protocols (2001)
as undecidable for unbounded messages, sessions
also undecidable for unbounded messages, sessions, nonces
decidability in search tree (all bounded):
each node is state with root initial state
edges labelled with transition justified by rewriting rule
verify property by checking each node
browse tree exhaustively (like depth / breadth first)
when everything is bounded, then terminates (hence decidable)
even if unbounded, but attack exists, will terminate with that attack
decidability of symbolic forward search (sessions, nonces bounded):
protocol insecurity for bounded #threads is NP-complete (2001)
within NP by guessing execution for specific #threads, then checking property
NP-hardness by reduction to 3-SAT
hence NP-complete
decidability as long as two dimensions bounded:
unbounded threads & nonces is undecidable (1999)
bounded messages & nonces is DEXPTIME-complete (1999)
conclusion:
require at least two dimensions to be bounded
hence can either have unbounded sessions or messages
(unbounded nonces but bounded sessions impossible)
dolev-yao attacker:
prolific (can arbitrary compose & send to any agent & at any time)
results in enormous search tree
but can make problem decidable by separating composition / decomposition
(this chapter assumes normalized deduction rules to simplify)
deduction rules overview:
create public values, derive fresh values
compose messages out of previous knowledge
unpair message either left or right
symmetric & asymmetric encryption
derivable messages DY(M):
for K(M) the set of messages
for all t derivable from assumptions K(M)
in real setting, use equational theory to derive additional M
proof DY(M) is decidable:
split intruder in composition & decomposition
composition is easily decidable
decomposition is finite closure of M
composition / decomposition deduction rules:
composition rules (public values, fresh values, composition)
decomposition rules (tuple to value, symmetric & asymmetric decryption)
key for symmetric/asymmetric requires composition term
intruder receive (resulting in decomposition)
intruder send (resulting in composition)
coercion rule (switches mode of decomposition into composition)
deciding DY(M):
let DY^up be terms t derivable out of K^up(M) using composition rules
same for DY^down and K^down(M), but using decomposition rules
first compute M' = DY^down (analysed intruder knowledge)
then check if term t within DY^up(M')
to show DY^up(DY^down(M)) = DY(M), we have to show both < and >
< as every up/down rule has direct corresponding rule in DY(M)
> as can normalize DY(M) deductions into composition first, decomposition after
(by continuously eliminating composition-decomposition pairs)
inductively show all decomp. in DY^down, all comp. within DY^up
substitutions:
deciding DY(M) also works with substitutions
instantiate substitution with value out of M
like t = {|X|}_k -> for {|n|}_k \in M, use substitution [X -> n]
or compose target term (circumventing substitution)
like t = {|X|}_k -> for k \in M, can create t with any m \in M
constraint-based automatic verification:
decide if for protocol P and property \phi
[P] \subseteq [\phi] or equivalently [P] cap [inverted(\phi)]
for [] traces or set of states
verification approaches:
forward search by post(S) (append any S' onto existing trace S)
backward search by pre(S) (prepend any S' onto existing trace S)
for finite state, both reach fixpoint sometime
for infinite state, need symbolic representations (constraints, formulas)
symbolic forward search (bounded):
forward search through tree of symbolic executions
use post(S) transformer to find reachable states
each state as system of intruder constraints => solution = attack
decidable if bounded number of sessions
like OFMC, CL-Atse
layer 1 is tree of symbolic states (<= 1 successor per ln(t) fact)
layer 2 solves constraints in symbolic tree; solutions = attacks
symbolic backward search (unbounded):
search backwards from negated property (hence attack states)
use pre(S) transformer to find reachable states
check if initial state is reached => yes = attack
if not & terminated, then no attack possible
like ProVerif, Maude-NPA, Scyther, Tamarin
tamarin:
protocols & attackers by multiset rewriting (supports many intruder theories)
properties by first-order logic over traces (supports messages & timepoints)
verification by backwards reachability analysis
algorithm is proven sound & complete (but might not terminate)
constraint-system:
set of constraints of different types
constraint types:
formula
like \exists k,i.Rev(k)@i
node i : ri for i node index, ri rewrite rule instance
like node j1 applies fresh rule, node j2 applies Out rule
edge (i,u) -> (j,v) linking conclusion u of node i to premise v of node j
like result of j1 used as premise in j2
solution:
pair (dg, \theta)
for dg dependency graph
for \theta index assignment (dg indices to index variable)
and term assignment (ground terms to variables)
such that all constraints in system satisfied
like \theta = [j1 -> 1, j2 -> 2, x (of fresh rule) -> a]
constraint reduction rules:
transform constraint system into set of constraints systems
types:
logical rules (working on formula constraints)
graph rules (working on node / edge constraints)
properties:
soundness (no solutions are invented)
completeness (no solutions are lost)
solved constraint system:
if no reduction rules can be applied anymore
then can construct a solution
index assignment by topologically ordering node constraints
term assignment by instantiating each variable with different const
constraint solver setup:
add to constraint set negated initial constraint (invert property)
while non-empty constraint set, choose reduction rule and apply it
early out if solution found, return attack
else return success
logical reduction rules:
simple decomposition (remove \exists, ^)
splitting decomposition (creates constraint systems)
contradiction (results in empty set of constraint systems)
instantiation (instantiate \forall)
graph reduction rules:
fact formula (F(x)@i => node constraint i:ri for F(x) label of ri)
backwards completion (open premise => node constraint for each applicable rule)
uniqueness fresh values (collapse nodes with same fresh rule)
uniqueness linear conclusions (collapse nodes with same linear conclusion)
process:
safety property \tau is given (\forall ...)
negate \tau into \tau' to negation normal form (\exists ...)
apply logical rules and get first rule(s)
for each rule, build up deduction trees using forward reasoning
might be able to collapse premises (uniqueness of fresh values)
might be able to collapse rules (if same linear rules (Fresh) used)
example (two Fin rules):
\tau given & inverted gives two Fin(x_1, k)@i rules & some side conditions
write both Fin rules and build up trees to explain their construction
note that k out of Fr(k) -> hence join Fr rule of both trees
note that trees use same Fr & same rules -> hence join trees
now contradicts side conditions, tree is invalid & property proven
principles for intruder deduction:
separate composition / decomposition with coerce rule
derive premise of coerce rule by forward reasoning
derive every K^up(m) and K^down(m) at most once
K^up(X) facts are irreducible
no coerce rule instances with pairs
=> avoid redundancies & unnecessary non-termination
process with intruder:
set up trees as described in process without intruder
resolve open premise using intruder send rule
now need to deduce required knowledge for this send rule
apply coersion rule (for pairs, first decompose)
then try to find source; using fresh / Out rule
example (intruder):
prepare & build up tree as before
use In() rule to fulfil open premises
fully decompose In() rule preconditions
try to fulfil preconditions with Fr() and check if unifiable
else apply coerse rule (switching to composition mode)
bruteforce Out() rules & try to construct coerse rule precondition
tamarin
===
uses multiset rewriting to represent protocol
adversary message deductions given with multiset rewriting rules
properties specified in first-order logic
algorithm proven to be sound and complete
backwards reachability analysis:
negates secure property, then searches for solutions
if some found => counter-example to security property
uses constraint solving
internal workflow:
equational theory using builtins, functions and equations
together with protocol rules, generates variant formulas
adds restrictions then 1st constraint solving starts
security properties added to 2nd constrain solving
then shows proof with all cases or attack (or does not terminate)
tamarin notation:
tilde for fresh values
bang for persistent fact
dollar for public value
else fact used only once (declared right, used left)
simplify attacks:
simplify attacks by adding restrictions (like allowing only single Create rule)
restrictions apply to all properties
hence before verifying other properties need to remove them again
or formulate like restriction => property
noise protocol framework
===
noise framework:
modern alternative to TLS
family of authenticated key exchanges
how TLS differs:
optimized for server authentication
high code complexity (50k - 600k LoC vs Noise 5k)
allows to negotiate used crypto (adds complexity)
overview:
can choose one of 53 handshakes, then rest of protocol determined
each handshake has source/destination security levels associated
source security levels:
0 no authentication
1 sender authentication vulnerable to key-compromise impersonation
2 sender authentication resistant to key-compromise impersonation
destination security level:
0 non-confidentiality
1 encryption to an unauthenticated recipient
2 encryption to known recipient, but vulnerable to reply
3 weak forward secrecy (message confidential if attacker compromises later)
4 weak forward secrecy even with sender's key compromise
5 strong forward secrecy
formalization:
assumes ephermeral keys to be secure
defines source & destination level for each handshake
but formal definition / analysis was missing
example handshake KK:
-> s
s <-
...
-> e, es, ss
<- e, ee, se
notation:
ephemeral key e (RAM stored, short lived)
static key s (disk stored, long-term key)
... divides pre-defined values & protocol run
explanation:
requires known static key between the two parties
create ephemeral keys e, es and ss (as exponents over DL)
hence es means to build g^es, possible knowing e and g^s
source security claim:
(authentication of sender to receiver)
sender authentication resistant to key-compromise impersonation
target security claim:
(confidentiality of payload from senders perspective)
strong forward secrecy
formalizing:
multiple attacker models
attacker models:
active if attacker active
D_x if attacker generated keys (for x ephemercal keys, PKI)
R_x if attacker revealed keys (for x ephemercal / static keys)
R{_x}^< if reveal before claim of property happened
can order adversary capabilities in partial order
security notions:
secrecy, (non-)injective agreement
weak forward secrecy (R_s ^ active) or (R_rs ^ active) or (R{_s}^< or R{_rs}^<)
strong forward secrecy (R{_s}^< or R{_rs}^<)
analysis goal:
for each noise handshake
identify strongest thread such that security notion holds
architecture:
noice handshakes converted with Vacarne into tamarin code
tamarin generates proofs (~410'000 lemmas)
reduce proof size:
remove redundant conjunctions / threat models, equivalent classes, ...
like if injective agreement fails, then stronger models fail too
and vice versa
map proofs to informal levels:
simplify threat models (no ephemeral key revealing)
then can map attacker model to noise security levels
conclusions:
noise does not consider ephemeral key compromise
hence 5 is not necessarily more secure than 3 if e compromised
some handshakes superior to others in every way
hence inferior handshakes should be removed
RFID protocols & privacy
===
radio-frequency identification
RFID system:
tag & reader over insecure channel
reader & backend over secure channel
applications:
keyless entry (doors, public transport, passports)
shopping, supply chains (identify stock)
identify small animals & medical identification
RFID challenges:
need to be manufactured as cheaply as possibnle
efficient symmetric crypto ist not enough for strong auth / privacy
randomness generation challenging (passive RFID cannot)
realizations:
5 cents - 100 dollars depending on application
as small as 0.05mm
5cm - 200m reception
few bits until kilobytes of memory
communicate constant / apply asymmetric crypto
passive / active variants
RFID tracking:
include chip in garment (like school uniform)
then can track wherever person goes
RFID properties:
convenient way to register/track items
popular for access control to secure premises
RFID tags respond automatically to queries by readers
privacy implications:
can trace wearer without even noticing
can trace competitors products
RFID untraceability:
if attacker cannot distinguish
two protocol executions of same tag vs of different tags
example challenge (car keyless entry):
want authentication (car unlocks)
want privacy (prevent identification)
resource constraints (limited key capabilities)
e-passport:
why not NSL:
in NSL, tag needs to initiate
hence need to add 4th message so reader initiated
together with async crypto simply too expensive for tags