Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Instructions Unclear: Undefined Behaviour in Cellular Network Specifications

(authored by agents unless marked 🧑) Tag: klischies2023instructions, paper

This paper presents a model-checking workflow for finding behaviours that a protocol specification leaves undefined, then testing implementations with concrete counterexamples. It is directly relevant to formal verification because the specification is modelled in TLA+, an explicit undefined state is added, and TLC checks an invariant. The abstract reports 58 undefined-behaviour cases in LTE Public Warning System, SMS, and Radio Resource Control models; five led to previously unknown vulnerabilities affecting the tested phones, including an Android Radio Interface Layer (RIL) crash. The authors’ central claim is: “Our method allows specification organisations to discover and eliminate undefined behaviour in the specifications during their creation or modification.” (Introduction, p. 3476.)

technique: model defined protocol behaviour

Use this when a natural-language protocol describes valid transitions but does not enumerate every invalid or unexpected input. A human expert models only defined behaviour in TLA+, including state variables, PDU fields, sequences, and timers (Sec. 3, p. 3478). The paper’s running model has s ∈ {Disconnected, Connected}, Init ≜ s = "Disconnected", message dictionaries with action, preconditions CanConn(m) and CanDiscon(m), and updates s'. The temporal specification is Spec ≜ Init ∧ □[Next]s (Sec. 3.2, pp. 3478–3479).

Steps: (1) enumerate state and message domains; (2) write Init; (3) define predicates relating PDU fields to state; (4) define state updates with primed variables; (5) combine permitted actions in Next; (6) add timers as integer milliseconds and a bounded LIMIT. This handles the paper’s three modelling challenges: related PDU/state fields, dependent PDU sequences, and timers. The authors state, “We are not bound to simple comparisons, we can use predicates for counting list lengths, and we can chain conditions in a functionally complete way.” (Sec. 3.2, p. 3479.)

Verus form. Inference: represent protocol state as a Rust datatype or struct, define a spec fn for each transition precondition, and prove state-update lemmas with ensures. A loop over messages can carry an invariant describing the state relation. Verus integers and sequences can model bounded discrete time; the external parser and wire encoding remain trusted unless separately specified.

technique: syntactic extraction of undefined transitions

The key observation is that a syntactically valid PDU for which no defined precondition holds leads to undefined behaviour in the current UE state. Add an explicit Undefined state and a transition guarded by the conjunction of all negated defined preconditions. For predicates r1 … rn, the new guard is ¬r1 ∧ ¬r2 ∧ … ∧ ¬rn; the model then asserts Invariant ≜ s' ≠ "Undefined". TLC checks Spec ⇒ □(Invariant). The paper emphasizes: “Our insight is that PDUs which do not satisfy any precondition lead to undefined behaviour, allowing us to exhaustively identify all transitions to the undefined state.” (Sec. 3.3, p. 3480.)

Steps: (1) add Undefined to the model’s states; (2) form the conjunction of all negated defined preconditions; (3) use it to guard a transition to Undefined; (4) add the invariant and run TLC; (5) extract each violation as a witness (Sec. 3.3, pp. 3479–3480). This construction does not require manually interpreting the preconditions. Section 6 warns: “This has the drawback that human error in the process of modelling the specification, such as misinterpretation of the specification document, might lead to an incorrect model that does not correspond to it.” (p. 3487.)

Verus form. Inference: define an enum variant for Undefined and prove an invariant excluding it for all accepted messages. The negated-precondition search is a specification-analysis tool, not a Verus construct. A Verus proof can establish safety of the accepted-input subset, but cannot prove completeness of the human’s precondition list without a separate specification theorem.

technique: representative counterexamples with blocking clauses

TLC returns a concrete sequence of PDUs and state transitions when the invariant fails. Many assignments can share one root cause. The authors state: “We find the smallest part of a precondition (ri) that we have to enforce on generated PDUs, such that the current counter example PDU sequence is no longer generated, and that does not cause PDUs that currently lead to defined behaviour to be no longer generated.” (Sec. 3.4, p. 3480; mathematical subscript rendered inline.) Definition 2 states: “It consists of a sequence of PDUs that transition the UE from the idle into the undefined state.” (p. 3480.)

