You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
10 KiB

  1. // CROWDS [Reiter,Rubin]
  2. // Vitaly Shmatikov, 2002
  3. // Note:
  4. // Change everything marked CWDSIZ when changing the size of the crowd
  5. // Change everything marked CWDMAX when increasing max size of the crowd
  6. dtmc
  7. // Probability of forwarding
  8. const double PF = 0.8;
  9. // Probability that a crowd member is bad
  10. const double badC = 0.091;
  11. // const double badC = 0.167;
  12. const int TotalRuns=3; // Total number of protocol runs to analyze
  13. const int CrowdSize=4; // CWDSIZ: actual number of good crowd members
  14. const int MaxGood=20; // CWDMAX: maximum number of good crowd members
  15. // Process definitions
  16. module crowds
  17. // Auxiliary variables
  18. launch: bool init true; // Start modeling?
  19. new: bool init false; // Initialize a new protocol instance?
  20. runCount: [0..TotalRuns] init TotalRuns; // Counts protocol instances
  21. start: bool init false; // Start the protocol?
  22. run: bool init false; // Run the protocol?
  23. lastSeen: [0..MaxGood] init MaxGood; // Last crowd member to touch msg
  24. good: bool init false; // Crowd member is good?
  25. bad: bool init false; // ... bad?
  26. recordLast: bool init false; // Record last seen crowd member?
  27. badObserve: bool init false; // Bad members observes who sent msg?
  28. deliver: bool init false; // Deliver message to destination?
  29. done: bool init false; // Protocol instance finished?
  30. // Counters for attackers' observations
  31. // CWDMAX: 1 counter per each good crowd member
  32. observe0: [0..TotalRuns] init 0;
  33. observe1: [0..TotalRuns] init 0;
  34. observe2: [0..TotalRuns] init 0;
  35. observe3: [0..TotalRuns] init 0;
  36. observe4: [0..TotalRuns] init 0;
  37. observe5: [0..TotalRuns] init 0;
  38. observe6: [0..TotalRuns] init 0;
  39. observe7: [0..TotalRuns] init 0;
  40. observe8: [0..TotalRuns] init 0;
  41. observe9: [0..TotalRuns] init 0;
  42. observe10: [0..TotalRuns] init 0;
  43. observe11: [0..TotalRuns] init 0;
  44. observe12: [0..TotalRuns] init 0;
  45. observe13: [0..TotalRuns] init 0;
  46. observe14: [0..TotalRuns] init 0;
  47. observe15: [0..TotalRuns] init 0;
  48. observe16: [0..TotalRuns] init 0;
  49. observe17: [0..TotalRuns] init 0;
  50. observe18: [0..TotalRuns] init 0;
  51. observe19: [0..TotalRuns] init 0;
  52. [] launch -> (new'=true) & (runCount'=TotalRuns) & (launch'=false);
  53. // Set up a new protocol instance
  54. [] new & runCount>0 -> (runCount'=runCount-1) & (new'=false) & (start'=true);
  55. // SENDER
  56. // Start the protocol
  57. [] start -> (lastSeen'=0) & (run'=true) & (deliver'=false) & (start'=false);
  58. // CROWD MEMBERS
  59. // Good or bad crowd member?
  60. [] !good & !bad & !deliver & run ->
  61. 1-badC : (good'=true) & (recordLast'=true) & (run'=false) +
  62. badC : (bad'=true) & (badObserve'=true) & (run'=false);
  63. // GOOD MEMBERS
  64. // Forward with probability PF, else deliver
  65. [] good & !deliver & run -> PF : (good'=false) + 1-PF : (deliver'=true);
  66. // Record the last crowd member who touched the msg;
  67. // all good members may appear with equal probability
  68. // Note: This is backward. In the real protocol, each honest
  69. // forwarder randomly chooses the next forwarder.
  70. // Here, the identity of an honest forwarder is randomly
  71. // chosen *after* it has forwarded the message.
  72. [] recordLast & CrowdSize=2 ->
  73. 1/2 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  74. 1/2 : (lastSeen'=1) & (recordLast'=false) & (run'=true);
  75. [] recordLast & CrowdSize=4 ->
  76. 1/4 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  77. 1/4 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  78. 1/4 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  79. 1/4 : (lastSeen'=3) & (recordLast'=false) & (run'=true);
  80. [] recordLast & CrowdSize=5 ->
  81. 1/5 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  82. 1/5 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  83. 1/5 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  84. 1/5 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  85. 1/5 : (lastSeen'=4) & (recordLast'=false) & (run'=true);
  86. [] recordLast & CrowdSize=10 ->
  87. 1/10 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  88. 1/10 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  89. 1/10 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  90. 1/10 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  91. 1/10 : (lastSeen'=4) & (recordLast'=false) & (run'=true) +
  92. 1/10 : (lastSeen'=5) & (recordLast'=false) & (run'=true) +
  93. 1/10 : (lastSeen'=6) & (recordLast'=false) & (run'=true) +
  94. 1/10 : (lastSeen'=7) & (recordLast'=false) & (run'=true) +
  95. 1/10 : (lastSeen'=8) & (recordLast'=false) & (run'=true) +
  96. 1/10 : (lastSeen'=9) & (recordLast'=false) & (run'=true);
  97. [] recordLast & CrowdSize=15 ->
  98. 1/15 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  99. 1/15 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  100. 1/15 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  101. 1/15 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  102. 1/15 : (lastSeen'=4) & (recordLast'=false) & (run'=true) +
  103. 1/15 : (lastSeen'=5) & (recordLast'=false) & (run'=true) +
  104. 1/15 : (lastSeen'=6) & (recordLast'=false) & (run'=true) +
  105. 1/15 : (lastSeen'=7) & (recordLast'=false) & (run'=true) +
  106. 1/15 : (lastSeen'=8) & (recordLast'=false) & (run'=true) +
  107. 1/15 : (lastSeen'=9) & (recordLast'=false) & (run'=true) +
  108. 1/15 : (lastSeen'=10) & (recordLast'=false) & (run'=true) +
  109. 1/15 : (lastSeen'=11) & (recordLast'=false) & (run'=true) +
  110. 1/15 : (lastSeen'=12) & (recordLast'=false) & (run'=true) +
  111. 1/15 : (lastSeen'=13) & (recordLast'=false) & (run'=true) +
  112. 1/15 : (lastSeen'=14) & (recordLast'=false) & (run'=true);
  113. [] recordLast & CrowdSize=20 ->
  114. 1/20 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  115. 1/20 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  116. 1/20 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  117. 1/20 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  118. 1/20 : (lastSeen'=4) & (recordLast'=false) & (run'=true) +
  119. 1/20 : (lastSeen'=5) & (recordLast'=false) & (run'=true) +
  120. 1/20 : (lastSeen'=6) & (recordLast'=false) & (run'=true) +
  121. 1/20 : (lastSeen'=7) & (recordLast'=false) & (run'=true) +
  122. 1/20 : (lastSeen'=8) & (recordLast'=false) & (run'=true) +
  123. 1/20 : (lastSeen'=9) & (recordLast'=false) & (run'=true) +
  124. 1/20 : (lastSeen'=10) & (recordLast'=false) & (run'=true) +
  125. 1/20 : (lastSeen'=11) & (recordLast'=false) & (run'=true) +
  126. 1/20 : (lastSeen'=12) & (recordLast'=false) & (run'=true) +
  127. 1/20 : (lastSeen'=13) & (recordLast'=false) & (run'=true) +
  128. 1/20 : (lastSeen'=14) & (recordLast'=false) & (run'=true) +
  129. 1/20 : (lastSeen'=15) & (recordLast'=false) & (run'=true) +
  130. 1/20 : (lastSeen'=16) & (recordLast'=false) & (run'=true) +
  131. 1/20 : (lastSeen'=17) & (recordLast'=false) & (run'=true) +
  132. 1/20 : (lastSeen'=18) & (recordLast'=false) & (run'=true) +
  133. 1/20 : (lastSeen'=19) & (recordLast'=false) & (run'=true);
  134. // BAD MEMBERS
  135. // Remember from whom the message was received and deliver
  136. // CWDMAX: 1 rule per each good crowd member
  137. [] lastSeen=0 & badObserve & observe0 <TotalRuns -> (observe0' =observe0 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  138. [] lastSeen=1 & badObserve & observe1 <TotalRuns -> (observe1' =observe1 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  139. [] lastSeen=2 & badObserve & observe2 <TotalRuns -> (observe2' =observe2 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  140. [] lastSeen=3 & badObserve & observe3 <TotalRuns -> (observe3' =observe3 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  141. [] lastSeen=4 & badObserve & observe4 <TotalRuns -> (observe4' =observe4 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  142. [] lastSeen=5 & badObserve & observe5 <TotalRuns -> (observe5' =observe5 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  143. [] lastSeen=6 & badObserve & observe6 <TotalRuns -> (observe6' =observe6 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  144. [] lastSeen=7 & badObserve & observe7 <TotalRuns -> (observe7' =observe7 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  145. [] lastSeen=8 & badObserve & observe8 <TotalRuns -> (observe8' =observe8 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  146. [] lastSeen=9 & badObserve & observe9 <TotalRuns -> (observe9' =observe9 +1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  147. [] lastSeen=10 & badObserve & observe10<TotalRuns -> (observe10'=observe10+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  148. [] lastSeen=11 & badObserve & observe11<TotalRuns -> (observe11'=observe11+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  149. [] lastSeen=12 & badObserve & observe12<TotalRuns -> (observe12'=observe12+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  150. [] lastSeen=13 & badObserve & observe13<TotalRuns -> (observe13'=observe13+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  151. [] lastSeen=14 & badObserve & observe14<TotalRuns -> (observe14'=observe14+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  152. [] lastSeen=15 & badObserve & observe15<TotalRuns -> (observe15'=observe15+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  153. [] lastSeen=16 & badObserve & observe16<TotalRuns -> (observe16'=observe16+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  154. [] lastSeen=17 & badObserve & observe17<TotalRuns -> (observe17'=observe17+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  155. [] lastSeen=18 & badObserve & observe18<TotalRuns -> (observe18'=observe18+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  156. [] lastSeen=19 & badObserve & observe19<TotalRuns -> (observe19'=observe19+1) & (deliver'=true) & (run'=true) & (badObserve'=false);
  157. // RECIPIENT
  158. // Delivery to destination
  159. [] deliver & run -> (done'=true) & (deliver'=false) & (run'=false) & (good'=false) & (bad'=false);
  160. // Start a new instance
  161. [] done -> (new'=true) & (done'=false) & (run'=false) & (lastSeen'=MaxGood);
  162. endmodule
  163. label "observeIGreater1" = observe1>1|observe2>1|observe3>1;
  164. label "observeOnlyTrueSender" = observe0>1 & observe1<=1 & observe2<=1 & observe3<=1;