From Constraints to Cracks: Constraint Semantic Inconsistencies as Vulnerability Beacons for Embedded Systems

Jiaxu Zhao (Institute of Information Engineer)

34th USENIX Security Symposium (USENIX Security '25) · Day 1 · System Security 1: Threat Detection, Exploitation, and Adaptive Defenses

Overview

In the rapidly expanding landscape of connected devices, embedded systems form the backbone of countless IoT and network infrastructures. However, as these systems grow in complexity, the prevalence of vulnerabilities has surged, leading to critical risks such as data leaks, unauthorized device control, and service disruptions. This talk, presented by Jiaxu Zhao from the Institute of Information Engineering, Chinese Academy of Sciences, introduces a novel approach to addressing this escalating security challenge: identifying constraint semantic inconsistencies as reliable beacons for vulnerabilities in embedded systems.

Watch on YouTube · Read the paper · Download the PDF (PDF) · Slides

Paper abstract

Automating gadget chaining is a challenge that has attracted significant attention since the introduction of code-reuse attacks. Influenced by the primitives offered by stack-overflow vulnerabilities, several approaches were proposed that required the attacker to control the stack. Since then, most proposed approaches have had strong requirements on the capabilities of the attacker. However, during the last decade, a plethora of new attack primitives have emerged – e.g. use-after-free, heap-overflow – often breaking the requirements of existing approaches – e.g. controlling the stack. This paper presents a new approach to synthesizing code-reuse gadget chains that supports arbitrary exploitation primitives and layouts. We thoroughly compare the performance of our approach to the state-of-the-art. We show its ability to outperform its competitors by supporting intricate exploitation primitives and layouts that other approaches cannot. Especially, we demonstrate its real-world applicability by synthesizing gadget chains for ten real-world vulnerabilities with diverse exploitation primitives that competing tools struggle with. Among them is our case study: CVE-2022-46152 – which targets a widely used trusted execution environment.

Visual summary for From Constraints to Cracks: Constraint Semantic Inconsistencies as Vulnerability Beacons for Embedded Systems by Jiaxu Zhao
Visual summary for From Constraints to Cracks: Constraint Semantic Inconsistencies as Vulnerability Beacons for Embedded Systems by Jiaxu Zhao

Key moments

  1. 0:00 Introduction to embedded system security and vulnerabilities
  2. 0:50 Defining explicit, desired contracts and inconsistencies
  3. 2:30 Unified semantic representation of contracts
  4. 4:00 Overview of the inconsistency detection framework
  5. 5:00 Backend contract tracking using function summaries and slicing
  6. 8:00 Formalizing contract merging and comparison for inconsistency detection
  7. 9:30 Evaluation methodology and research questions
  8. 10:00 Performance evaluation and discovery of new vulnerabilities

From Constraints to Cracks: Constraint Semantic Inconsistencies as Vulnerability Beacons for Embedded Systems

Speakers: Jiaxu Zhao

Conference: USENIX Security

YouTube: https://www.youtube.com/watch?v=ZkxcxTN8fxY

Overview

In the rapidly expanding landscape of connected devices, embedded systems form the backbone of countless IoT and network infrastructures. However, as these systems grow in complexity, the prevalence of vulnerabilities has surged, leading to critical risks such as data leaks, unauthorized device control, and service disruptions. This talk, presented by Jiaxu Zhao from the Institute of Information Engineering, Chinese Academy of Sciences, introduces a novel approach to addressing this escalating security challenge: identifying constraint semantic inconsistencies as reliable beacons for vulnerabilities in embedded systems.

The core premise of the research is that many vulnerabilities stem from a mismatch between explicitly implemented input validation rules (explicit contracts) and the implicit, unstated requirements necessary for secure operation (desired contracts). This talk not only formalizes this concept but also presents B1A2, an innovative analysis framework and tool designed to automatically detect these subtle yet critical inconsistencies across both front-end and back-end components of embedded applications.

The significance of this work lies in its potential to proactively enhance the security posture of embedded devices. By providing a systematic method for uncovering a fundamental class of vulnerabilities that often elude traditional detection methods, B1A2 offers a powerful new capability for developers and security researchers. The demonstrated effectiveness of the tool, including the discovery of numerous previously unknown vulnerabilities in real-world systems, underscores the practical impact and critical importance of addressing semantic inconsistencies in embedded system development.

Background

▶ Watch: Introduction to embedded system security and vulnerabilities (0:00)

The genesis of many vulnerabilities in embedded systems can be traced back to the development phase, specifically to issues surrounding input validation and contract enforcement. As highlighted in the talk, a common vulnerability like command injection often arises from incomplete input checks. This leads to the definition of two crucial types of contracts: explicit contracts and desired contracts.

Explicit contracts are the rules and conditions that are overtly implemented in the code, typically for user input. Examples include character type checks (e.g., expecting only numbers or letters) or length constraints implemented in HTML forms or JavaScript. These are tangible, visible checks within the codebase.

In contrast, desired contracts represent the implicit requirements or security invariants that, while not explicitly coded, are absolutely necessary to prevent vulnerabilities. These are the unstated assumptions about input or system state that, if violated, can lead to exploitable flaws. For instance, a buffer boundary check might be a desired contract if a function is designed to handle a specific maximum input size, even if no explicit if statement enforces it.

The central problem arises when these contracts are inconsistent. In embedded back-end programs, if desired contracts are not adequately implemented or if they clash with the explicit contracts, vulnerability windows can emerge. Furthermore, inconsistencies can also occur between front-end and back-end explicit contracts. A front-end might enforce certain input formats (e.g., HTML or JavaScript validation), but if the back-end lacks corresponding explicit contracts, it can lead to vulnerabilities like SQL injection or cross-site scripting (XSS), where malicious input bypasses client-side checks to exploit server-side logic.

The researchers formalized this relationship: a vulnerability is likely to be triggered if user input fails to match either the front-end explicit contracts or the back-end desired contracts, yet it still manages to pass the back-end explicit contracts. This scenario creates a dangerous loophole where implicitly insecure input is allowed to proceed due to a lack of comprehensive validation.

To effectively detect these inconsistencies, a unified representation of contract semantics is essential. The researchers analyzed numerous known vulnerabilities, identifying missing or inconsistent contracts that contributed to their existence. They categorized these into six types, representing contract semantics as value pairs (e.g., name for the semantic type, value for the information). Contracts can also be positive (e.g., "input must be numeric") or negative (e.g., "input must not contain special characters"), with their determination depending on the context of conditional statements within the code. This foundational understanding of contract types and their representation forms the basis for their automated detection framework.

Key Findings

▶ Watch: Unified semantic representation of contracts (2:30)

The core contribution of this research is the identification of constraint semantic inconsistencies as a potent indicator for vulnerabilities in embedded systems. The talk demonstrates that by systematically analyzing and comparing explicit and desired contracts across different layers of an application, it is possible to uncover deeply rooted security flaws that often go unnoticed by conventional analysis methods.

The primary key finding is the development and validation of B1A2, an innovative analysis framework and its accompanying tool designed to automatically detect these semantic inconsistencies. B1A2 stands apart from existing approaches by focusing on the nuanced differences between what is explicitly coded and what is implicitly required for secure operation.

The effectiveness of B1A2 was rigorously evaluated and demonstrated through several significant findings:

  1. Superior Vulnerability Detection: B1A2 significantly outperformed state-of-the-art static analysis tools in both detection coverage and precision. In a dataset of 31 known vulnerabilities, B1A2 identified 167 potential inconsistencies, yielding 51 true positives with an impressive 76% precision. This included the successful detection of 28 known vulnerabilities and the discovery of 12 previously unknown ones within the test set.
  2. Discovery of Real-World Vulnerabilities: Applying B1A2 to real-world embedded systems led to the discovery of a substantial number of new vulnerabilities. The tool uncovered 152 previously unknown vulnerabilities, of which 88 have been assigned CVE IDs, confirming their critical nature and impact. These vulnerabilities spanned eight different types, highlighting the broad applicability of the inconsistency detection methodology.
  3. Novel Technical Approach: The research introduced a novel function summary-based approach for back-end binary analysis, which is crucial for extracting accurate contract information from compiled code. This, combined with an Inter-Procedural Control Flow Graph (ICFG) representation for contracts, allows for sensitive and precise analysis of data flow and contract enforcement.
  4. Public Release and Recognition: The authors have publicly released the tool's code and the dataset used for evaluation, fostering transparency and reproducibility within the security research community. This work has received three awards for its contributions, underscoring its impact and innovation.

In essence, the key finding is that by shifting the focus from mere syntax errors or simple buffer overflows to the deeper semantic consistency of constraints, B1A2 provides a powerful, automated method to identify a pervasive class of vulnerabilities, thereby significantly enhancing the security posture of complex embedded systems.

Technical Deep Dive

▶ Watch: Backend contract tracking using function summaries and slicing (5:00)

The B1A2 analysis framework is meticulously designed to identify constraint semantic inconsistencies by systematically extracting and comparing contract information from various parts of an embedded system. It comprises four main components that work in concert: a proposer, contract extraction modules, an inconsistency detection engine, and an alert generation system.

The first component, the proposer, is responsible for initial data processing. It transpiles front-end and back-end files into a unified intermediate representation and identifies all user input points within the application, mapping them to specific keys. This step is critical for tracking input origins throughout the analysis.

The core of B1A2 lies in its contract extraction capabilities, which differentiate between front-end and back-end contracts:

Front-End Contract Extraction

For front-end components, B1A2 extracts explicit contracts from:

  • HTML: It parses input elements, select elements, and their associated values, using predefined rules to identify constraints like maxlength, min, max, pattern, or type attributes.
  • JavaScript: The tool analyzes conditional statements (if, switch) and logical operations within JavaScript code to derive explicit contracts. For example, a if (input.length > 10) statement would indicate an explicit contract related to input length. The analysis considers operation order to correctly interpret complex conditions.

Back-End Binary Analysis and Contract Extraction

Extracting contracts from back-end binaries is a significantly more complex task, and B1A2 employs a sophisticated, novel approach:

  1. Function Summary Based Approach: Unlike traditional clone-based methods that might struggle with code variations or obfuscation, B1A2 uses a function summary-based approach. This method first constructs a top-down function call graph that includes all functions directly or indirectly called by the main parent function, extending down to standard library functions as leaf nodes.
  2. Bottom-up Summarization: The analysis then performs a bottom-up summarization. It starts by generating value summaries and function summaries for standard library functions. These summaries encapsulate the behavior and effects of these low-level functions. Subsequently, it computes inbound summaries for all other functions, propagating information upwards through the call graph. This technique effectively reduces complex inter-procedural analysis to more manageable intra-procedural summaries, enhancing scalability and precision.
  3. Program Slicing: To focus on relevant code, B1A2 utilizes program slicing:
  • Forward slicing is applied to remove unrelated code, retaining only instructions that affect the input.
  • Backward slicing is used to collect the syntactic context around input-related operations, helping to infer the conditions under which input is processed.

This iterative slicing process continues until no further reduction in code relevance is achieved.

  1. Back-End Explicit Contracts: These are extracted primarily from:
  • Source-sinking functions: The tool identifies functions that handle external input (sources) and process sensitive operations (sinks). Function summaries are crucial here for understanding their behavior.
  • Conditional statements: Similar to JavaScript analysis, if/else constructs in the back-end binary are analyzed to derive explicit validation rules.
  1. Desired Contracts: These implicit requirements are often tied to sink operations, where data is consumed or acted upon in a sensitive manner.
  • Memory-related sinks: For operations involving memory (e.g., buffer writes), buffer boundaries are critical desired contracts. These boundaries are derived from the execution context or function summaries.
  • Non-memory related sinks: For sinks like file reading or command execution, associated concise semantics (e.g., expected file paths, command arguments) are extracted using predefined rules.

Contract Representation and Inconsistency Detection

The extracted back-end contracts are recorded in an Inter-Procedural Control Flow Graph (ICFG). This graph structure is vital because explicit and desired contracts can vary significantly across different execution paths from source to sink.

  • Explicit contracts are specified along the ICFG edges to model their impact on data flow and program state.
  • Desired contracts are recorded specifically at the corresponding sink nodes, representing the security requirements at these critical points.

Finally, B1A2 performs inconsistency detection through a series of merge and compare operations. These operations are tailored to the specific implementation of contract semantics:

  • Between back-end explicit and desired contracts: The tool checks if the explicit validation rules allow input that violates the implicit desired security properties at a sink.
  • Between front-end and back-end explicit contracts: It compares the validation rules enforced at the front-end with those implemented in the back-end to identify bypass opportunities.

The talk provided a table outlining the initial values and set operations used for different types of contract representations (e.g., numeric ranges, string patterns). This formalized comparison logic is what enables B1A2 to precisely pinpoint semantic mismatches, transforming them into actionable vulnerability alerts.

Demo / Proof of Concept

▶ Watch: Formalizing contract merging and comparison for inconsistency detection (8:00)

While the talk did not feature a live, step-by-step demonstration of the B1A2 tool in action, the authors extensively evaluated its efficacy through several proof-of-concept exercises and real-world application, providing compelling evidence of its capabilities. The evaluation was structured around three key questions: comparing B1A2 with state-of-the-art tools, assessing the quality of its contract extraction, and its ability to discover new vulnerabilities.

For comparison, the researchers curated a dataset of 31 known vulnerabilities with publicly available trigger information. They also selected several leading static analysis tools from top-tier security conferences to benchmark against B1A2. The results demonstrated B1A2's superior performance in vulnerability detection. Out of the potential issues identified, B1A2 reported 167 potential inconsistencies, with 51 confirmed as true positives, achieving an impressive 76% precision. This included the successful detection of 28 known vulnerabilities from the dataset and the discovery of 12 previously unknown vulnerabilities. Notably, B1A2 consistently outperformed other static tools in both detection coverage and precision.

The talk also delved into the results of the contract extraction process itself, presenting data on the quantity and precision of the three types of contracts (front-end explicit, back-end explicit, and desired) and the distribution of their different semantic representation types. Table 7, mentioned in the talk, detailed the source distribution of extracted contract semantics, confirming the tool's ability to accurately parse and represent these rules.

The evaluation specifically highlighted the semantic inconsistency results:

  • Between back-end explicit and desired contracts: Each unique true positive inconsistency identified by B1A2 directly corresponded to a vulnerability. This finding matched 28 known vulnerabilities from their dataset and led to the discovery of additional ones, underscoring the strong correlation between this type of inconsistency and exploitable flaws.
  • Between front-end and back-end explicit contracts: While these inconsistencies were also detected, they did not always map one-to-one to specific vulnerabilities. Nevertheless, they successfully identified 10 known vulnerabilities from the dataset and unearthed an additional cross-site scripting (XSS) vulnerability, demonstrating their value as indicators.

The most impactful proof of concept came from B1A2's application to real-world embedded systems. This led to the discovery of a staggering 152 previously unknown vulnerabilities. Of these, 88 have already been assigned CVE IDs, validating their significance and impact within the security community. These newly found vulnerabilities spanned eight different types, showcasing the broad applicability of the constraint semantic inconsistency model across various attack vectors. The public release of the tool's code and dataset, along with the reception of three awards, further solidifies the practical utility and groundbreaking nature of this research.

Defensive Implications

▶ Watch: Performance evaluation and discovery of new vulnerabilities (10:00)

The findings presented in this talk offer crucial insights for defenders and developers working with embedded systems, highlighting the need for a paradigm shift in how input validation and security contracts are conceptualized and implemented.

  1. Prioritize Comprehensive Contract Enforcement: Developers must move beyond merely implementing explicit input checks. It is imperative to consciously define and enforce desired contracts – the implicit security requirements necessary for robust operation. This means critically evaluating every input and sensitive operation to determine what conditions must hold for secure execution, even if not immediately obvious or explicitly stated in requirements.
  2. Ensure Front-End and Back-End Consistency: The research underscores the dangers of relying solely on front-end validation. Defenders should implement robust, redundant validation on the back-end that mirrors or even exceeds front-end checks. Any discrepancy between client-side and server-side explicit contracts can be a direct path to exploitation. Automated tools should be employed to identify such mismatches.
  3. Adopt Advanced Static Analysis Tools: Organizations developing or deploying embedded systems should integrate advanced static analysis tools, like B1A2, into their secure development lifecycle. These tools are specifically designed to detect semantic inconsistencies that often elude traditional linters or even manual code reviews. The ability of B1A2 to analyze binary code is particularly valuable for embedded systems where source code might not always be available or easy to analyze.
  4. Focus on Sink Operations: Vulnerabilities often manifest at sink operations (e.g., memory allocations, file I/O, command execution, database queries). Defenders should pay particular attention to the data flowing into these sinks and ensure that all necessary explicit and desired contracts are rigorously enforced at these critical junctures. This includes careful handling of buffer boundaries, input sanitization for command arguments, and proper escaping for database queries.
  5. Holistic System View: Security teams should encourage a holistic view of contract enforcement across the entire system architecture. This means considering how data flows from the user interface, through various processing layers, to the final sensitive operations, and ensuring that security contracts are consistent and enforced at every stage.
  6. Regular Vulnerability Assessment: Given the complexity of embedded systems, continuous and automated vulnerability assessment using tools that can identify semantic inconsistencies is vital. The discovery of 152 new vulnerabilities in real-world systems highlights that many existing systems likely harbor such flaws, necessitating proactive detection and remediation efforts.

By adopting these defensive strategies, organizations can significantly reduce the attack surface of embedded systems, mitigate risks associated with data breaches and device compromise, and build more resilient and trustworthy IoT and network infrastructures.

Key Takeaways

  • Constraint Semantic Inconsistencies are Critical Vulnerability Beacons: Mismatches between explicitly implemented input validation rules (explicit contracts) and implicit security requirements (desired contracts) are a significant, yet often overlooked, source of vulnerabilities in embedded systems.
  • B1A2 is a Novel and Effective Detection Framework: The B1A2 framework and tool provide an innovative approach to automatically identify these inconsistencies by systematically analyzing and comparing contracts across front-end and back-end code.
  • Advanced Binary Analysis is Key: B1A2 employs a sophisticated function summary-based approach for back-end binary analysis and uses an Inter-Procedural Control Flow Graph (ICFG) to precisely represent and analyze contracts, enabling accurate detection in compiled code.
  • Superior Performance and Real-World Impact: B1A2 demonstrated significantly higher detection coverage and precision compared to state-of-the-art tools, identifying 28 known vulnerabilities, 12 new ones in test sets, and uncovering 152 previously unknown vulnerabilities in real-world embedded systems, with 88 receiving CVEs.
  • Developers Must Prioritize Holistic Contract Enforcement: Security best practices require developers to not only implement explicit input validation but also to consciously identify and enforce all desired, implicit security contracts throughout the system, ensuring consistency between front-end and back-end logic.
  • Proactive Security for Embedded Systems: This research provides a valuable methodology and practical tool for proactively identifying and mitigating a fundamental class of vulnerabilities, thereby enhancing the overall security posture of complex embedded and IoT devices.

About the Speaker(s)

Jiaxu Zhao is a researcher from the Institute of Information Engineering, Chinese Academy of Sciences. His work focuses on embedded system security, particularly on developing novel analysis techniques to detect vulnerabilities arising from subtle inconsistencies in software contracts. This presentation at USENIX Security highlights his contributions to advancing automated vulnerability detection in complex binary environments.

Reviews

Dr. Zero (Offensive Security Researcher) — STRONG ACCEPT

Solid, original research that formalizes a real and underexplored vulnerability class — contract semantic inconsistencies — and backs it with a working tool, 88 CVEs, and benchmark comparisons against state-of-the-art static analyzers. The function summary-based binary analysis and ICFG-based contract representation are technically credible contributions, not repackaged ideas. Minor reservations around evaluation transparency and the write-up's tendency toward self-congratulation, but the underlying work earns its place at USENIX.

Heather Calloway (CISO) — WEAK

Technically rigorous academic research with real CVE results and a novel detection framing — but it never crosses the gap into operator or institutional relevance. The defensive implications section reads like a checklist, not a decision path.

→ Top-rated talks at 34th USENIX Security Symposium (USENIX Security '25)

All talks from 34th USENIX Security Symposium (USENIX Security '25)