maude tool: 'maude'
 checking version: 3.5.1. OK.
 checking installation: OK.
[Theory C_NOMA] Theory loaded
[Theory C_NOMA] Theory translated
[Theory C_NOMA] Theory closed
[Saturating Sources] Step 1 (Max 5)
[Saturating Sources] Step 2 (Max 5)
[Saturating Sources] Done
theory C_NOMA

begin

// Function signature and definition of the equational theory E

functions: fst/1, h/1, kdf/2, mac/2, pair/2, sdec/2, senc/2, snd/1
equations:
    fst(<x.1, x.2>) = x.1,
    sdec(senc(x.1, x.2), x.2) = x.1,
    snd(<x.1, x.2>) = x.2

restriction OnlyOnce:
  "∀ x #i #j. ((OnlyOnce( x ) @ #i) ∧ (OnlyOnce( x ) @ #j)) ⇒ (#i = #j)"
  // safety formula

  /*
  expanded formula:
  "∀ x #i #j. ((OnlyOnce( x ) @ #i) ∧ (OnlyOnce( x ) @ #j)) ⇒ (#i = #j)"
  */

restriction RevokedIsFinal:
  "∀ rid #i #j. ((Revoke( rid ) @ #i) ∧ (Active( rid ) @ #j)) ⇒ (#j < #i)"
  // safety formula

  /*
  expanded formula:
  "∀ rid #i #j. ((Revoke( rid ) @ #i) ∧ (Active( rid ) @ #j)) ⇒ (#j < #i)"
  */

