tlaplus / Examples

A collection of TLA⁺ specifications of varying complexities
Other
1.29k stars 200 forks source link

Case study to share: Specifying and Verifying SDP Protocol based Zero Trust Architecture #56

Closed 10227694 closed 1 year ago

10227694 commented 1 year ago

My case to share is about the TLA+ Spec of Software Defined Perimeter (SDP) architecture and algorithm based on the open source project fwknop.

https://github.com/10227694/SDP_Verification

The subdirectory SDP_Attack_Spec contains the specification based on the following materials: ( https://cloudsecurityalliance.org/artifacts/software-defined-perimeter-zero-trust-specification-v2/ ) ( http://www.cipherdyne.org/fwknop/ )

The subdirectory SDP_Attack_New_Solution_Spec contains the specification for the improved SDP architecture and algorithm which fixed the discovered vulnerability.

The slide "Specifying and Verifying SDP Protocol Based Zero Trust Architecture Using TLA+.pptx" contains the key description of the reserach work.

For detail descriptions, please refer to:

https://dl.acm.org/doi/10.1145/3558819.3558826

muenchnerkindl commented 1 year ago

Thank you for sharing your valuable contribution. I believe it would make a very nice addition to the collection of TLA+ specifications.

A few comments on how you could improve your spec, in roughly decreasing order of importance:

FwProcAclTimeOut == \E r \in AclRuleSet : *aging and deleted randomly,remove from current rule table /\ r.sPort = MATCH_ANY /\ FwState = "Work" /\ AclRuleSet # {} * --- actually superfluous because we require r \in AclRuleSet /\ AclRuleSet' = AclRuleSet \ {r} /\ AgedRuleSet' = AgedRuleSet \cup {r} * record aged rule into log. /\ UNCHANGED user_vars /\ UNCHANGED sdpsvr_vars /\ UNCHANGED attacker_vars /\ UNCHANGED <<FwState,DropPackets>> /\ UNCHANGED server_vars /\ UNCHANGED Public_vars

As a rule of thumb, CHOOSE should be used only if there is exactly one value that matches the predicate.

UsrRcvSynAck == /\ uState = "Connecting" /\ uTCPLinkSet # {} /\ uChannel # <<>> /\ Head(uChannel).Flg = "TCP_SYN_ACK" /\ Head(uChannel).Type = "User" /\ HasMatchLink(Head(uChannel),uTCPLinkSet) * Receive TCP_SYN_ACK from target server and match the connecting TCP socket /\ LET l == GetMatchLink(Head(uChannel),uTCPLinkSet) IN uTCPLinkSet' = (uTCPLinkSet \ {l}) \cup { [sIP |-> l.sIP, sPort |-> l.sPort, dIP |-> l.dIP, dPort |-> l.dPort, State |-> "ESTABLISHED" * Updata TCP link status to established ]
} /\ uState' = "Connected" * The user successfully access the target server /\ uChannel' = Tail(uChannel) *Send TCP ACK packet (the last step of hand shake) to target server /\ FwDataChannel' = Append(FwDataChannel, EndPointBulidTcpAckPkt(Head(uChannel),"User")) /\ UNCHANGED <<uIP, uID, Key, uTstamp, uSDPSvrInfo, uSvrInfo, uAuthSession>> /\ UNCHANGED sdpsvr_vars /\ UNCHANGED fw_vars /\ UNCHANGED attacker_vars /\ UNCHANGED server_vars /\ UNCHANGED <<AuthChannel,FwCtlChannel,aChannel,sChannel>>

FindAntiReplay(msg,wnd) == \E r \in wnd : (msg.ClientID = r.ClientID /\ msg.Tstamp = r.Tstamp)

NewLink(p,LinkSet) == \/ LinkSet = {} * -- in fact, this disjunct is superfluous because \A x \in {} : ... is TRUE \/ \A x \in LinkSet: ( *without matching TCB (TCP Control Block) \/ x.sIP # p.sIP \/ x.dIP # p.dIP \/ x.sPort # p.sPort \/ x.dPort # p.dPort )

When you are satisfied with your spec, please open a pull request so that we can merge it into the collection.

Thanks again!

Stephan

lemmy commented 1 year ago

Merged with https://github.com/tlaplus/Examples/commit/d4c01e908fe728f546cad4812b0efd2c39e50672