Source-linked AI summary

Towards Tackling Application Logic Flaws through Autonomous Formal-Logic Modeling and Automated Reasoning

Yiwei Fang, Yichen Liu, Ze Jin, Haoqiang Wang, Qixu Liu, Luyi Xing

arXiv:2609.10537v1cs.CR

TL;DR

Application-level logic flaws are difficult to analyze across systems with diverse semantics and threat models. LL-Verifier uses LLMs to create formal protocol models and logic model checking to verify security goals; its IoT analysis found 35 flaws across 27 devices, including 30 previously unknown flaws among 23 vendors.

  • Problem

    Application-level logic flaws depend on context-specific semantics and threat models, making their discovery and reasoning difficult to scale.

    Source: §1 · pp. 1–2
  • Method

    LL-Verifier uses LLMs to generate Les models and LTL properties from protocol descriptions and security goals, then compiles the models into logical state machines for model checking.

    Source: §1 · p. 2, §2.5 · p. 6
  • Results

    35 logic flaws were found across 27 unique devices, including 30 previously unknown flaws among 23 vendors.

    Source: §1 · p. 3
  • Takeaways & Limitations

    The authors implemented proof-of-concept attacks for all new flaws, reported the zero-days, and received acknowledgments from the CSA and 14 vendors that were releasing patches.

    Source: §1 · p. 3

    The current implementation supports two security goals: remote attacker acquisition of device ownership and unauthorized device control.

    Source: §3.3.3 · p. 9

Abstract

from arXiv · show

Logic flaws pose significant challenges in the design and implementation of modern, semantically rich systems and applications, impacting security, privacy, and trust. These flaws are inherently tied to business-specific semantics and threat models, making their discovery and reasoning difficult and hard to scale. Real-world systems often exhibit diverse application features, complex protocol logic, and domain-specific threat models, necessitating substantial human effort and domain expertise for effective security analysis. In this paper, we introduce LL-Verifier, a novel, automated framework for identifying logic vulnerabilities built on (1) large language models for autonomous modeling, and (2) logic model checkers for rigorous reasoning. LL-Verifier processes natural language inputs, in particular protocol descriptions and security goals, to automatically generate formal logic models and properties expressed in a new logic language built on a generic logic language Maude, optimized for modeling arbitrary application-level semantics. These formal models are then converted into logical state machines, enabling exhaustive, rigorous verification through logic level model checking. This approach streamlines the analysis of diverse, application-level protocols deployed in real-world scenarios, offering automated, exhaustive, and precise reasoning within their logical constraints. We evaluated the high effectiveness, efficiency, and practicality of LL-Verifier by applying it to 27 access control protocols of widely used IoT devices, which come with vendor-specific logic flows and semantics. While LL-verifier tackles a hard problem in application security, i.e., automatic logic flaws discovery, our analysis uncovers a range of sophisticated logic vulnerabilities in IoT protocols and devices with serious security and privacy implications.

1. Introduction

LL-Verifier combines LLM-assisted formal modeling with logic model checking to analyze application-level protocols and their customized security goals. Applied to IoT devices, it identified logic flaws, including previously unknown vulnerabilities.

1. Introduction

  • Application-level logic flaws arise from design weaknesses in specific semantic contexts and can evade traditional static analysis, dynamic analysis, and fuzzing.Existing formal methods struggle to scale across diverse application semantics, while prior modeling often requires manual effort or domain experts.Source: §1 · p. 1
  • LL-Verifier uses LLM agents to turn protocol descriptions and customized security goals into formal models and LTL properties for model checking.The framework organizes protocol information into components, uses few-shot prompting and an embedded program analyzer, and adjusts rule determinism to the threat model.Source: §1 · pp. 2–3
  • LL-Verifier introduces Les, an LLM-compatible modeling framework with guardrails and a compiler that translates models into logical state machines for exhaustive checking.Its threat modeling distinguishes deterministic protocol execution from non-deterministic attacker events.Source: §1 · p. 2
  • 35 logic flaws were found across 27 unique devices, including 30 previously unknown flaws among 23 vendors.The authors implemented proof-of-concept attacks for all new flaws and reported the zero-days to affected vendors.Source: §1 · p. 3
  • Logic-Modeling Bench evaluates semantic-element coverage and modeling accuracy across 29 application-level protocols, including protocols from 24 vendors and five prior papers.The reported evaluation found high coverage and high accuracy.Source: §1 · p. 3

2. Les: A Logic Modeling Framework

Les provides an LLM-friendly language and modeling guardrails for representing application protocols as logical state machines. Its rules model protocol state changes and event generation, and its compiler makes models executable by Maude for exhaustive checking.

