Toward Automated Detection of Logic Vulnerabilities in Web Applications

Viktoria Felmetsger, Ludovico Cavedon, Christopher Kruegel, Giovanni Vigna

Abstract

Logic vulnerabilities are application-specific flaws that allow attackers to bypass business rules, such as reusing single-use coupons or accessing unauthorized data. Unlike generic input validation flaws, these vulnerabilities are difficult to detect because they require an understanding of an application's unique logic. This paper introduces Waler, a tool that automates the discovery of logic vulnerabilities by combining dynamic invariant inference with symbolic execution. By identifying "supported invariants"—rules explicitly checked in some code paths but missed in others—Waler effectively targets likely logic errors. Evaluation on 12 Java-based web applications revealed 47 previously unknown vulnerabilities, demonstrating high precision and significant performance improvements through domain-specific state pruning.

Introduction

Most automated security scanners excel at identifying "input validation" flaws like SQL injection or Cross-Site Scripting (XSS). These vulnerabilities are generalizable: they occur when untrusted user input reaches a sensitive sink without proper sanitization. However, logic vulnerabilities are bespoke to the business logic of a specific application. For example, an e-commerce site might fail to verify if a user has permission to edit a specific profile ID, even if the input itself is technically "safe."

Because there is no universal rule for what constitutes a logic error, these bugs typically require manual auditing, which is slow and error-prone. Waler aims to bridge this gap by learning an application's intended rules and then systematically searching for paths that violate them.

Methodology

Waler employs a two-step approach to bridge the gap between dynamic observation and formal verification. The system architecture, built upon the Java PathFinder (JPF) framework, integrates several specialized components to handle the complexities of web application logic.

The architecture of Waler, showing the integration of invariant analysis with the Java PathFinder (JPF) symbolic execution environment.

1. Invariant Inference (Learning the Rules)

Waler first uses dynamic analysis to observe the application during normal use. It leverages Daikon, a tool that detects "likely invariants"—mathematical relationships between variables that hold true during execution. The authors extended Daikon to track data within user sessions and back-end databases, which are critical for identifying web-specific logic.

2. Filtering and Verification

To separate meaningful rules from coincidental ones, Waler uses two primary heuristics:

  • Supported Invariants: If the code contains an explicit check (an if statement) for a rule in one path but misses it in another, Waler flags it as a likely intended rule that was inconsistently applied.
  • Internal Consistency: Waler prioritizes invariants that link session data (identity) to database queries (data access).

Finally, Waler uses Java PathFinder (JPF) with symbolic execution to systematically explore program paths. If it finds a path where a "supported" or "internally consistent" invariant is violated, it reports a potential logic vulnerability.

Evaluation and Results

The researchers evaluated Waler on 12 Java-based web applications, including four real-world applications (Easy JSP Forum, GIMS, JaCoB, and JspCart) and eight student projects.

Vulnerability Discovery

Waler successfully identified 47 previously unknown vulnerabilities. In the JspCart application, for instance, Waler found 14 different servlets that could be accessed by unauthenticated users due to missing return statements after a redirect—a classic logic flaw that traditional scanners often miss.

Performance and Precision

One of the primary challenges of model checking is "state space explosion." The authors introduced domain-specific pruning—such as ignoring paths leading to generic error pages—which drastically reduced analysis time. For the Jebbo-2 application, analysis time dropped from 223 minutes to just 1 minute without sacrificing the tool's ability to find bugs. Furthermore, by focusing on "supported invariants," the tool maintained a low false-positive rate, providing actionable reports for developers.

Discussion and Limitations

Waler demonstrates that developers often leave "clues" about their intentions within the code itself. By identifying inconsistencies in how these intentions are enforced, automated tools can find complex logic errors.

However, the current prototype has limitations. It is currently restricted to Java servlets and does not yet support modern frameworks like Spring or Struts. Additionally, it primarily identifies logic enforced via simple if statements, struggling with logic embedded in complex database queries or regular expressions. Future work will focus on extending support to modern frameworks and capturing temporal relationships between application actions.

Summary updated

BibTeX
@inproceedings{felmetsger2010toward,
  author = {Viktoria Felmetsger and Ludovico Cavedon and Christopher Kruegel and Giovanni Vigna},
  title = {{Toward Automated Detection of Logic Vulnerabilities in Web Applications}},
  booktitle = {USENIX Security},
  year = {2010},
}
Figure