UCM: Masking Untrusted Content for Web Agents to Provide Safety GuaranteesUntrusted Content Masking for Web Agents with Security Guarantees
The paper proposes UCM: using DOM masking and a type-restricted isolation model to separate web agents from untrusted content. Enhanced WASP attack ASR is 0%, utility is largely maintained, and cost is at most about 1.84×.
Computer-use agents observe rendered pages on the web and perform actions such as clicking, typing, and navigation. An attacker can arbitrarily control text or images within untrusted regions; once that content enters the language model's context, its output can be arbitrarily controlled. The goal is to manipulate the agent into taking malicious actions. Site owners are assumed honest. XSS, usability attacks, and browser/OS compromise are not covered.
- Web agents must observe rendered pages that mix trusted and untrusted content, so security guarantees that rely on isolation lose their trust boundary. Heuristic defenses provide no formal guarantees, and existing guaranteed defenses limit the agent's ability to directly see the page.
- UCM replaces untrusted regions with labeled placeholders according to the DOM before rendering to the Agent. When these contents need to be read, the Agent asks the isolated Q-Model questions and specifies return types such as bool, int, float, date, and enum; typed output cannot carry free-text instructions back.
- Three frontier agents on 10 self-built websites and WebArena GitLab largely maintain utility, with cost overhead of about 1.05× to 1.84×. The enhanced WASP attacks in Appendix E achieve an ASR of 0% against UCM. Claude Sonnet 4.5 infers trust boundaries from the sanitized DOM alone, with F1 of 0.840–0.997 across three websites.
- Strict guarantees require that every DOM element be labeled correctly; the actively honest site owner is the main experimental assumption, while the passively honest site owner relies on automatic labeling. Data-flow attacks (aggregation manipulation, single-value tampering, selection hijacking) can still return results that are type-correct but value-incorrect. XSS, usability attacks, and browser/OS compromise are not covered.
- Evaluated models
- Claude Sonnet 4.5Claude Sonnet 4.6GPT-5.4
- Benchmarks
- 10 custom website environmentsWebArena GitLab suiteWASP
- Metrics
- task utilitycost per task (USD)ASRF1TPFPFN
The researchers propose Untrusted Content Masking (UCM), a defense that restores the boundary between trusted and untrusted content for web agents, to defend against prompt-injection attacks. The method exploits the fact that the web DOM structure is sufficient to distinguish trusted from untrusted regions, masking untrusted content before it reaches the agent, and completing interactions through a sandboxed interface with strict permission isolation, so that the agent is isolated from adversarial content while observing and operating on the environment. The authors state that the method is simple and effective, and the code is publicly available. Paper authors include Kristina Nikolić, Egor Zverev, Javier Rando, Matthew Jagielski, Edoardo Debenedetti, and Florian Tramèr.
Paper analysis
What problem does this paper attempt to solve?
Web rendering entangles trusted and untrusted content, removing the trust boundary on which isolation-based prompt-injection defenses depend.
To observe and operate on pages, web agents must first see rendered results that mix trusted and untrusted content, thereby dismantling the trust boundary on which security guarantees depend.
- Scenario and risks: the authors state that web agents are moving from prototypes to production (e.g., Claude Computer Use, OpenAI Operator, UI-TARS), booking tickets, managing calendars, and operating complex web applications on behalf of users. They frequently encounter untrusted content such as comments, product reviews, forum posts, and advertisements, and are susceptible to prompt injection embedded in pages.
- Shortcomings of existing approaches: heuristic defenses improve robustness but provide no formal guarantees and can be bypassed by adaptive attacks. Guaranteed defenses use deterministic isolation of planning and data processing, but limit utility by not letting the agent directly see page content. Foerster et al.'s single-shot planning provides control-flow integrity, but without a mechanism to separate trusted and untrusted content on the rendered page, the planner must remain blind to the entire environment. Piet et al. argue for planning on typed trusted website APIs, but the authors state this requires building and maintaining infrastructure site by site and departs from natural web interaction.
- Core observation: the authors make two points: (1) the web DOM contains enough structural information to distinguish trusted from untrusted regions without reading content; (2) most web-agent tasks need only the structural information of untrusted regions, not their content.
- Proposed defense: the authors propose Untrusted Content Masking (UCM). Before rendering to the Agent, untrusted regions are masked with labeled placeholders; when content needs to be read, the Agent asks an isolated Quarantined Model (Q-Model) questions, with return types restricted to boolean, integer, enum, date, and float, so that information from untrusted sources cannot carry injection instructions. They also provide a method for automatically inferring trust boundaries on the sanitized DOM.
- Threat model:
- Victim system and goal: a computer-use Agent acts on the web on behalf of the user, observing rendered pages and issuing actions such as clicks, typing, and navigation to complete user tasks. The attacker's goal is to manipulate the language-model-driven Agent into taking malicious actions.
- Knowledge and capabilities: a strong attacker can control arbitrary text or images within untrusted regions of the visited page. The authors further assume that once attacker-controlled content enters the context window of a language model, the model's output can be arbitrarily controlled.
- Untrusted content and trust assumptions: content for which the page owner cannot vouch is considered untrusted, whether user-generated (reviews, comments) or introduced externally by the owner (API responses, aggregated third-party lists). The owner of the visited site is assumed honest and will not place adversarial content in regions they control. The authors distinguish an actively honest owner (who labels untrusted regions on the page) from a passively honest owner (who does not label but is non-adversarial). The main experiments assume an actively honest owner.
- Out of scope: it does not address active-content vulnerabilities (such as XSS) that allow attack text to escape labeled regions or rewrite the DOM at runtime; nor does it address usability attacks, model errors unrelated to injection, or threats outside the web/LLM boundary (such as browser or OS compromise). Strict security guarantees require every DOM element to be labeled correctly.
What related research exists?
Related work is divided into attacks, detection and fine-tuning defenses, system-level isolation, and control-flow approaches for browser agents.
Attacks
- Carlini et al. (2023) study the vulnerabilities of vision-language models; Wu et al. (2025a) extend the related findings to multimodal LLM agents.
- Attack vectors on computer-use agents include: pixel attacks (Wang et al., 2025), image patches (Aichberger et al., 2025), pop-ups (Zhang et al., 2025b), small text (Chen et al., 2025a), text that redirects the agent to malicious pages (Li et al., 2025), and black-box policies using reinforcement learning (Xu et al., 2025).
- Evaluation benchmarks include: WASP for web-agent security (Evtimov et al., 2025) and DoomArena (Boisvert et al., 2025), as well as RedTeamCUA, which mixes web and operating-system environments (Liao et al., 2026).
Detection, prompting, and training-based defenses
- Detection-based defenses use a separate model to detect or filter malicious content (ProtectAI, 2024; Wang et al., 2026; Zhong et al., 2025). Prompting-based defenses change the prompting approach to improve robustness (Hines et al., 2024; Learn Prompting, 2024). Fine-tuning-based defenses train the model to ignore injections (Chen et al., 2025b, 2025c, 2025d; Wallace et al., 2024; Wu et al., 2024b).
- ASIDE (Zverev et al., 2026) architecturally separates instructions and data at the embedding layer.
System-level isolation and typed privilege separation
- System-level defenses include execution isolation (Wu et al., 2025b), information-flow control (Wu et al., 2024a), dual-LLM architectures (Willison, 2023; Kim et al., 2025; Debenedetti et al., 2025; Li et al., 2026; Costa et al., 2025), and security-policy generation (Shi et al., 2025). Beurer-Kellner et al. (2025) discuss ad hoc system-level design patterns for agents.
- Jacob et al. (2025) propose type-directed privilege separation that converts untrusted content into scope-limited curated data types. The authors state that this paper generalizes on top of that: instead of pre-fixing every data field to a single type conversion, the Agent can ask arbitrary questions about any masked element and choose the return type at query time.
Browser and computer-use agents
- ceLLMate (Meng et al., 2025) enforces fine-grained sandbox policies at the HTTP request layer. Foerster et al. (2026) use single-shot planning to apply a dual-LLM architecture to computer-use agents, providing control-flow integrity guarantees against arbitrary prompt injections. Piet et al. (2026) argue for replacing the standard ReAct loop with plan-then-execute, committing to a program against typed website APIs before observing any untrusted content; the authors state this eliminates control-flow hijacking but requires building and maintaining trusted typed APIs for every target website.
- Hu et al. (2025) propose real-time security monitoring for computer-use agents. BrowseSafe (Zhang et al., 2025a) studies prompt-injection patterns in browser agents and proposes defense in depth. Google Chrome's agent security architecture (Google Security, 2025) uses a trusted model isolated from web content to review every action, and uses Agent Origin Sets to restrict data access to task-relevant sites.
Baseline methods and benchmarks
- The baseline for utility and cost experiments is an undefended Agent (full page visible), compared against an Agent with UCM; the Q-Model is Claude Sonnet 4.5 in all experiments. The environment consists of 10 self-built websites (10 tasks each) and the GitLab suite from WebArena (41 task templates). Attack validation uses an enhanced WASP (Appendix E). Automatic boundary inference is compared against human labeling on Booking, Reddit, and GitLab.
The authors position UCM as masking untrusted content at the DOM layer: compared to building trusted APIs site by site, it requires fewer changes and lets the agent continue running the standard ReAct loop while being isolated from adversarial text.
How does the paper address this problem?
UCM first masks untrusted regions according to the DOM, then reads them through the type-restricted Q-Model, thereby isolating injected text.
Untrusted Content Masking (UCM) replaces untrusted regions with placeholders based on DOM trust labels before the page is rendered to the Agent; when content is needed, the Agent obtains type-restricted structured answers only through the isolated Q-Model.
Problem setup and masking
- Trust boundary comes from the DOM: the authors state that the web DOM itself encodes information that can be used to delineate trust boundaries within a page. Untrusted DOM components are replaced with masked placeholders before rendering to the Agent. Placeholders preserve structural context and, when available, carry semantic labels (e.g., advertisement, user comment, review), so the Agent still sees all trusted content and the page layout (Figure 1, Figure 4).
- Security property: the Agent does not process untrusted elements and therefore has zero exposure to attacker-controlled content. The authors state this prevents prompt injection by design, unlike heuristic defenses that attempt to detect or filter malicious prompts.
- Implementation (Appendix B): masking is client-side JavaScript. Site owners add
data-untrusted="true"to elements containing untrusted content. When the page loads, these elements are scanned, the original content is hidden with CSS, replaced with a placeholder with a unique identifier (e.g.,id: merchant-name:3), and givendata-qllm-id. A MutationObserver monitors DOM changes to mask dynamically inserted untrusted elements. - Two task types: tasks that can be completed using only trusted regions are called Untrusted-not-required; tasks that must obtain information from untrusted regions are called Untrusted-required, in which case the Agent must go through the Q-Model.
Restricted Q-Model interaction
- Query interface: the Agent references the ID of the masked element, asks a natural-language question, and specifies a return type from a predefined set: bool, int, float, date, enum. The tool is named
quarantined_llm_analysis, with parameters target, query, return_type, and return_constraints. The system locates the element by qllm_id, extracts the visible text and metadata such as tag name, label, class, and id, and hands them to a separate Claude instance. The output must parse to the declared type before being forwarded to the main Agent. The Q-Model's reasoning process is not given to the Agent; only the Answer is handed over when parsing succeeds. - Control flow: the authors state that type-restricted output cannot carry free text, so injection instructions cannot be passed back to the Agent, preserving control flow by design. int and float must provide min and max; enum must provide options. Hard limits in Appendix B: each element (qllm_id) can be queried at most 5 times per task, and enum options are limited to 10; exceeding these returns an error.
- String fallback: the experiments implement an extension: the Q-Model may return a string only when the user approves the extracted text. The authors also describe an alternative not used as the main implementation: after the Agent requests access to untrusted content, it enters an "untrusted mode" where elements are revealed but actions are restricted (e.g., leaving the current page is forbidden); if the task cannot be completed under the constraints, the Agent can request user approval. The authors state that UCM is compatible with any policy chosen by the developer.
- Second chance on WebArena: the agent has at most 120 steps per task; exceeding this is recorded as max_steps_reached and counted as failure. WebArena tasks receive a one-time warning at step 110 and can declare TASK UNSOLVABLE to invoke this fallback (Appendix B.7). The user sees the question, the Q-Model-checked untrusted content, and the proposed answer, and can approve, reject, or edit.
Attack-surface analysis (Section 6)
- Only channel: the authors state that any attack on UCM must go through the Q-Model. This yields two categories: propagating instructions through the Q-Model's output to hijack control flow; and corrupting the values carried by the Q-Model's output to hijack data flow. The analysis assumes the strongest attacker, who can make the Q-Model return arbitrary well-typed output within the constraints requested by the Agent.
- Why control flow fails: untrusted regions never reach the Agent's context. Overlay instructions or QR codes on images likewise never reach the Agent, and the Q-Model cannot relay payloads. The authors state that control-flow attacks are therefore constructively prevented.
- Data flow: aggregation manipulation affects pooled inputs (reviews, comments, ratings). The authors state that UCM calls the Q-Model separately for each untrusted element with a fresh context, so malicious instructions are visible only while analyzing that element; to stably distort an aggregated result, the attacker must control a substantial proportion of the pooled inputs, and each element is processed independently. This corresponds to the MapReduce isolation of Beurer-Kellner et al. In single-value tampering, without a downstream target, the authors consider the typical consequence to be utility degradation rather than a security violation. In selection hijacking, the Agent must use the Q-Model to choose one item from untrusted candidates, and the attacker makes one candidate an object that will be misidentified. For mitigation, the authors point to action-level security policies and user confirmation for sensitive actions, and suggest querying candidates in parallel and treating multiple positive matches as a tampering signal.
Automatic boundary inference (Section 7)
- Passively honest owner: the main experiments assume an actively honest site owner who labels untrusted regions. The authors state that with manual labeling, 15–30 CSS selectors per website covered all untrusted regions on GitLab, Booking.com, and Reddit. For passively honest owners who do not provide labels, an LLM infers boundaries from the DOM structure alone.
- Sanitization: inferring directly on the raw DOM would expose the labeling model to injection. Therefore inference is done on a content-sanitized DOM: all text is removed, user-visible attribute values (URLs, image references) are anonymized, and structure, tags, and attributes are preserved. Table 1 gives an example: title text is replaced with a length marker, while tags and class and id are preserved. Appendix G gives the full sanitization rules and prompts.
- Selector generation: Claude Sonnet 4.5 is used, with input of the sanitized DOM, a brief description of the page, and examples of untrusted content types. The model outputs CSS selectors and applies them to the page. To improve coverage, a set of selectors is first requested, then the model is asked to check for omissions. Evaluation compares against human labels on Booking, Reddit, and GitLab, grouped by HTML tag and class combinations, comparing semantic categories rather than counting individual instances (Appendix G.4).
Success determination
- Utility: task completion rate. Self-built websites use two kinds of automated checks: UI checks confirm that specific page elements were interacted with; model-output checks confirm that the answer contains the correct text. Some tasks require both. WebArena reuses its native evaluator.
- Cost: measured by API token usage of the Agent and all Q-Model calls, converted to US dollars using May 2026 prices with prompt caching. The ideal case is: Untrusted-not-required tasks match the baseline with no Q-Model calls; Untrusted-required tasks may increase cost and calls because untrusted content is genuinely needed.
- The main experiments do not plant attacks: the authors state that in tasks that do not require untrusted content, the Agent is fully isolated; when it does, type-restricted output protects control flow by design. This claim is empirically validated in Appendix E with the enhanced WASP.
What experiments did the paper conduct?
Three models largely maintain utility on the self-built sites and WebArena GitLab; the enhanced WASP ASR is 0%.
Experimental Setup
- Agents tested: Claude Sonnet 4.5, Claude Sonnet 4.6, GPT-5.4. The Q-Model in all experiments is Claude Sonnet 4.5. The labeling model for automatic boundary inference is also Claude Sonnet 4.5.
- Self-built websites: 10 environments (banking, calendar, customer support, e-commerce, email, forum, food order / restaurant booking, wiki, travel booking, job board). Each site has 10 tasks, 5 each of Untrusted-not-required and Untrusted-required, for 100 tasks total (50 per group). Each element is explicitly labeled trusted or untrusted. Three independent runs; in Figure 2, utility is the task mean and cost is the task median.
- WebArena: The original GitLab implementation plus a proxy layer that injects manually labeled safety labels into the DOM. Uses the 41 unique task templates of the WebArena GitLab suite and reuses its native evaluator. Utility bars are the mean of three runs; cost box plots give the median and interquartile range, with points for individual tasks.
- Baselines and variants: Undefended agent (full page visible); Masking Defense (UCM, type-restricted Q-Model); on WebArena, additionally Q-Model string output allowed (after declaring unsolvable, a string may be returned with user approval).
- Metrics and budget: Task utility (completion rate), cost per task (USD, May 2026 API prices, including caching; unit prices in Table 6). At most 120 steps per task; exceeding this counts as failure. The main experiments do not plant prompt injections in pages; attack experiments are in Appendix E.
- Attacks and labeling evaluation: Appendix E uses a strengthened version of WASP's goal hijacking and text injections in different forms on two self-built sites (the GitLab environment and forum), with 5 attempts per template. Boundary inference uses TP, FP, FN percentages and F1, averaged over three runs (Table 2).
Main Results
Figure 2 does not give per-model utility percentages for the bar heights, only cost multipliers. Figure 3 likewise does not give specific readings for per-model utility or median cost. The table below lists only numbers that can be checked back in the main text or tables.
Swipe horizontally to read the table
Setting Condition Result Source Self-built 10 sites, three models UCM cost relative to undefended 1.05×–1.84×; labels on the figure include 1.17×, 1.52×, 1.68×, 1.37×, 1.05×, 1.84× Figure 2b Self-built, Untrusted-not-required All suites and agents Authors state utility is fully preserved Figure 2a Self-built, Untrusted-required Must go through Q-Model Authors state utility is likewise preserved Figure 2a WebArena GitLab, type-restricted Three models Authors state most tasks are solved, largely preserving undefended utility Figure 3a WebArena, strings allowed with user approval Three models Authors state the full utility of the undefended agent is restored Figure 3a Strengthened WASP UCM, GitLab environment and forum ASR 0% Appendix E, Table 8 - Utility: The authors state that utility is preserved on both task types; Untrusted-required tasks show that the agent can obtain the needed information through the Q-Model. On WebArena, the type-restricted Q-Model cannot return free strings, so it cannot complete tasks that require extracting a string from untrusted content (such as asking what new feature a certain issue requests). After allowing it to declare unsolvable and return a string with user approval, the authors state that utility is fully restored.
- Cost: The authors state that overhead is moderate, and higher for Untrusted-required because the Q-Model must be queried for each piece of untrusted content. Sonnet 4.6 has greater relative overhead than Sonnet 4.5 but lower absolute cost; the authors take this to suggest that UCM's overall cost will fall as models become stronger. About 15% of tasks are cheaper under UCM; the authors attribute this to masking reducing visual clutter so that the agent focuses more on relevant UI. Costs are computed at May 2026 API prices with caching. The largest outlier in Figure 3b corresponds to a task that was not solved and exhausted the step limit.
- Main experiments contain no attacks: The authors place the 0% ASR in Appendix E to empirically support the claim that "control flow is guaranteed by design."
Templates Blocked by Masking on WebArena
- What was measured: Table 5 lists the GitLab templates for which the model declared TASK UNSOLVABLE under Masking Defense.
- Results: Four templates are 308 (change the project site title to a given string), 316 (the email of the person with the most commits), 323 (the name of the person with the most contributions), and 324 (the top 3 contributors ranked by commit count). The authors state that all of them require extracting free text from untrusted elements.
- Authors' interpretation: Masking correctly blocks these tasks; after declaring unsolvable, the model can switch to a Q-Model that allows string output, and the output enters the context only after user approval.
Strengthened WASP (Appendix E)
- What was measured: End-to-end tests on the self-built GitLab environment and forum with attacks stronger than the original benchmark. The attack targets are goal hijacking (for example, redirecting the user to an attacker-controlled URL, or inducing the posting of an attacker-specified comment). 5 attempts per template. Table 8 also compares instruction placement in plain text, invisible text, and HTML attributes.
- Results: The undefended agent has ASR of 80%–100% under plain text and 0% under hidden text. UCM has ASR of 0% under all three conditions: plain text, invisible text, and HTML attributes. In Table 9, UCM's ASR for plain-text is 0/5, with utility 5/5 in the GitLab environment and 4/5 in the forum. Undefended plain-text ASR is 5/5 (GitLab) and 4/5 (forum), with utility 0/5 and 1/5 respectively.
- Authors' interpretation: The authors state that UCM blocks all strengthened attacks, supporting "masking architecturally eliminates the attack surface." Invisible text is also 0% for the undefended agent, and the authors state that the model does not perceive that content. The authors also write explicitly: the guarantee depends on correct labeling; a missed label lets that element's content enter the agent's context, and security falls back to that of the undefended agent.
Automatic Boundary Inference (Table 2)
- What was measured: Claude Sonnet 4.5 generates CSS selectors for Booking, Reddit, and GitLab on sanitized DOM, compared with manual labels grouped by tag plus class, averaged over three runs.
- Results: Booking has TP 78.4±3.2%, FP 15.8±2.5%, FN 5.8±3.5%, F1 0.879±0.020. Reddit has TP 99.3±0.5%, FP 0.7±0.5%, FN 0.0±0.0, F1 0.997±0.003. GitLab has TP 72.4±1.1%, FP 19.2±1.8%, FN 8.5±1.9%, F1 0.840±0.008.
- Authors' interpretation: The authors state that F1 is high and under-masking (FN) is low on all three websites. Booking is the hardest because most class names are not semantic (the text gives ss133neaa as an example), and the model still identifies boundaries mainly from the few semantic tags and the overall layout. The Figure 9 caption states: the red region is the area masked by selectors generated from the sanitized DOM alone; the model marks hotel titles, descriptions, and images as untrusted, and the platform UI is not masked.
Other Ablations and Analyses
- Data-flow red teaming (Appendix F): Manually constructed in the GitLab environment under the assumption of full control over the Q-Model's output. In the selection hijacking example, an attacker-controlled issue is misidentified by the Q-Model, and the agent sends attacker-specified text to the attacker's issue. In the single-value tampering example, a repository that should be private is reported as public and is subsequently deleted. The authors do not give success rates for these cases.
- Tokens and calls (Figure 5, Figure 6, Appendix D): Figure 5 shows the input and output token ratios of UCM relative to undefended on forum and webshop, with a log2 vertical axis, averaged over three runs; the authors state that most webshop tasks are below 1.0× and forum is higher. Figure 6 shows absolute tokens for the 10 self-built sites, averaged over tasks and runs; the authors state that input tokens fall after masking, output tokens are roughly unchanged, and total tokens rise because of Q-Model calls, with webshop highest and banking lowest. Figure 7 shows the number of Q-Model calls per task on GitLab on a log scale, with the median and interquartile range over three runs; the authors state that Sonnet 4.6 and GPT-5.4 make fewer calls, with a median of about 1–3 calls for most tasks and outliers above 10. Figure 8 shows cost per task on GitLab, with a log2(USD) vertical axis; the authors state that cost rises slightly after masking and that Sonnet 4.6 has lower absolute cost than Sonnet 4.5. The figures do not label specific token counts or dollar values that can be transcribed per model.
- Prices (Table 6, May 2026, per million tokens): Claude Sonnet 4.5 and 4.6 are both input $3.00, output $15.00, cache write $3.75, cache read $0.30. GPT-5.4 is input $2.50, output $15.00; its cache write and cache read are not transcribed because column alignment in the converted text is unreliable.
- Negative cases and exceptions: When type-restricted, WebArena tasks requiring free text fail until the user-approved string fallback is enabled. Invisible text injection already has 0% ASR against the undefended agent (Table 8). About 15% of self-built tasks are cheaper under UCM. Appendix E states that incorrect trust labels cancel isolation. Data-flow attacks are not within the 0% ASR control-flow result; Appendix F gives only qualitative cases.
What are some points that can be further explored?
The paper does not have a separate limitations section; strict guarantees depend on correct labeling, and data-flow attacks remain within the discussion scope.
Limitations and future directions noted by the authors
- Correct labeling is a prerequisite for guarantees (Section 3, Appendix E): to provide strict security guarantees, UCM requires every DOM element to be labeled correctly. Appendix E states that when this assumption does not hold, the content of unlabeled elements enters the Agent's context, and security falls back to that of an undefended Agent. The authors test sensitivity to this assumption in Appendix E.
- Active-content vulnerabilities are out of scope (Section 3, Out of scope): it does not address vulnerabilities such as XSS that allow attack text to escape labeled regions or rewrite the DOM at runtime; under the honest-owner assumption, the site is responsible for preventing such flaws.
- Other out-of-scope threats (Section 3): usability attacks, model errors unrelated to injection, and threats outside the web/LLM boundary (such as browser or OS compromise) are not addressed.
- Data-flow attacks (Section 6.2): the authors state that data-flow attacks are a known limitation of defenses that protect control flow. An attacker may still cause the Q-Model to return type-correct but value-incorrect results, including aggregation manipulation, single-value tampering, and selection hijacking. The authors point to existing action-level security policies and user confirmation for sensitive actions, and suggest treating multiple positive matches from parallel queries as a tampering signal.
- Malicious sites themselves (Section 3): the authors state that visiting an outright malicious site is unsafe with or without UCM, because the page can trigger harmful behavior merely by loading. In practice, UCM can be deployed against an allowlist of trusted domains maintained by the browser or the user, with unknown pages falling back to heuristic defenses.
- Standards and labeling practices (Section 8, Conclusion): the authors argue that secure web agents may benefit from websites explicitly marking trust boundaries in the DOM, drawing an analogy to Content Security Policy. The authors state that the automatic-labeling results show that, before such standards exist, agents can also infer trust boundaries from structural cues alone. The authors hope that website developers and standards organizations adopt practices that allow agents to interact more safely. The paper does not have a dedicated section named Limitations.
Experimental coverage
- Utility and cost: the tested agents are Claude Sonnet 4.5, Claude Sonnet 4.6, and GPT-5.4. The self-built environment has 10 sites with 100 tasks total, split into Untrusted-not-required and Untrusted-required; WebArena uses the GitLab suite with 41 task templates. Utility and cost are each run three times (Section 5, Figure 2, Figure 3). The Q-Model is fixed to Claude Sonnet 4.5.
- Attack validation: the main experiments do not plant prompt injections in pages. Appendix E evaluates the enhanced WASP on two self-built sites (GitLab environment, forum), with 5 runs per template, reporting ASR for three placement positions: plain text, invisible text, and HTML attributes. Appendix F gives qualitative examples of data-flow attacks in the GitLab environment under the assumption of full control over the Q-Model's output, without reporting success rates.
- Labeling: the main experiments assume an actively honest owner and use strict or hand-labeled labels. Automatic boundary inference is compared against human labels only on Booking, Reddit, and GitLab in terms of TP, FP, FN, and F1 (Table 2, 3 runs). The paper reports that hand labeling with 15–30 CSS selectors per site covered the untrusted regions of these three sites.
- Step and query constraints: the step limit per task is 120; WebArena allows declaring the task unsolvable at step 110 and entering a string fallback. Each qllm_id can be queried at most 5 times per task, and the enum option limit is 10 (Appendix B). The paper provides a token price table (Table 6) and token, call-count, and cost figures for forum, webshop, and GitLab (Figures 5–8), but does not give a per-model utility percentage table in the main text.
- Strategies discussed but not used as the main implementation: Section 4.2 describes restricting navigation in untrusted mode and developer-chosen policies; the experimental implementation uses type-restricted queries plus string output after user approval. The paper does not report rejection rates or human agreement for the user-approval step.
Summarize the main content of the paper
UCM uses DOM masking and a type-restricted Q-Model to isolate web agents, maintaining utility largely and achieving 0% WASP ASR.
Untrusted Content Masking (UCM) is a prompt injection defense for web agents: it masks untrusted regions in the DOM before rendering, and when content needs to be read, it only goes through a type-restricted isolation model.
- Problem: Web pages entangle trusted content such as navigation and official lists with untrusted content such as comments, reviews, and third-party lists in the same rendering. Guarantees that rely on "planning never touches untrusted data" therefore lose their boundary. Heuristic defenses have no formal guarantees; existing guaranteed approaches either make the environment invisible to the planner or require maintaining typed trusted APIs for each website.
- Approach: Site owners label untrusted elements (or a model infers CSS selectors on a sanitized DOM). The agent only sees placeholders with IDs and trusted content, and queries individual elements via
quarantined_llm_analysis, with return types limited to bool, int, float, date, enum. Free text enters the context only after user approval. The authors claim all attacks must go through the Q-Model: control flow is blocked by type constraints; data flow may still return well-typed but incorrect values. - Utility and cost: On 10 self-built websites (100 tasks), with Claude Sonnet 4.5, Claude Sonnet 4.6, and GPT-5.4, the authors claim utility is maintained for both task types; cost overhead in Figure 2b is 1.05× to 1.84×, with about 15% of tasks cheaper. On 41 WebArena GitLab templates, with type restrictions the authors claim most tasks are solvable and utility is largely maintained; after allowing user-approved string outputs, they claim full utility of the no-defense baseline is restored. Three runs, max 120 steps per task.
- Safety and labeling: In Appendix E, an enhanced WASP attack achieves 0% ASR against UCM on the GitLab environment and forum (5 attempts per template); the no-defense agent achieves 80%–100% ASR on plain text and 0% on invisible text. In Table 2, Claude Sonnet 4.5 automatic boundary inference F1 is Booking 0.879±0.020, Reddit 0.997±0.003, GitLab 0.840±0.008.
- Authors' conclusions: The authors believe UCM maintains utility across multiple websites and WebArena GitLab tasks at moderate cost, and provides safety guarantees that heuristic defenses cannot. They advocate that websites explicitly mark trust boundaries in the DOM; until standards emerge, structural cues can support automatic labeling. Strict guarantees depend on correct per-element labeling, and do not cover data-flow attacks, XSS, or browser/OS compromise.
Related papers
Show 3 more papers
- AgentWatcher: A Rule-based Prompt Injection MonitorDefensesarXiv
- Towards Safe Autonomy for Computer UseDefensesarXiv