# Untrusted Content Masking for Web Agents with Security Guarantees

*Kristina Nikolić, Egor Zverev, Javier Rando, Matthew Jagielski, Edoardo Debenedetti, Florian Tramer*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/150501) · [Open on the map](../papers.html#p150501)

Category: [AI Safety, Security & Alignment](../pcat/16.md) › [Multi-Agent Security Evaluation](../pgroup/474.md) · Type: new method · Keywords: web agents, prompt injection, security guarantees, DOM masking, sandbox isolation

Areas: [AI Agents](../areas/agents.md) › Agent Robustness › Agent Security Vulnerabilities; [Safety & Security](../areas/safety.md) › Language Model Security › LLM Agent Security

## Summary
Untrusted Content Masking enables web agents to observe their environment by redacting untrusted third-party content from the DOM, providing security guarantees against prompt injection attacks.

## Explained to a 5-year-old
Web helpers look at web pages to do things for you. But some parts of the page are from strangers and could trick them. We hide those tricky parts so the helpers only see safe parts. This keeps the helpers from being tricked. It makes the helpers safer to use.

## Explained to a 5-year-old, longer
When you use a web agent, it needs to look at a web page to understand what to do. The page is made by many different pieces, some from the website owner and some from other companies. Those other pieces can sometimes contain hidden instructions that try to change what the agent does. If the agent follows those hidden instructions, it might do something the user didn't want. To stop this, we can hide the parts of the page that we don't trust. We look at the structure of the page, called the DOM, to find those untrusted areas. We then cover them up so the agent never sees them. Only the safe, trusted parts of the page are shown to the agent. The agent can still navigate and click on the visible parts safely. We also put the agent in a special sandbox that limits what it can do. This sandbox makes sure the agent cannot reach parts of the computer that it shouldn't. Together, hiding untrusted content and using a sandbox keep the agent secure and trustworthy.

## For a technical reader
The paper addresses the risk of prompt injection in web agents by ensuring that untrusted third-party content cannot influence the agent's task planning. It observes that the Document Object Model (DOM) alone can be used to locate untrusted regions on a page. The solution redacts those regions before they are presented to the agent and enforces interaction through a sandboxed interface with strict privilege separation. By isolating the agent's perception from untrusted markup, the approach provides security guarantees without sacrificing the agent's ability to navigate the web. The evaluation demonstrates that the method effectively blocks injection attacks while preserving the agent's functionality.

## Problem
Web agents must perceive their environment by observing rendered web pages, but those pages contain untrusted third-party content that can overwrite trusted instructions, leading to security vulnerabilities such as prompt injection.

## Method
The approach leverages the Document Object Model (DOM) structure to identify untrusted regions, redacts those regions before they reach the agent, and restricts interaction to a sandboxed interface with strict privilege separation.

## Contributions
It introduces a simple masking technique that uses DOM structure to isolate untrusted content, and provides a sandboxed interface that enforces strict privilege separation for web agents.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/150501)
