Compile-then-execute web agents prevent prompt injection, achieving 0% attack success
Baya’s compile-then-execute design eliminates prompt-injection control-flow hijacking in web agents
Security & privacy arXiv 4 Nov 2026 Defense Prototype evidence
Published as “Securing Web Agents with the Compile-Then-Execute Paradigm”
Why it matters
The approach shows that web agents can be hardened against prompt-injection attacks without necessarily sacrificing task success, suggesting a viable path for secure deployment of LLM-driven automation.
Summary
Baya prevents prompt-injection control-flow hijacking, achieving 0% attack success rate across all evaluated models and environments, while also delivering higher task utility (77.8% aggregate utility) than reactive baselines (55.1% and 66.7%). The system compiles a user request into a Python program that uses a Trusted Website API before any live web interaction, limiting untrusted content to data values only. Evaluation on 581 WebArena Verified tasks and 84 WASP attack instances shows the security benefit without sacrificing utility in most cases, though Baya incurs higher latency and token cost. Some configurations still see lower utility than the best reactive agents, indicating trade-offs.
What they found 1
- Baya achieves higher aggregate utility than reactive baselines
“Baya achieves 77.8% aggregate utility, outperforming browser-only ReAct (55.1%) and API-enabled ReAct (66.7%).”
Caveats 5
- On Postmill with Claude Sonnet-4.6, both Baya and ReActweb + API exhibit 0% observed ASR, while their utilities are 61.1% and 91.7%, respectively.
- On GitLab with DeepSeek-V4-Flash, Baya maintains 0% ASR but completes only 50.0% of benign tasks, while the reactive baselines achieve higher utility with nonzero intermediate ASR.
- High Overhead. Baya’s guarantees come with overhead.
- First, it supports only tasks whose control flow can be determined before execution.
- Separately, Baya relies on trusted APIs constructed for each website before any task is processed.
What’s new here 4
- Introduces a compile-then-execute architecture for web agents that separates planning from runtime web content.
- Uses a manually constructed Trusted Website API to enable ahead-of-time planning for heterogeneous websites.
- Demonstrates 0% observed attack success rate on the WASP prompt-injection benchmark, unlike prior reactive agents.
- Shows that generating executable Python code (BayaCode) improves utility over a JSON-plan representation.