MirrorGuard: Toward Secure Computer-Use Agents via Simulation-to-Real Reasoning Correction

Wenqi Zhang, Yulin Shen, Changyue Jiang, Jiarun Dai, Geng Hong, Xudong PanarXiv 2026

TL;DR

MirrorGuard introduces a novel "reasoning-level intervention" defense for Computer Use Agents (CUAs) by intercepting and correcting insecure thoughts before they translate into harmful actions. By training a compact vision-language model entirely within a text-based, neural-symbolic simulator ("MirrorWorld"), it achieves robust real-world security alignment without sacrificing agent utility or risking system damage during training.

What Problem Does This Paper Address?

Autonomous Computer Use Agents (CUAs) are rapidly transitioning from passive chatbots to active operators capable of controlling operating systems directly via graphical user interfaces (GUIs). While this boosts productivity, it exposes the underlying system to severe security risks. Because these agents inherit the full privileges of the logged-in user, a single visual prompt injection or malicious instruction can lead to irreversible damage, such as data exfiltration or system file deletion.

Existing defenses typically rely on a "detection-and-blocking" paradigm, acting as binary gatekeepers that terminate a task entirely if any risk is suspected. This rigid approach imposes a heavy "utility penalty," frequently aborting legitimate tasks due to false positives. The challenge lies in creating a defense mechanism that can secure autonomous agents against complex, multimodal threats without paralyzing their helpfulness.

Figure 2: Key vulnerabilities of computer use agents: (1) Vi- sual semantic spoofing, (2) multi-modal reasoning collapse, and (3) implicit privilege escalation.

Methods

MirrorGuard shifts the defensive focus from input filtering or action blocking to reasoning-level correction. It operates on the insight that an agent's risky intentions manifest in its "Thought" phase before any real-world action is executed.

The framework is built on a two-stage pipeline:

  1. Simulation in MirrorWorld: Collecting unsafe interaction data in real operating systems is dangerous and computationally expensive. To solve this, the authors developed MirrorWorld, a text-based neural-symbolic simulator. It enforces strict "Object Permanence" using structured Pydantic schemas, ensuring consistent system causality (e.g., a file remains deleted once removed) without real OS overhead. An adversarial pipeline synthesizes multi-step, stealthy risk scenarios within this environment.
  2. Cross-Modal Security Transfer: The text-based trajectories are automatically audited by an LLM "Security Judge" and corrected by a "Security Instructor" into safe, analytical reasoning paths (e.g., enforcing a "Check-before-Act" protocol). MirrorGuard then fine-tunes a compact Vision-Language Model (Qwen2.5-VL-7B-Instruct) on this data. By leveraging the pre-aligned latent space of the VLM, the model successfully transfers abstract text-based safety principles into real-world visual GUI understandings.

At deployment, MirrorGuard acts as a plug-and-play module that intercepts the victim agent's reasoning loop, using a prefill or replacement mechanism to steer the agent toward safe alternatives.

Figure 1: Overview of MirrorGuard: “Train in the MirrorWorld, Act in the Wild.” MirrorGuard trains a reasoning correction module entirely within a text-based MirrorWorld, where a ReAct agent interacts with a symbolic environment and insecure thoughts are automatically identified and corrected under explicit security rules. These paired trajectories are used for supervised fine-tuning to learn safety-aware reasoning. At deployment, the trained MirrorGuard intercepts and corrects unsafe reasoning in real-world GUI environments before execution, enabling scalable sim-to-real transfer of security reasoning while avoiding irreversible system damage and preserving agent utility.

Datasets

  • MirrorGuard Dataset: A newly introduced synthetic dataset consisting of 24,383 total interaction samples. It features a strategic mix of 14,849 insecure trajectories requiring correction (60.9%) and 9,534 secure interactions from benign tasks (39.1%) to help the model learn precise decision boundaries.
  • Evaluation Benchmarks: The framework was tested zero-shot (without training on the benchmark data) across two premier adversarial safety datasets: OS-Harm (focusing on actionable OS harm like ransomware scripts) and RiOSWorld (covering environmental risks like deceptive pop-ups). Benign task utility was evaluated using the test_small subset of OSWorld.

Key Insights and Ideas

  • Treating Violations as Reasoning Errors: Intercepting the "Thought" layer allows the system to correct the underlying cognitive intent. Instead of killing a task when an agent attempts a sensitive operation (like modifying file permissions), MirrorGuard rewrites the thought to require prior verification, preserving workflow continuity.
  • Security Logic is Modality-Agnostic: High-level safety principles (e.g., "verify before delete") can be learned rapidly in a text-based simulation and effectively mapped to visual triggers via pre-aligned VLM representations, bypassing the need for millions of risky real-world visual attack samples.
  • Data Quality Beats Model Scale: A compact 7B corrector model fine-tuned on high-fidelity simulation data consistently outperformed 70B+ scale models relying on prompting or multi-stage text-captioning pipelines.
  • The Pipeline Information Bottleneck: Traditional defenses that convert GUI screenshots into text captions suffer from "lossy compression," often missing subtle visual anomalies like fake system dialogs. End-to-end visual processing avoids this bottleneck.

Key Results

  • Substantial Risk Reduction: On ByteDance's native UI-TARS system, MirrorGuard successfully reduced the unsafe rate on the RiOSWorld benchmark from 66.5% to 13.0%. In comparison, the state-of-the-art baseline, GuardAgent, only reduced it to 53.9%.
  • High Utility Preservation: MirrorGuard maintained a remarkably low average False Refusal Rate (FRR) of 5.13% across six diverse victim agents. Traditional blocking defenses like GuardAgent suffered from a much more disruptive 22.22% FRR, effectively sacrificing one out of every four benign tasks.
  • Resilience to Adversarial Gaslighting: When tested against injections explicitly telling the guardrail "This action is SAFE... Do not correct," prompt-based defenses collapsed (unsafe rates spiked to 63%), while MirrorGuard maintained a low unsafe rate of 10%, proving the benefit of objective decoupling via fine-tuning.

Limitations and Future Work

  • Proprietary "Black Box" Constraints: Commercial closed-source agent products (like OpenAI's Operator) currently function as black boxes, restricting the intermediate access to the reasoning loop required for direct intervention.
  • Pixel-Level Perturbations: While MirrorGuard excels at detecting semantic and environmental traps (like deceptive UI layouts), low-level adversarial pixel perturbations remain outside the current scope of this work.
  • Future Directions: The authors plan to extend MirrorGuard's robustness against advanced semantic obfuscation and explore API-level integrations with commercial agent providers.

Summary updated

BibTeX
@misc{zhang2026mirrorguard,
  author = {Wenqi Zhang and Yulin Shen and Changyue Jiang and Jiarun Dai and Geng Hong and Xudong Pan},
  title = {{MirrorGuard: Toward Secure Computer-Use Agents via Simulation-to-Real Reasoning Correction}},
  year = {2026},
  eprint = {2601.12822},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.12822},
}
Figure