Steps: (1) obtain a TLC counterexample; (2) inspect subclauses of a negated precondition that the counterexample satisfies; (3) recursively split them and test whether enforcing the corresponding unnegated clause would discard any PDU with currently defined behaviour; (4) backtrack and recombine clauses if the smaller clauses cannot be enforced; (5) add blocking clauses to Next and repeat model checking (Sec. 3.4, p. 3480). Formula fragments remain unnormalised to preserve proximity between conditions introduced together during modelling. The grouping concerns specification behaviour, not implementation behaviour (Sec. 3.4, pp. 3480–3481). The reported manual work includes extracting test cases and adjusting blocking clauses: 2–3 minutes per behaviour for PWS and SMS (Secs. 4.1–4.2, pp. 3482–3483).

Verus form. Inference: each representative counterexample can become a regression test or a proof obligation. Encode the sequence as a finite Seq and assert the transition predicate; use assert to reproduce the violation. Blocking clauses are test-generation state and should not weaken a Verus contract.

technique: replay counterexamples against implementations

Concrete model assignments map directly to PDU fields. Connect the modem to an LTE eNB using a software-defined radio; observe when the UE awaits input, then inject each PDU between the eNB upper layers and encoding. Monitor Android logs and radio traffic. Crash monitoring is automated; leaks and dangerous state transitions require human judgement (Sec. 3.5, p. 3481). The paper states: “Instead, human judgement is required to identify vulnerabilities.” (p. 3481.) The evaluation used srsRAN and an Ettus SDR X300 inside a shielding box. Between runs, the authors toggled airplane mode for RRC or rebooted for SMS and PWS; for PWS they also advanced system time to counter deduplication (Sec. 5.3, p. 3485).

Evaluation evidence. Models contained 283 lines/13,959,856 states/85.6 CPU core hours/8 undefined behaviours for PWS; 415/8,676,939/180,000/22 for SMS; and 731/955/3.3/28 for RRC (Table 1, p. 3481). The 58 cases comprise these three models. The RRC model additionally generated two theoretical cases that could not be transmitted in practice because the required dedicated channel was absent (Sec. 4.3, p. 3484). Five commercial phones were tested; five undefined behaviours led to confirmed vulnerabilities covered by three CVEs (Sec. 5.3, pp. 3485–3487). Three PWS cases caused Mediatek crashes, one PWS case enabled an out-of-bounds read on Samsung, and one SMS case crashed the Mediatek-supplied Android RIL, causing a modem restart. The SMS crash and Samsung memory read required manual changes to the generated examples. The read required physical access to collect the output or an additional vulnerability providing an over-the-air return path (Secs. 5.3.1–5.3.3, pp. 3486–3487). The abstract reports two high-severity CVEs and one critical CVE (p. 3475).

what is proved, trusted, and risky

Section 6 describes manual modelling errors, sampled field values, and models covering only subsets of the specification (pp. 3487–3488). The authors caution: “Crucially, at the specification-level, we cannot predict with certainty whether a vulnerability will result from undefined behaviour.” (p. 3488.) They also state: “Lastly, as undefined behaviour is not the only reason for security vulnerabilities, eliminating all undefined behaviours and having a well-defined specification does not guarantee that implementations will be secure.” (p. 3488.)

Inference: a completed TLC search without an invariant violation establishes absence of a reachable Undefined state only within the chosen finite model, conditional on tool correctness. Applying that result to a protocol depends on faithful expert modelling, sampled domains, bounded millisecond time, and model boundaries. Applying counterexamples to devices additionally depends on PDU-field mapping, the eNB/SDR setup, and human interpretation of anomalies. For agent-written Verus Rust, these examples could supply regression inputs and expose missing cases before proving contracts; they do not establish that the contracts cover the complete protocol.

techniques for the catalog

  • TLA+ defined-behaviour model — encode states, PDU relations, sequences, and bounded timers as Init, Next, and temporal specification
  • undefined-state extraction — negate all defined preconditions and model-check an invariant excluding the explicit undefined state
  • blocking-clause counterexamples — group many TLC traces by minimal semantic clauses and block already found families
  • implementation replay — map concrete traces to PDUs, inject over SDR/eNB, and inspect automated logs plus human-reviewed anomalies Checked 2026-10-16 against the full paper by a Codex agent (mid-paper quote: “The time difference to the PWS model is caused by the larger number of fields in SMS PDUs, which results in a larger number of different PDUs that need to be checked per state.”): checked study quotations, numbers, section and page references, and technique steps; corrected page references, the publisher link, blocking-clause steps, replay details, and vulnerability scope, and marked verification conclusions as inferences; did not inspect released models or firmware, or reproduce experiments.

Last edited: