JANUS: Synthesizing Cross-Layer Defenses Against Web Deserialization Attacks

Ruozhao Yang, Minglang Li, Jiongchi Yu, Xinfeng Li, Xiaofei Xie

TL;DR

JANUS is an automated "red-blue" adversarial framework that synthesizes multi-layer defenses against web deserialization attacks. By coordinating controls across the gateway, application, and system layers, it reduces exploit success rates to just 6.2%—outperforming state-of-the-art baselines by 3x—while ensuring that 98.4% of legitimate application functionality remains intact.

What Problem Does This Paper Address?

Unsafe deserialization is a "top-tier" web vulnerability where an application reconstructs objects from untrusted data, inadvertently allowing attackers to trigger malicious code execution (RCE). Defending against it is notoriously difficult for three reasons:

  1. Diversity of Exploits: A single vulnerability can be exploited using dozens of different "gadget chains" (sequences of existing library methods) or various data encodings that bypass simple signature-based filters.
  2. Defensive Blind Spots: Existing defenses usually live in silos. A Web Application Firewall (WAF) at the gateway might miss a re-encoded payload; an application-level filter might miss a new gadget chain; and system-level sandboxing might be too restrictive, breaking the app's legitimate features.
  3. Coordination Complexity: Manually configuring a "defense-in-depth" strategy that uses all three layers without causing redundant overhead or breaking the business logic requires significant expert effort.
Figure 1: Motivating example. Each layer’s defense stops some exploit variants, but one variant passes all three layers and reaches RCE, while the legitimate request is served.

Methods

The authors propose JANUS, a framework that automates the "security engineer's loop" through an adversarial process:

  • The Red-Blue Loop: JANUS pairs an automated Attacker (Red) with a Defender (Blue) in an isolated environment. The attacker tries to find bypasses for the current defense, and the defender uses those failures to refine the policy.
  • Black-Box Attack Exploration: The attacker agent is "black-box," meaning it only sees external feedback like HTTP response codes and timing. It draws from a catalog of known gadget families to find variants that the current defense misses.
  • Evidence-Guided Refinement: When an attack succeeds, the defender analyzes system logs and application traces to create an "attack-effect summary." It then selects the best combination of controls (e.g., WAF rules, class allowlists, syscall filters) to block that specific effect.
  • Counterfactual Coverage Attribution: This is a key innovation. JANUS replays successful attacks while "masking" (disabling) certain rules. This allows it to see if a downstream rule would have caught the attack if the upstream one failed, helping to eliminate redundant rules and identify single points of failure.
  • Regression-Guarded Evolution: Every candidate policy is automatically tested against a suite of "benign workflows." If a security rule breaks a legitimate feature (like a file upload or a database query), the defender must find a narrower, more precise way to block the attack.
Figure 2: Overview of Janus, which alternates black-box attack exploration and evidence-guided defense refinement under regression checks.

Datasets

The researchers evaluated JANUS on 16 vulnerability deployments across six popular Java and PHP applications, including:

  • Apache OFBiz (ERP system)
  • Jenkins (CI/CD server)
  • Liferay Portal (Enterprise portal)
  • Metabase (Business intelligence)
  • Apache ActiveMQ (Message broker)
  • Snipe-IT (Asset management)

They used a total of 64 held-out test attacks (variants the system didn't see during training) and a suite of benign workflows to measure functional impact.

Key Insights and Ideas

  • The "Decisive Constraint" Principle: The authors found that while gateway rules (WAF) are great "cheap" pre-filters, the most robust defenses often happen at the application layer after decoding, where the true "type" of the data is visible.
  • Redundancy is a Feature, Not a Bug: In security, having multiple layers catch the same attack is good. JANUS's counterfactual replay ensures that every attack is covered by at least two layers whenever possible, creating true defense-in-depth.
  • Context is King: A system-level rule that blocks all file writes might stop an attack but break the app. JANUS learns to scope these rules—for example, allowing writes to a specific temporary directory needed for legitimate work while blocking writes to sensitive configuration files.

Key Results

JANUS was compared against several industry-standard baselines, including ModSecurity (WAF), Datadog RASP, and Tetragon (eBPF-based system enforcement).

  • Security: JANUS reduced the held-out Attack Success Rate (ASR) to 6.2%. For comparison, the best-performing baseline (Tetragon) had an ASR of 18.8%, and the WAF baseline was at 55.0%.
  • Reliability: It fully mitigated the vulnerability in 13 out of 16 deployments.
  • Functionality: It preserved 98.4% of benign functionality, whereas the highly secure Tetragon baseline broke nearly 20% of legitimate workflows.
  • Performance: The synthesized defenses added a manageable 6.9% increase in P95 latency.
Figure 3: Recorded run on Jenkins CVE-2026-84645. A re-encoded payload bypasses the literal gateway rule of v1. The defender revises from the exploited effect into the three-layer v2, which stops every later variant at the gateway while benign workflows still pass.

Limitations and Future Work

  • Empirical vs. Proven: JANUS provides empirical protection based on the variants it discovers; it does not "prove" an application is unhackable.
  • Dependency on Workflows: The quality of the defense is limited by the quality of the provided benign workflows. If a legitimate feature isn't included in the regression suite, JANUS might accidentally break it.
  • Root Cause: The authors emphasize that JANUS is a mitigation tool, not a fix. It buys time for developers to patch the underlying code bug without leaving the application exposed.
  • Future Directions: The team suggests applying this cross-layer synthesis approach to other classes of vulnerabilities, such as Server-Side Request Forgery (SSRF) and Template Injection.

Summary updated

Abstract

Unsafe deserialization turns untrusted data into attacker-controlled execution, and a single vulnerability can admit diverse exploit variants that evade defenses tailored to a known exploit. Existing defenses typically operate at a single enforcement point with limited visibility into the full attack. Combining controls across layers offers complementary protection, but coordinating them to preserve legitimate functionality and adapting them to new variants requires substantial expert effort. We propose JANUS, a red-blue adversarial framework for automated cross-layer defense synthesis. Starting from a known exploit, \sys iteratively refines deployment-specific policies in an isolated offline environment. A black-box attacker probes the current policy for exploit variants using only externally observable feedback. The defender summarizes each verified variant into its security-relevant effects, uses counterfactual replay to separate complementary coverage from redundant enforcement, and jointly selects and scopes controls across layers. Each candidate policy is validated against accumulated exploits and benign workflows. We evaluate JANUS on sixteen vulnerability deployments across six Java and PHP applications against gateway, application, system, and cross-layer defenses. JANUS reduces held-out attack success to 6.2%, compared with 18.8-55.0% for the baselines, fully mitigates 13 of 16 deployments, and preserves 98.4% of benign functionality tests at a 6.9% targeted P95 latency increase.
BibTeX
@misc{yang2026janus,
  author = {Ruozhao Yang and Minglang Li and Jiongchi Yu and Xinfeng Li and Xiaofei Xie},
  title = {{JANUS: Synthesizing Cross-Layer Defenses Against Web Deserialization Attacks}},
  year = {2026},
  eprint = {2610.35532},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.35532},
}
Figure