restriction ClosedIsFinal:
  "∀ N gid #i #j.
    ((CloseGroup( N, gid ) @ #i) ∧ (Open( N, gid ) @ #j)) ⇒ (#j < #i)"
  // safety formula

  /*
  expanded formula:
  "∀ N gid #i #j.
    ((CloseGroup( N, gid ) @ #i) ∧ (Open( N, gid ) @ #j)) ⇒ (#j < #i)"
  */

restriction OnceJoin:
  "∀ rid N #i #j.
    ((OnceJoin( rid, N ) @ #i) ∧ (OnceJoin( rid, N ) @ #j)) ⇒ (#i = #j)"
  // safety formula

  /*
  expanded formula:
  "∀ rid N #i #j.
    ((OnceJoin( rid, N ) @ #i) ∧ (OnceJoin( rid, N ) @ #j)) ⇒ (#i = #j)"
  */

rule (modulo E) Gateway_Setup:
   [ Fr( ~sky ) ]
  --[ OnlyOnce( 'gateway' ), GwKeyGen( ~sky ) ]->
   [ !GwKey( ~sky ) ]

  /* has exactly the trivial AC variant */

rule (modulo E) Register_Device:
   [ Fr( ~rid ), Fr( ~kreg ), Fr( ~pid ), Fr( ~L ), Fr( ~cid ), Fr( ~z ) ]
  --[ Registered( ~rid ), RegKey( ~rid, ~kreg ) ]->
   [
   !Dev( ~rid, ~kreg, ~pid, ~L, ~cid, ~z ),
   !Rec( ~rid, ~kreg, ~pid, ~L, ~cid, ~z ), Out( ~L )
   ]

  /* has exactly the trivial AC variant */

rule (modulo E) Start_Visit:
   [ Fr( ~N ) ] --[ VisitStart( ~N ) ]-> [ !Visit( ~N ), Out( ~N ) ]

  /* has exactly the trivial AC variant */

rule (modulo E) Open_Group:
   [ !Visit( N ), Fr( ~gid ) ]
  --[ OpenGroup( N, ~gid ) ]->
   [ !Group( N, ~gid ), Out( ~gid ) ]

  /* has exactly the trivial AC variant */

rule (modulo E) Close_Group:
   [ !Group( N, gid ) ] --[ CloseGroup( N, gid ) ]-> [ ]

  /* has exactly the trivial AC variant */

rule (modulo E) Join_Visit:
   [ !Rec( rid, kreg, pid, L, cid, z ), !Visit( N ) ]
  --[ OnceJoin( rid, N ) ]->
   [ Unserved( rid, N ) ]

  /* has exactly the trivial AC variant */

rule (modulo E) Issue_Authorization:
   [ !Rec( rid, kreg, pid, L, cid, z ), !GwKey( sky ), !Group( N, gid ) ]
  --[
  IssueAuth( rid, N, gid, $q, $ord, $mcs ),
  IssueMac( sky, <pid, L, $q, N, gid, $msn, $ord, $mcs> )
  ]->
   [
   Out( <L, N, gid, $msn, $mcs> ),
   Out( senc(<<$q, mac(sky, <pid, L, $q, N, gid, $msn, $ord, $mcs>), $ord>, 
              L, N, gid, $msn, $mcs>,
             kdf(kreg, <'PA', L, N, gid>))
   )
   ]

  /* has exactly the trivial AC variant */

rule (modulo E) Device_Send:
   [
   !Dev( rid, kreg, pid, L, cid, z ),
   In( senc(<
             <$q, mac(sky, <pid, L, $q, ~N, ~gid, $msn, $ord, $mcs>), $ord>, L, ~N, 
             ~gid, $msn, $mcs>,
            kdf(kreg, <'PA', L, ~N, ~gid>))
   ),
   Fr( ~nu )
   ]
  --[
  DevSend( rid,
           <L, ~nu, $q, mac(sky, <pid, L, $q, ~N, ~gid, $msn, $ord, $mcs>), ~N, 
            ~gid, $msn, $ord, $mcs>
  )
  ]->
   [
   DevWait( rid, kreg,
            <L, ~nu, $q, mac(sky, <pid, L, $q, ~N, ~gid, $msn, $ord, $mcs>), ~N, 
             ~gid, $msn, $ord, $mcs>,
            cid, pid, z
   ),
   Out( <L, ~nu, $q, mac(sky, <pid, L, $q, ~N, ~gid, $msn, $ord, $mcs>), 
         ~N, ~gid, $msn, $ord, $mcs>
   ),
   Out( senc(<<cid, pid, z>, L, ~nu, $q, 
              mac(sky, <pid, L, $q, ~N, ~gid, $msn, $ord, $mcs>), ~N, ~gid, $msn, 
              $ord, $mcs>,
             kdf(kreg,
                 <'REQ', L, ~nu, $q, mac(sky, <pid, L, $q, ~N, ~gid, $msn, $ord, $mcs>), 
                  ~N, ~gid, $msn, $ord, $mcs>))
   )
   ]

  /* has exactly the trivial AC variant */

rule (modulo E) MSN_Forward:
   [ !Group( ~N, ~gid ), In( C ) ]
  --[ Forward( ~N, ~gid, C ) ]->
   [ Sec( <~N, ~gid, C> ) ]

  /* has exactly the trivial AC variant */

rule (modulo E) Gateway_Verify:
   [
   Sec( <~N, ~gid, 
         senc(<<cid, pid, z>, L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>,
              kdf(kreg, <'REQ', L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>))
        >
   ),
   !Rec( rid, kreg, pid, L, cid, z ), !GwKey( sky ), !Group( ~N, ~gid ),
   Unserved( rid, ~N ), Fr( ~nur ), Fr( ~rf )
   ]
  --[
  GwCommit( rid, <L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>,
            kdf(kreg, <'CTRL', cid, pid, z, ~rf, ~N>)
  ),
  GwAccept( rid, ~N, ~gid, $q, $ord, $mcs ), Accepted( rid, ~N ),
  Active( rid ), Open( ~N, ~gid )
  ]->
   [
   Out( <L, ~nur, ~N, ~gid, $msn> ),
   Out( senc(<
              <~rf, 
               mac(kdf(kreg,
                       <'GWCONF', <L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>, ~rf, ~N>),
                   <'GWCONF', <L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>, ~N>)
              >, 
              L, ~nur, ~N, ~gid, $msn>,
             kdf(kreg,
                 <'RESP', <L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>, L, ~nur, ~N, 
                  ~gid, $msn>))
   )
   ]

  /* has exactly the trivial AC variant */

rule (modulo E) Device_Accept:
   [
   DevWait( rid, kreg, <L, nu, q, tag, ~N, ~gid, msn, ord, mcs>, cid, pid, z
   ),
   In( senc(<
             <rf, 
              mac(kdf(kreg,
                      <'GWCONF', <L, nu, q, tag, ~N, ~gid, msn, ord, mcs>, rf, ~N>),
                  <'GWCONF', <L, nu, q, tag, ~N, ~gid, msn, ord, mcs>, ~N>)
             >, 
             L, nur, ~N, ~gid, msn>,
            kdf(kreg,
                <'RESP', <L, nu, q, tag, ~N, ~gid, msn, ord, mcs>, L, nur, ~N, ~gid, msn
                >))
   )
   ]
  --[
  DevAccept( rid, <L, nu, q, tag, ~N, ~gid, msn, ord, mcs>,
             kdf(kreg, <'CTRL', cid, pid, z, rf, ~N>)
  )
  ]->
   [ ]

  /* has exactly the trivial AC variant */

rule (modulo E) Revoke:
   [ !Rec( rid, kreg, pid, L, cid, z ) ] --[ Revoke( rid ) ]-> [ ]

  /* has exactly the trivial AC variant */

rule (modulo E) Reveal_Sky:
   [ !GwKey( sky ) ] --[ RevealSky( ) ]-> [ Out( sky ) ]

  /* has exactly the trivial AC variant */

rule (modulo E) Corrupt_Device:
   [ !Dev( rid, kreg, pid, L, cid, z ) ]
  --[ Corrupt( rid ) ]->
   [ Out( <kreg, pid, cid, z> ) ]

  /* has exactly the trivial AC variant */

lemma c_noma_attack:
  exists-trace
  "∃ rid N gid q o mc #i.
    ((GwAccept( rid, N, gid, q, o, mc ) @ #i) ∧
     (¬(∃ #j. IssueAuth( rid, N, gid, q, o, mc ) @ #j))) ∧
    (¬(∃ #r. RevealSky( ) @ #r))"
/*
guarded formula characterizing all satisfying traces:
"∃ rid N gid q o mc #i.
  (GwAccept( rid, N, gid, q, o, mc ) @ #i)
 ∧
  (∀ #j. (IssueAuth( rid, N, gid, q, o, mc ) @ #j) ⇒ ⊥) ∧
  (∀ #r. (RevealSky( ) @ #r) ⇒ ⊥)"
*/
simplify
solve( Sec( <~N, ~gid, 
             senc(<<cid, pid, z>, L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>,
                  kdf(kreg, <'REQ', L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>))
            >
       ) ▶₀ #i )
  case MSN_Forward
  solve( !Rec( rid, kreg, pid, L, cid, z ) ▶₁ #i )
    case Register_Device
    solve( !GwKey( sky ) ▶₂ #i )
      case Gateway_Setup
      solve( !Group( ~N, ~gid ) ▶₃ #i )
        case Open_Group
        solve( Unserved( ~rid, ~N ) ▶₄ #i )
          case Join_Visit
          solve( !KU( senc(<<~cid, ~pid, ~z>, ~L, nu, $q, tag, ~N, ~gid, $msn, 
                            $ord, $mcs>,
                           kdf(~kreg, <'REQ', ~L, nu, $q, tag, ~N, ~gid, $msn, $ord, $mcs>))
                 ) @ #vk )
            case Device_Send
            solve( !KU( senc(<
                              <$q, mac(sky, <~pid, ~L, $q, ~N, ~gid, $msn, $ord, $mcs>), $ord>, ~L, 
                              ~N, ~gid, $msn, $mcs>,
                             kdf(~kreg, <'PA', ~L, ~N, ~gid>))
                   ) @ #vk.1 )
              case c_senc
              solve( !KU( kdf(~kreg, <'PA', ~L, ~N, ~gid>) ) @ #vk.3 )
                case c_kdf
                solve( !KU( ~kreg ) @ #vk.20 )
                  case Corrupt_Device
                  solve( !KU( mac(sky, <~pid, ~L, $q, ~N, ~gid, $msn, $ord, $mcs>)
                         ) @ #vk.8 )
                    case c_mac
                    solve( !KU( ~L ) @ #vk.13 )
                      case Issue_Authorization
                      solve( !KU( ~N ) @ #vk.20 )
                        case Issue_Authorization
                        solve( !KU( ~gid ) @ #vk.25 )
                          case Issue_Authorization
                          solve( !KU( ~pid ) @ #vk.31 )
                            case Corrupt_Device
                            SOLVED // trace found
                          qed
                        qed
                      qed
                    qed
                  qed
                qed
              qed
            qed
          qed
        qed
      qed
    qed
  qed
qed

/* All wellformedness checks were successful. */

/*
Generated from:
Tamarin version 1.12.0
Maude version 3.5.1
Git revision: 82780bbaf3328a45f624ddb41e51bf75425f851c (with uncommited changes), branch: master
Compiled at: 2026-03-07 14:22:39.174278293 UTC
*/

end

==============================================================================
summary of summaries:

analyzed: c_noma_variant.spthy

  processing time: 10.04s
  
  c_noma_attack (exists-trace): verified (16 steps)

==============================================================================
