[Paper Review] On the Computational Complexity of Satisfiability Solving for String Theories
This paper analyzes the computational complexity of string constraint theories relevant to software security, proving that even small, practical fragments are NP-complete. It justifies a 'byte-blast' approach—encoding string constraints as bit-vector formulas for efficient solving using off-the-shelf SMT solvers—thereby enabling scalable verification of security-critical string-processing applications.
Satisfiability solvers are increasingly playing a key role in software verification, with particularly effective use in the analysis of security vulnerabilities. String processing is a key part of many software applications, such as browsers and web servers. These applications are susceptible to attacks through malicious data received over network. Automated tools for analyzing the security of such applications, thus need to reason about strings. For efficiency reasons, it is desirable to have a solver that treats strings as first-class types. In this paper, we present some theories of strings that are useful in a software security context and analyze the computational complexity of the presented theories. We use this complexity analysis to motivate a byte-blast approach which employs a Boolean encoding of the string constraints to a corresponding Boolean satisfiability problem.
Motivation & Objective
- To identify and formalize a core set of string predicates and functions commonly used in high-level languages like C and Java for security-relevant program analysis.
- To analyze the computational complexity of various fragments of the resulting string theory, particularly focusing on their NP-completeness.
- To motivate and justify a byte-blast approach that encodes string constraints into bit-vector logic for efficient satisfiability solving using existing SMT solvers.
- To explore abstraction-refinement techniques tailored for string constraints, such as length and position abstraction, to improve scalability in real-world security applications.
Proposed method
- Define a theory of strings based on common string operations and predicates from C and Java, including extract-i-j and contains-at-position-i.
- Prove NP-completeness of non-trivial fragments of the theory by reducing 3-CNF SAT to string constraints using Boolean encoding principles.
- Construct a Boolean encoding of string constraints into bit-vector logic, where string variables are represented as bit-vectors and operations are encoded via logical constraints.
- Use a two-step reduction: first to a core string theory with basic operations, then to bit-vector logic, enabling use of existing SAT/SMT solvers like STP or Z3.
- Propose abstraction techniques—length abstraction and position abstraction—to guide the solver and reduce search space in practical security analysis.
- Integrate abstraction-refinement loops inspired by prior SMT work, using unsat cores to refine over- and under-approximations of string constraints.
Experimental results
Research questions
- RQ1What is the computational complexity of satisfiability solving for practical fragments of string theories used in software security?
- RQ2Can a SAT-based byte-blast approach effectively solve string constraints by reducing them to bit-vector logic?
- RQ3How do the presence of operations like extract-i-j and contains-at-position-i affect the complexity of string constraint solving?
- RQ4Can abstraction-refinement techniques such as length and position abstraction improve the scalability of string constraint solving in practice?
- RQ5Are there fragments of string logic that remain NP-complete even without union or star operations, which are often used in other NP-completeness proofs?
Key findings
- Several small, practical fragments of the string theory—such as those including extract-i-j and contains-at-position-i—are proven to be NP-complete.
- The NP-completeness result holds even without union or star operations, indicating that the complexity arises from fundamental string operations, not just regular language expressiveness.
- The reduction from 3-CNF SAT to string constraints demonstrates that solving these string fragments is as hard as solving general SAT, establishing NP-hardness.
- The byte-blast approach of encoding string constraints into bit-vector logic is justified as a viable and effective strategy due to the NP-completeness of the underlying problem.
- Abstraction techniques such as length and position abstraction are proposed as practical means to guide solvers and reduce search space in real-world security analysis.
- The paper shows that constraints expressible in their theory are not fully comparable with those in HAMPI, as their theory includes position-specific predicates not expressible in HAMPI’s regular language-based framework.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.