2. Les: A Logic Modeling Framework

  • Les combines a modeling language, formal modeling guardrails (FMG), and a compiler to guide LLMs in generating models of varied application-level protocols.The guardrails constrain model formats and structures while retaining flexibility for diverse protocol semantics.Source: §2 · p. 3

2.1. Foundational Logic Symbols and Types

  • Σ supplies basic and guardrail symbols and types for representing protocol semantic elements, including principals, their internal states, and events.The guardrails are intended to help formulate principals, their attributes or knowledge, and the operations they perform.Source: §2.1 · pp. 3–4

2.1.1. Basic Symbols and Types.

  • The basic type system defines Item for data values, Pair for key-value pairs, and Principal with User, Device, and Cloud as subsorts.Bool, Qid, and Nat are subsorts of Item.Source: §2.1.1 · p. 4, §2.1.2 · p. 4

2.1.2. Guardrail Symbols and Types.

  • Les represents each principal’s internal state as attributes and uses event syntax to express actions between principals, including API calls and arguments.A logical state comprises the internal states of the principals included in the protocol model.Source: §2.1.2 · p. 4

2.2. State-Transitional Rules to Model Protocol Rules

  • State-transitional rules encode protocol changes as premises and conclusions, distinguishing trusted deterministic rules from threat-model-dependent non-deterministic rules.The running iRobot example models a cloud replacing a device’s recorded binding key when the device calls its setKey API.Source: §2.2 · pp. 4–5

2.3. A Running Example of iRobot

  • In the iRobot root-trust example, the cloud records a user as device owner when the user presents the same binding key that the device supplied.The described normal flow has the user press the device button, set a key, and have the device send that key to the cloud.Source: §2.3 · p. 5

2.4. Modeling Protocol Events Generation

  • Event-generation rules model conditional events based on protocol state and knowledge, with event determinism depending on whether the acting principal is trusted.For example, the model can generate a bind request using a key present in a user’s knowledge.Source: §2.4 · pp. 5–6

2.5. Les Model Compiler

  • The Les compiler translates deterministic rules into equations and non-deterministic rules into rewrite rules, producing a Maude-compatible rewrite theory for model checking.The resulting theory corresponds to a logical state machine whose states include principal states and the most recent event.Source: §2.5 · p. 6

3. Autonomous Les Modeling and Formal Reasoning

LL-Verifier turns organized natural-language protocol and threat-model descriptions into Les models, compiles them into logical state machines, and checks them against security properties. Its design combines LLM-based formalization with grammar and semantic guardrails and automated model checking.

3. Autonomous Les Modeling and Formal Reasoning

  • LL-Verifier generates Les models, compiles them into logical state machines, and uses model checking to identify protocol logic flaws.The three stages are autonomous generation, Les model building with automated repair, and logical model checking.Source: §3 · p. 6

3.1. Overview of LL-Verifier

  • Preprocessing groups inputs into four semantic segments, and a human checks that protocol rules capture conditions, events, and consequences.The segments cover protocol rules, event generation, initial state, and threat models with desired security properties.Source: §3.1 · p. 6
  • The Logic-Modeling Bench contains raw descriptions, organized texts, and formal models for 29 protocols from 28 IoT and mobile vendors.Source: §3.1 · p. 6
  • Collaborative LLM agents formalize the four input segments as state-transition rules, event-generation rules, an initial logical state, and security properties.Source: §3.1 · p. 7
  • The compiler converts Les models and properties into Maude-compatible rewrite theories, which the Maude LTL model checker evaluates.The implementation used 2,564 lines of Python and 157 lines of Maude; source code and prompts were released online.Source: §3.1 · p. 7

3.2.1. Formalization Agents.

  • AgentS models protocol-specific principals, attributes, and rules, while AgentE reuses their names to generate event rules and templates.A lightweight analyzer identifies principals and attributes from state-transition rules to build internal state templates.Source: §3.2.1 · p. 7

3.2.2. Guardrail Agents for Grammar and Semantics Correctness.

  • Guardrail agents iteratively check Les grammar and semantics, using EBNF prompts, Lark checks, and repair routines for recurring modeling errors.Grammar checks ran up to three times per protocol, enough for grammar correctness across the 29 studied protocols.Source: §3.2.2 · pp. 7–8

3.3. Threat Model and Security Goals in Les

Les represents application-level security goals using propositions over states, events, and traces, and models customized threat behavior through deterministic and nondeterministic rules. Its LTL properties let the model checker search for violation traces within the specified threat model.

3.3.1. Modeling Primitive Propositions in Les.

  • Les propositions describe properties of logical states, events, or traces, with Linear Temporal Logic operators expressing relations across time.Source: §3.3.1 · p. 8
  • Les evaluates primitive propositions against logical states and their most recent events, enabling the model checker to identify property counterexamples.The ⊢ notation defines logic propositions for the Maude LTL model checker.Source: §3.3.1 · p. 8

3.3.2. Modeling Threat Models in Les.

  • Threat models can mark principals untrusted, making their associated rules nondeterministic, and can explicitly override protocol rules with matching premises.The framework also encodes attacker actions interleaved with a benign user’s deterministic sequence, including constrained windows for injecting operations.Source: §3.3.2 · pp. 8–9

3.3.3. Modeling Security Goals/Properties in Les.

  • The paper currently supports two security goals: an attacker remotely gaining device ownership and unauthorized device control.Goals are LTL formulas for violation traces; checking is bounded by the customized threat model, so satisfying traces are confirmed flaws within that scope.Source: §3.3.3 · p. 9

3.4. An Attack Trace in the iRobot Protocol

The iRobot counterexample shows a malicious user exploiting temporary physical access to take control of a device and erase its legitimate owner’s cloud record.

3.4. An Attack Trace in the iRobot Protocol

  • After the legitimate owner binds the device, a malicious user with temporary physical access presses its button.Source: §3.4 · p. 9
  • The device accepts a rogue KeyA from the malicious user’s app and synchronizes it with the cloud.Source: §3.4 · p. 9
  • The malicious user remotely uses KeyA to invoke the reset API, erasing the legitimate owner’s cloud record.Source: §3.4 · p. 9

4. Evaluation

LL-Verifier found confirmed logic flaws on real devices and modeled many protocol elements with high reported coverage, though property modeling was less complete. Comparisons also show higher coverage and fewer execution failures than direct Maude modeling in the tested protocols.

4. Evaluation

  • 30 zero-day logic flaws were identified, all confirmed on real devices.Source: §4 · p. 9
  • LL-Verifier modeled 98.3% of principals with 1.7% false positives, 99.3% of attributes with 1.4% false positives, 96.8% of rules, and 64.3% of properties.Source: §4 · p. 9
  • 65.5% of logic flaws were checkable without human intervention; remaining defective models required 2.3 manual corrections on average.Source: §4 · p. 9
  • On three protocols, LL-Verifier models executed without errors and achieved full coverage, while Maude models had runtime failures and covered only 27/44 rules and 27/30 attributes.Source: §4 · p. 10
  • All five tested LLMs exceeded 70% coverage in modeling principals, attributes, rules, and events; four generated at least one flaw-revealing model without human intervention.Source: §4 · p. 10
  • Across 29 protocol models, the LSM Runner took 462 milliseconds on average and used at most 75,860 KB of memory.The figures are based on an average of ten executions.Source: §4 · p. 10

5. Logic Flaws in Application-Level IoT Access Protocols

LL-Verifier uncovered logic flaws across IoT root-trust, interoperability, and collaborative access-control protocols. The findings include attacks on binding and authorization, including privilege that persists after revocation.

5. Logic Flaws in Application-Level IoT Access Protocols

  • 35 logic flaws across 28 vendors included 30 zero-day flaws and four previously known flaws in interoperability and collaborative access control.The paper groups the protocols into root trust establishment, interoperability, and collaborative access control.Source: §5 · p. 10

5.1. IoT Root Trust Establishment (RTE)

  • RTE protocols establish a device’s root user; older designs that allowed binding with only a device identifier could be compromised if that identifier leaked.The paper notes that current vendor protocols are more diverse and often more sophisticated than those earlier designs.Source: §5.1 · p. 10

5.1.1. RTE P1: User-and-Device Provers.

  • In RTE P1, iRobot’s retained binding key can be reused to disrupt ownership, while a Philips Hue attacker sharing the victim’s outbound IP can capture the binding key and bind first.The Hue cloud may deliver the key to any user sharing the device’s outbound IP address.Source: §5.1.1 · pp. 10–11

5.1.2. RTE P2: User Prover.

  • In RTE P2, Broadlink guest access tokens also serve as binding tokens, and Netvue accepts guest-held binding keys for repeated binding, even after ownership changes.A looping script can also race a benign user when an owner resets a lock’s binding.Source: §5.1.2 · pp. 11–12

5.1.3. RTE P3: Device Prover.

  • In RTE P3, a malicious user can replace the victim’s TP-Link Kasa binding key before the device presents a key to the cloud, binding the device to the attacker.The attack can be run by a nearby user or malicious code on the victim’s phone.Source: §5.1.3 · p. 12

5.2. IoT Interoperability

  • In Aqara, a delegated guest can use Matter RTE to bind with a device, and that device-side binding persists after the owner revokes the guest in the Aqara app.The resulting binding lets the guest continue operating the device; Tuya has a similar flaw.Source: §5.2 · pp. 12–13

5.3. Collaborative IoT Access Control

  • In collaborative access control, Tuya’s cloud may revoke a guest while the device still accepts the guest’s local key; several other vendors have similar flaws.The cloud rejects requests using both keys, but the device permits operation with the local key alone.Source: §5.3 · p. 13

5.4. Discussions

  • The authors report pervasive, subtle logic flaws in the studied vendors’ devices despite production-level security review, suggesting current review practices are less effective or hard to scale for these flaws.The discussion argues that application logic needs comprehensive modeling and reasoning.Source: §5.4 · p. 13

6. Related Work

Prior work has addressed protocol modeling, logic-flaw analysis, and model checking, but often relies on manual, domain-specific modeling. LL-Verifier targets autonomous modeling across application-level semantic contexts.

  • Prior logic-flaw studies relied on empirical analysis or substantial manual effort, while more automatic testing and model-guided approaches are typically domain-specific and still need significant human effort.The paper positions LL-Verifier as a general, automatic approach across application domains.Source: §6 · p. 13
  • Prior natural-language model generation targeted cryptographic protocols, while LL-Verifier aims to model application-level protocols with varied semantics and domains.Existing model-checking tools have also commonly been applied to specific application domains.Source: §6 · pp. 13–14
  • Earlier protocol-modeling work generally required experts to identify system-specific semantics and manually define how to represent them in a modeling language.The process was also tailored to individual systems or domains.Source: §6 · p. 13

7. Conclusion

The paper presents LL-Verifier for automated logic-flaw identification through LLM-assisted modeling and automated verification. It reports 30 zero-day logic flaws among 28 IoT vendors.

  • LL-Verifier uses LLMs to model and specify real-world systems, then automatically verifies them for security flaws.Source: §7 · p. 14
  • 30 zero-day logic flaws were identified among 28 IoT vendors.Source: §7 · p. 14
  • The conclusion presents the findings as evidence of LL-Verifier’s effectiveness in improving IoT security.Source: §7 · p. 14

1. Other Logic Flaw Types

CloudEdge’s RTE uses a user-specific account identifier as a binding key, allowing an attacker to bind a malicious device to a victim’s account.

  • CloudEdge’s “phoneMac” binding key uniquely identifies the user account, with only three user-specific characters in the illustrated format.Source: §1 · p. 17
  • An attacker can use a victim’s “phoneMac” to bind a malicious device to the victim’s account because the identifier is subject to brute-force enumeration.Source: §1 · p. 17
  • When the victim opens the app, the attacker’s device may appear on the launch screen with its contents, which may be intimidating or harassing.Source: §1 · p. 17

2. Automatic repairing example.

LL-Verifier iteratively repairs generated formal models using strategies tailored to four error classes. The example shows parser-guided and syntax-tree repairs that turn malformed rules into well-formed Maude code.

Automatic repairing example.

  • LL-Verifier distinguishes four mistake classes and assigns each a tailored repair strategy.K1 uses string-level manipulation; K2 forwards parsing errors to the LLM; K3 prompts the LLM with candidate fixes; K4 uses AST manipulation.Source: §2 · p. 17
  • An iterative repair loop checks generated outputs for K1–K4 mistakes and invokes the corresponding repair routine.The four strategies include string manipulation, LLM revision from parsing errors, LLM-selected fixes for inconsistencies, and direct AST manipulation.Source: §2 · pp. 17–18
  • Removing a C-style comment fixes K2 parsing failure, while copying a missing RHS variable to the LHS fixes a K4 rule-structure error.In the example, these repairs make the rule parsable and well-formed.Source: §2 · p. 18

3. Evaluation discussion

The evaluation discussion identifies errors in generated formal models, including duplicated internal states and omissions that can leave Maude code incomplete. Addressing the observed issues can reduce the overall error rate by 75%.

Evaluation discussion

  • 75%: Addressing the observed generated-model errors can reduce the overall error rate.The discussion identifies duplicated internal states and omissions among the issues.Source: §3 · p. 18
  • Duplicated internal states for one principal conflict with state-transition rules and prevent correct reasoning; merging those states is a K4 repair.Such duplicates were observed in protocols from Broadlink, Aqara, Dyson, and Huawei.Source: §3 · p. 18
  • Omitted proposition definitions and LLM revisions containing only modified portions can leave generated Maude code incomplete.The omissions were observed in models of Philips, TPLink, and Level.Source: §3 · p. 18
Loading 2609.10537v1…