Insufficient validation of untrusted input in PointerLock (CVE-2026-11221)
The browser process did not re-check the pointer-lock sandbox flag when a renderer requested mouse lock over Mojo IPC, so a compromised renderer inside a sandboxed frame could obtain pointer lock. An attacker with code execution in a renderer could capture mouse movement and perform UI redress attacks.
Originally disclosed on Chrome VRP
- Fix shipped in 3 months
# Steps to reproduce the problem
1. `RenderWidgetHostImpl::RequestMouseLock()` does not check the
`WebSandboxFlags::kPointerLock` sandbox flag. A compromised renderer
inside a sandboxed frame (without `allow-pointer-lock`) can call
`FrameWidgetInputHandler::RequestMouseLock` over Mojo IPC directly,
bypassing the renderer-side check and obtaining pointer lock from the
browser process.
## Severity
**High** - Sandbox policy bypass from compromised renderer process.
Comparable to Bug 491676472 (allow-modals missing browser-side check,
fixed 2025-03-12). That bug was assigned Security_Severity-High and
fixed with `bad_message::ReceivedBadMessage()`.
## Component
- Primary: `content/browser/renderer_host/render_widget_host_impl.cc`
- Secondary: `content/browser/web_contents/web_contents_impl.cc`
- Mojo interface: `blink.mojom.FrameWidgetInputHandler::RequestMouseLock`
## Affected Versions
All current Chrome stable/beta versions (unfixed as of 2026-03-12):
- Chrome 145.0.7632.160 (Stable, arm64, macOS) - verified
- Chrome 146.0.7680.72 (next Stable, branch pos 1582197) - unfixed
- Chromium main - unfixed
Note: The comparable kModals fix (Bug 491676472) landed at Cr-Commit-Position
1598123, which is newer than both 145 stable (pos ~1568190) and 146
stable (pos ~1582197). kPointerLock fix has not landed anywhere.
2.
3.
# Problem Description
## Root Cause
Renderer-side (`PointerLockController::RequestPointerLock`) correctly
checks the sandbox flag and blocks the request:
```cpp
// third_party/blink/renderer/core/page/pointer_lock_controller.cc:94
if (window->IsSandboxed(WebSandboxFlags::kPointerLock)) {
resolver->RejectWithSecurityError(...);
return;
}
// calls: GetWidgetForLocalRoot()->RequestMouseLock(...)
```
But the browser-side handler does NOT re-validate:
```cpp
// content/browser/renderer_host/render_widget_host_impl.cc:3281
void RenderWidgetHostImpl::RequestMouseLock(
bool from_user_gesture,
bool unadjusted_movement,
RequestMouseLockCallback response) {
// ❌ MISSING: IsSandboxed(WebSandboxFlags::kPointerLock) check
if (IsPointerLocked()) { ... }
if (!view_ || !view_->CanBePointerLocked()) { ... }
delegate_->RequestToLockPointer(this, from_user_gesture, ...);
}
```
`WebContentsImpl::RequestToLockPointer` (called next) checks for
fenced frames but NOT for sandboxed frames:
```cpp
// content/browser/web_contents/web_contents_impl.cc:5091
void WebContentsImpl::RequestToLockPointer(...) {
if (render_widget_host->frame_tree()->is_fenced_frame()) {
ReceivedBadMessage(...); // �
fenced frame check
return;
}
// ❌ NO: GetSandboxFlags() & WebSandboxFlags::kPointerLock
delegate_->RequestPointerLock(this, user_gesture, ...);
}
```
## Attack Scenario
As an attacker with code execution in a renderer process
(e.g. via a V8 or Blink memory corruption bug):
1. The renderer is hosting a sandboxed iframe (sandbox="allow-scripts",
no allow-pointer-lock).
2. Normal pointer lock is blocked by renderer check.
3. Attacker patches renderer or calls Mojo IPC directly:
`FrameWidgetInputHandler::RequestMouseLock(true, false, callback)`
4. Browser grants pointer lock - cursor disappears, all mouse movement
events captured by the sandboxed frame.
**As an attacker I could:**
- Capture the mouse cursor from a privileged parent frame context
- Perform UI redress attacks against the user (cursor hidden, fake UI shown)
- Bypass the `allow-pointer-lock` sandboxing contract that sites rely on
to safely embed third-party content
## PoC
See attached `index.html`. It demonstrates:
1. The renderer-side check correctly blocks pointer lock via normal JS.
2. The missing browser-side check (shown via code reference).
3. A compromised renderer can call the Mojo IPC directly to bypass.
To reproduce the FULL bypass (requires patched renderer or Mojo fuzzer):
```
# Call FrameWidgetInputHandler::RequestMouseLock(true, false)
# from a renderer hosting a sandbox="allow-scripts" iframe
# without allow-pointer-lock. Browser grants the lock.
```
## Comparison: Bug 491676472 (Fixed)
The just-fixed `allow-modals` bug had the identical pattern:
```cpp
// BEFORE fix: RunJavaScriptDialog() had no IsSandboxed(kModals) check
// AFTER fix (render_frame_host_impl.cc:7251):
if (IsSandboxed(WebSandboxFlags::kModals)) {
bad_message::ReceivedBadMessage(GetProcess(),
bad_message::RFH_JS_DIALOG_FROM_SANDBOXED_FRAME);
return;
}
```
## Proposed Fix
In `RenderWidgetHostImpl::RequestMouseLock()`:
```cpp
// Get the focused frame and check its sandbox flags
if (RenderFrameHostImpl* rfh = GetFocusedFrame()) {
if (rfh->IsSandboxed(WebSandboxFlags::kPointerLock)) {
bad_message::ReceivedBadMessage(
GetProcess(),
bad_message::RWHI_POINTER_LOCK_FROM_SANDBOXED_FRAME);
std::move(response).Run(
blink::mojom::PointerLockResult::kPermissionDenied,
mojo::NullRemote());
return;
}
}
```
Also add corresponding test to
`content/browser/security_exploit_browsertest.cc` (same file as the
kModals fix test).
## Additional Notes
- Other sandbox flags may have similar missing browser-side checks.
Recommend auditing: `kDownloads`, `kOrientationLock`,
`kPresentationController`, `kDocumentDomain`.
- `kPopups` already has browser-side check (CreateNewWindow, line 10092).
- `kTopNavigationByUserActivation` has browser-side check (line 983).
- `kModals` just got its check (Bug 491676472).
# Summary
Missing Browser-Side Sandbox Enforcement for kPointerLock
# Additional Data
Category: Security \
Chrome Channel: Stable \
Regression: N/A \## Context
Chrome's Pointer Lock API lets a page capture the mouse: the cursor disappears and all mouse movement events go to the page. Because this is a powerful capability, the HTML sandbox attribute has a dedicated flag for it, `allow-pointer-lock`. A frame embedded with `sandbox="allow-scripts"` and without `allow-pointer-lock` is not supposed to be able to obtain pointer lock at all.
The report looks at where that contract is enforced. Chrome enforces sandbox flags in two places: in the renderer (Blink) and again in the browser process, because the browser process must not trust a renderer that may be compromised. The finding is that for pointer lock, only the renderer-side check exists. The browser-side handler, reached over Mojo IPC, accepts the request without re-checking the sandbox flag.
The affected component is `PointerLock`, with the primary code in `content/browser/renderer_host/render_widget_host_impl.cc` and a secondary path in `content/browser/web_contents/web_contents_impl.cc`. The Mojo interface involved is `blink.mojom.FrameWidgetInputHandler::RequestMouseLock`.
## Setup
The report lists the affected versions, marking Chrome 145.0.7632.160 as verified. The versions listed as affected and unfixed as of 2026-03-12 are:
| Version | Channel / build | Status |
|---|---|---|
| Chrome 145.0.7632.160 | Stable, arm64, macOS | verified |
| Chrome 146.0.7680.72 | next Stable, branch position 1582197 | unfixed |
| Chromium main | main | unfixed |
The report notes that the comparable `kModals` fix (Bug 491676472) landed at Cr-Commit-Position 1598123, which is newer than both 145 stable (position around 1568190) and 146 stable (position around 1582197). The `kPointerLock` fix has not landed anywhere.
Reproducing the full bypass requires a patched renderer or a Mojo fuzzer, because the normal JavaScript path is blocked before it reaches the browser. The attached `index.html` demonstrates the renderer-side block and points at the missing browser-side check; it does not by itself perform the IPC call.
## Finding it
The starting point is the renderer-side check in `PointerLockController::RequestPointerLock`. It correctly consults the sandbox flag and rejects the request:
```cpp
// third_party/blink/renderer/core/page/pointer_lock_controller.cc:94
if (window->IsSandboxed(WebSandboxFlags::kPointerLock)) {
resolver->RejectWithSecurityError(...);
return;
}
// calls: GetWidgetForLocalRoot()->RequestMouseLock(...)
```
That check is the only thing standing between a sandboxed frame and pointer lock. The browser-side handler that the renderer calls next does not repeat the validation:
```cpp
// content/browser/renderer_host/render_widget_host_impl.cc:3281
void RenderWidgetHostImpl::RequestMouseLock(
bool from_user_gesture,
bool unadjusted_movement,
RequestMouseLockCallback response) {
// ❌ MISSING: IsSandboxed(WebSandboxFlags::kPointerLock) check
if (IsPointerLocked()) { ... }
if (!view_ || !view_->CanBePointerLocked()) { ... }
delegate_->RequestToLockPointer(this, from_user_gesture, ...);
}
```
The next hop, `WebContentsImpl::RequestToLockPointer`, does perform one browser-side check, but only for fenced frames:
```cpp
// content/browser/web_contents/web_contents_impl.cc:5091
void WebContentsImpl::RequestToLockPointer(...) {
if (render_widget_host->frame_tree()->is_fenced_frame()) {
ReceivedBadMessage(...); // �
fenced frame check
return;
}
// ❌ NO: GetSandboxFlags() & WebSandboxFlags::kPointerLock
delegate_->RequestPointerLock(this, user_gesture, ...);
}
```
So the browser process validates the frame type but not the sandbox flags of the requesting frame. A renderer that skips the Blink check, or that is simply compromised, reaches the browser handler and is granted the lock.
## Exploitation
The attack assumes the attacker already has code execution in a renderer process, for example through a V8 or Blink memory corruption bug.
### Step 1: host a sandboxed frame
The renderer hosts an iframe declared with `sandbox="allow-scripts"` and without `allow-pointer-lock`. This is the ordinary way a site embeds untrusted third-party content while denying it powerful capabilities.
### Step 2: confirm the normal path is blocked
Calling the Pointer Lock API from JavaScript inside that frame is rejected by the renderer-side check shown above. The attached `index.html` demonstrates exactly this: the renderer-side check correctly blocks pointer lock via normal JS.
### Step 3: call the Mojo interface directly
Instead of going through the Blink API, the attacker patches the renderer or issues the IPC call directly:
```text
FrameWidgetInputHandler::RequestMouseLock(true, false, callback)
```
The two boolean arguments correspond to `from_user_gesture` and `unadjusted_movement` in the browser-side handler signature. Because `RenderWidgetHostImpl::RequestMouseLock()` does not check `WebSandboxFlags::kPointerLock`, and `WebContentsImpl::RequestToLockPointer()` only rejects fenced frames, the request passes through to `delegate_->RequestPointerLock(...)`.
### Step 4: observe the result
The browser grants pointer lock. The cursor disappears and all mouse movement events are captured by the sandboxed frame.
The report's reproduction note for the full bypass is:
```text
# Call FrameWidgetInputHandler::RequestMouseLock(true, false)
# from a renderer hosting a sandbox="allow-scripts" iframe
# without allow-pointer-lock. Browser grants the lock.
```
## Root cause
The renderer checks the sandbox flag, but the browser-side handler does not re-validate it. For `kPointerLock`, the second half of that pair is missing. `RenderWidgetHostImpl::RequestMouseLock()` has no `IsSandboxed(WebSandboxFlags::kPointerLock)` check, and the downstream `WebContentsImpl::RequestToLockPointer()` checks only `is_fenced_frame()`. The renderer-side check in `PointerLockController::RequestPointerLock` is therefore the sole enforcement point, and a compromised renderer can bypass it by speaking Mojo directly.
The report draws a direct comparison with Bug 491676472, the `allow-modals` bug, which had the identical pattern and was fixed on 2025-03-12. That bug was assigned Security_Severity-High and fixed with `bad_message::ReceivedBadMessage()`. The before and after of that fix:
```cpp
// BEFORE fix: RunJavaScriptDialog() had no IsSandboxed(kModals) check
// AFTER fix (render_frame_host_impl.cc:7251):
if (IsSandboxed(WebSandboxFlags::kModals)) {
bad_message::ReceivedBadMessage(GetProcess(),
bad_message::RFH_JS_DIALOG_FROM_SANDBOXED_FRAME);
return;
}
```
The researcher rates this issue High, as a sandbox policy bypass from a compromised renderer process, comparable to the `kModals` case.
## Impact
With pointer lock obtained from a sandboxed frame, an attacker could:
- capture the mouse cursor from a privileged parent frame context;
- perform UI redress attacks against the user, with the cursor hidden and fake UI shown;
- bypass the `allow-pointer-lock` sandboxing contract that sites rely on to safely embed third-party content.
The precondition is that the attacker has code execution in a renderer process, or can issue the Mojo call directly.
## Fix
The proposed fix adds the missing check in `RenderWidgetHostImpl::RequestMouseLock()`, following the pattern of the `kModals` fix:
```cpp
// Get the focused frame and check its sandbox flags
if (RenderFrameHostImpl* rfh = GetFocusedFrame()) {
if (rfh->IsSandboxed(WebSandboxFlags::kPointerLock)) {
bad_message::ReceivedBadMessage(
GetProcess(),
bad_message::RWHI_POINTER_LOCK_FROM_SANDBOXED_FRAME);
std::move(response).Run(
blink::mojom::PointerLockResult::kPermissionDenied,
mojo::NullRemote());
return;
}
}
```
The handler looks up the focused frame, checks its sandbox flags, reports a bad message from the renderer process, and answers the callback with `kPermissionDenied` and a null remote. The report also asks for a corresponding test in `content/browser/security_exploit_browsertest.cc`, the same file that holds the test for the `kModals` fix.
## Variants to test
The report recommends auditing other sandbox flags for the same missing browser-side check: `kDownloads`, `kOrientationLock`, `kPresentationController` and `kDocumentDomain`. The report recommends auditing these flags for similar missing browser-side checks.
For comparison, the report notes which flags already have browser-side checks:
- `kPopups` is checked in `CreateNewWindow` (line 10092).
- `kTopNavigationByUserActivation` is checked (line 983).
- `kModals` received its check with Bug 491676472.## What happened, in plain words
A web page can normally ask the browser for permission to take control of the mouse pointer. When it is granted, the arrow cursor disappears from the screen and every mouse movement is sent to that page instead of to the rest of the computer. This is called pointer lock, and it is what makes first-person games and some drawing tools work inside a browser tab.
Because that is a powerful thing to hand to a page, browsers let a website say "this embedded piece of content is not allowed to do that". A site can put another site inside a box on its page (an iframe) and attach a rule list called the sandbox attribute. One of those rules, `allow-pointer-lock`, is the switch that permits pointer lock. If the switch is absent, the embedded content is supposed to be refused.
Chrome checks that rule in two separate places. One check runs inside the part of Chrome that draws the page, called the renderer. The other check is supposed to run in the browser process, the central part of Chrome that makes the real decisions. The reason for checking twice is simple: the renderer handles content from the internet, so it is treated as untrustworthy. If an attacker manages to break into the renderer, the browser process should still refuse to do dangerous things on its behalf.
This report found that for pointer lock, only the first check exists. The browser process accepts the request without looking at the sandbox rule again. An attacker who has already broken into the renderer can therefore skip the first check and talk to the browser process directly, and the browser will grant pointer lock to a frame that was never allowed to have it.
The report rates this High, calls it a sandbox policy bypass, and compares it to an earlier, already fixed bug about JavaScript dialog boxes (Bug 491676472).
## The pieces involved
Before following the report, here are the moving parts it names, explained from scratch.
- **The Pointer Lock API.** An API (application programming interface) is simply a set of commands a program offers to other programs. The Pointer Lock API is the set of commands a web page uses to ask for the mouse. When it succeeds, the cursor vanishes and mouse movement events go to the page.
- **The sandbox attribute.** HTML lets a page embed another page in an iframe. The `sandbox` attribute is a list of permissions for that embedded page. Each permission is a word like `allow-scripts` (let the embedded page run JavaScript) or `allow-pointer-lock` (let it take the mouse). Anything not listed is denied. Think of it as a guest list at a door: if your name is not on it, you do not get in.
- **The renderer and the browser process.** Chrome splits itself into pieces. The renderer draws pages and runs their JavaScript. The browser process is the boss: it opens windows, reads files, and decides what is allowed. Because renderers run untrusted code from the web, the browser process is designed never to trust what a renderer says.
- **Mojo IPC.** IPC means inter-process communication: the way two pieces of a program talk to each other. Mojo is Chrome's system for that. A renderer sends a message over Mojo to the browser process, and the browser process runs a handler for it. Think of it as an internal mail service between departments.
- **Defence in depth.** Checking the same rule in more than one place, so that if one check fails or is bypassed, another still holds. A bank teller checking your ID and a manager checking it again is the everyday version.
- **Sandbox flag.** Each permission in the sandbox attribute corresponds to an internal flag in Chrome's code, such as `WebSandboxFlags::kPointerLock`. The code asks "is this frame sandboxed for pointer lock?" by testing that flag.
- **Fenced frame.** A newer kind of embedded frame with stricter isolation rules. It is a different concept from a sandboxed frame, and the report treats the two separately.
- **Bad message.** When the browser process receives a message from a renderer that should never have been sent, it can flag it as a bad message. This is a signal that the renderer may be compromised, and Chrome can act on it, for example by terminating that renderer.
## Where the code lives
The report names the affected component as `PointerLock`, with the main code in `content/browser/renderer_host/render_widget_host_impl.cc` and a second path in `content/browser/web_contents/web_contents_impl.cc`. The Mojo interface involved is `blink.mojom.FrameWidgetInputHandler::RequestMouseLock`. An interface here means a named set of messages that one process can send to another; `RequestMouseLock` is the specific message that asks for the mouse.
## Which versions were tested
The researcher checked current Chrome builds. The versions listed as affected and unfixed as of 2026-03-12 are:
| Version | Channel / build | Status |
|---|---|---|
| Chrome 145.0.7632.160 | Stable, arm64, macOS | verified |
| Chrome 146.0.7680.72 | next Stable, branch position 1582197 | unfixed |
| Chromium main | main | unfixed |
A branch position (Cr-Commit-Position) is a numbered marker in Chrome's source code history, like a page number in a very long book. It lets developers say exactly which version of the code contains a change. The report notes that the comparable `kModals` fix (Bug 491676472) landed at position 1598123, which is newer than both 145 stable (around 1568190) and 146 stable (around 1582197). The `kPointerLock` fix has not landed anywhere.
Reproducing the full bypass needs a patched renderer or a Mojo fuzzer, because the normal JavaScript route is stopped before it ever reaches the browser. A fuzzer is a tool that fires large numbers of automatically generated inputs at a program to see what breaks. The attached `index.html` shows the renderer-side block and points at the missing browser-side check; on its own it does not send the Mojo message.
## Finding it
The starting point is the check inside the renderer, in `PointerLockController::RequestPointerLock`. It correctly reads the sandbox flag and refuses the request:
```cpp
// third_party/blink/renderer/core/page/pointer_lock_controller.cc:94
if (window->IsSandboxed(WebSandboxFlags::kPointerLock)) {
resolver->RejectWithSecurityError(...);
return;
}
// calls: GetWidgetForLocalRoot()->RequestMouseLock(...)
```
Line by line:
1. The first line is a comment giving the file and line number, so a reader can jump straight to it. `pointer_lock_controller.cc` is the file in Blink, Chrome's web engine, that handles pointer lock requests.
2. `if (window->IsSandboxed(WebSandboxFlags::kPointerLock))` asks a yes or no question: is this window sandboxed in a way that forbids pointer lock? `window` is the page's window object, and `IsSandboxed` is the function that tests the flag.
3. If the answer is yes, `resolver->RejectWithSecurityError(...)` sends a security error back to the page. A resolver is the object that holds the pending answer to the page's request; rejecting it means the page is told no.
4. `return;` stops the function there, so nothing further happens.
5. The final comment notes what would have been called next if the check had passed: `GetWidgetForLocalRoot()->RequestMouseLock(...)`, which is the request that travels onward towards the browser process.
That check is the only thing standing between a sandboxed frame and pointer lock. The browser-side handler that the renderer calls next does not repeat the validation:
```cpp
// content/browser/renderer_host/render_widget_host_impl.cc:3281
void RenderWidgetHostImpl::RequestMouseLock(
bool from_user_gesture,
bool unadjusted_movement,
RequestMouseLockCallback response) {
// ❌ MISSING: IsSandboxed(WebSandboxFlags::kPointerLock) check
if (IsPointerLocked()) { ... }
if (!view_ || !view_->CanBePointerLocked()) { ... }
delegate_->RequestToLockPointer(this, from_user_gesture, ...);
}
```
Line by line:
1. The comment gives the file and line: `render_widget_host_impl.cc` is the browser-side code that manages a rendered widget, meaning the thing that draws a page.
2. `void RenderWidgetHostImpl::RequestMouseLock(` begins the function that handles the request. `void` means it returns nothing directly; the answer goes back through a callback.
3. `bool from_user_gesture,` is a true or false value saying whether the request came from a real user action such as a click. `bool` is the programming type for true or false.
4. `bool unadjusted_movement,` is another true or false value about whether raw, unadjusted mouse movement is wanted.
5. `RequestMouseLockCallback response)` is the callback: a function the handler will call later with the result, like leaving a phone number for a return call.
6. The comment with the cross marks the missing check: there is no `IsSandboxed(WebSandboxFlags::kPointerLock)` test here.
7. `if (IsPointerLocked()) { ... }` handles the case where the pointer is already locked.
8. `if (!view_ || !view_->CanBePointerLocked()) { ... }` handles the case where there is no view, or the view cannot be pointer locked. The `!` means not, and `||` means or.
9. `delegate_->RequestToLockPointer(this, from_user_gesture, ...);` passes the request on to the delegate, the next object in the chain, which is where the browser makes the real decision.
The next hop, `WebContentsImpl::RequestToLockPointer`, does perform one browser-side check, but only for fenced frames:
```cpp
// content/browser/web_contents/web_contents_impl.cc:5091
void WebContentsImpl::RequestToLockPointer(...) {
if (render_widget_host->frame_tree()->is_fenced_frame()) {
ReceivedBadMessage(...); // �
fenced frame check
return;
}
// ❌ NO: GetSandboxFlags() & WebSandboxFlags::kPointerLock
delegate_->RequestPointerLock(this, user_gesture, ...);
}
```
Line by line:
1. The comment gives the file and line: `web_contents_impl.cc` is the browser-side code for the contents of a tab.
2. `void WebContentsImpl::RequestToLockPointer(...) {` begins the function. The `...` stands for arguments the report does not spell out.
3. `if (render_widget_host->frame_tree()->is_fenced_frame()) {` asks whether the frame making the request is a fenced frame. `frame_tree()` gives the structure of frames in the tab, and `is_fenced_frame()` answers yes or no.
4. `ReceivedBadMessage(...);` reports that the renderer sent something it should not have. The tick comment marks this as a correct check.
5. `return;` stops, so a fenced frame is refused.
6. The cross comment marks what is absent: there is no test of `GetSandboxFlags() & WebSandboxFlags::kPointerLock`. The `&` is a bitwise and, a way of testing whether a particular flag is set inside a combined value.
7. `delegate_->RequestPointerLock(this, user_gesture, ...);` passes the request to the next object, which will actually grant the lock.
So the browser process validates the frame type but not the sandbox flags of the requesting frame. A renderer that skips the Blink check, or that is simply compromised, reaches the browser handler and is granted the lock.
## How the attack works
The attack assumes the attacker already has code execution in a renderer process, for example through a V8 or Blink memory corruption bug. V8 is Chrome's JavaScript engine; Blink is its web engine. Memory corruption is a class of bug where a program writes data where it should not, which an attacker can sometimes turn into running their own code.
### Step 1: host a sandboxed frame
The renderer hosts an iframe declared with `sandbox="allow-scripts"` and without `allow-pointer-lock`. This is the ordinary way a site embeds untrusted third-party content while denying it powerful capabilities. The embedded page may run scripts, but it may not take the mouse.
### Step 2: confirm the normal path is blocked
Calling the Pointer Lock API from JavaScript inside that frame is rejected by the renderer-side check shown above. The attached `index.html` demonstrates exactly this: the renderer-side check correctly blocks pointer lock via normal JavaScript.
### Step 3: call the Mojo interface directly
Instead of going through the Blink API, the attacker patches the renderer or issues the IPC call directly:
```text
FrameWidgetInputHandler::RequestMouseLock(true, false, callback)
```
This is a single message. `FrameWidgetInputHandler` is the Mojo interface, `RequestMouseLock` is the message name, and the three items in brackets are its arguments. `true` and `false` are the two true or false values, and `callback` is the function that will receive the answer. The two boolean arguments correspond to `from_user_gesture` and `unadjusted_movement` in the browser-side handler signature shown earlier. Because `RenderWidgetHostImpl::RequestMouseLock()` does not check `WebSandboxFlags::kPointerLock`, and `WebContentsImpl::RequestToLockPointer()` only rejects fenced frames, the request passes through to `delegate_->RequestPointerLock(...)`.
### Step 4: observe the result
The browser grants pointer lock. The cursor disappears and all mouse movement events are captured by the sandboxed frame.
The report's reproduction note for the full bypass is:
```text
# Call FrameWidgetInputHandler::RequestMouseLock(true, false)
# from a renderer hosting a sandbox="allow-scripts" iframe
# without allow-pointer-lock. Browser grants the lock.
```
These three lines are comments, each starting with `#`, describing the conditions rather than executable steps. The first says which message to send and with which arguments. The second says where it must be sent from: a renderer hosting an iframe with `sandbox="allow-scripts"` and no `allow-pointer-lock`. The third states the expected outcome: the browser grants the lock.
## Root cause
The design intent is defence in depth: the renderer checks sandbox flags for usability and correctness, and the browser process re-checks them because it cannot trust the renderer. For `kPointerLock`, the second half of that pair is missing. `RenderWidgetHostImpl::RequestMouseLock()` has no `IsSandboxed(WebSandboxFlags::kPointerLock)` check, and the downstream `WebContentsImpl::RequestToLockPointer()` checks only `is_fenced_frame()`. The renderer-side check in `PointerLockController::RequestPointerLock` is therefore the sole enforcement point, and a compromised renderer can bypass it by speaking Mojo directly.
The report draws a direct comparison with Bug 491676472, the `allow-modals` bug, which had the identical pattern and was fixed on 2025-03-12. Modals are the pop-up dialog boxes a page can open. That bug was assigned Security_Severity-High and fixed with `bad_message::ReceivedBadMessage()`. The before and after of that fix:
```cpp
// BEFORE fix: RunJavaScriptDialog() had no IsSandboxed(kModals) check
// AFTER fix (render_frame_host_impl.cc:7251):
if (IsSandboxed(WebSandboxFlags::kModals)) {
bad_message::ReceivedBadMessage(GetProcess(),
bad_message::RFH_JS_DIALOG_FROM_SANDBOXED_FRAME);
return;
}
```
Line by line:
1. The first comment says that before the fix, the function `RunJavaScriptDialog()` had no `IsSandboxed(kModals)` check. That function is what opens a JavaScript dialog box.
2. The second comment says the code below is the state after the fix, at `render_frame_host_impl.cc` line 7251.
3. `if (IsSandboxed(WebSandboxFlags::kModals)) {` asks whether the frame is sandboxed in a way that forbids modals.
4. `bad_message::ReceivedBadMessage(GetProcess(),` reports a bad message, naming the process it came from via `GetProcess()`.
5. `bad_message::RFH_JS_DIALOG_FROM_SANDBOXED_FRAME);` is the specific reason code: a JavaScript dialog arrived from a sandboxed frame. A reason code is a label that says exactly what went wrong.
6. `return;` stops, so the dialog is never opened.
The researcher rates this issue High, as a sandbox policy bypass from a compromised renderer process, comparable to the `kModals` case.
## What an attacker could do
With pointer lock obtained from a sandboxed frame, an attacker could:
- capture the mouse cursor from a privileged parent frame context;
- perform UI redress attacks against the user, with the cursor hidden and fake UI shown;
- bypass the `allow-pointer-lock` sandboxing contract that sites rely on to safely embed third-party content.
UI redress means tricking a user into interacting with something different from what they think they are clicking, often by placing invisible or misleading elements over a page. A privileged parent frame is the surrounding page that embedded the frame and holds more trust than the embedded content.
The precondition is that the attacker has code execution in a renderer process, or can issue the Mojo call directly.
## The proposed fix
The proposed fix adds the missing check in `RenderWidgetHostImpl::RequestMouseLock()`, following the pattern of the `kModals` fix:
```cpp
// Get the focused frame and check its sandbox flags
if (RenderFrameHostImpl* rfh = GetFocusedFrame()) {
if (rfh->IsSandboxed(WebSandboxFlags::kPointerLock)) {
bad_message::ReceivedBadMessage(
GetProcess(),
bad_message::RWHI_POINTER_LOCK_FROM_SANDBOXED_FRAME);
std::move(response).Run(
blink::mojom::PointerLockResult::kPermissionDenied,
mojo::NullRemote());
return;
}
}
```
Line by line:
1. The comment explains the intent: get the focused frame and check its sandbox flags. The focused frame is the one currently receiving input.
2. `if (RenderFrameHostImpl* rfh = GetFocusedFrame()) {` fetches the focused frame and stores it in a variable named `rfh`. `RenderFrameHostImpl*` is the type of that variable, a pointer to a browser-side object representing a frame. If there is no focused frame, the whole block is skipped.
3. `if (rfh->IsSandboxed(WebSandboxFlags::kPointerLock)) {` asks whether that frame is sandboxed against pointer lock.
4. `bad_message::ReceivedBadMessage(` starts reporting a bad message.
5. `GetProcess(),` names the renderer process the message came from.
6. `bad_message::RWHI_POINTER_LOCK_FROM_SANDBOXED_FRAME);` is the reason code: a pointer lock request arrived from a sandboxed frame. `RWHI` stands for RenderWidgetHostImpl, the class containing the handler.
7. `std::move(response).Run(` calls the callback with the answer. `std::move` hands the callback over efficiently rather than copying it.
8. `blink::mojom::PointerLockResult::kPermissionDenied,` is the answer: permission denied.
9. `mojo::NullRemote());` supplies an empty remote, meaning no connection is handed back. A remote here is a handle to the other end of a Mojo connection.
10. `return;` stops the handler so the request never reaches the delegate.
The handler looks up the focused frame, checks its sandbox flags, reports a bad message from the renderer process, and answers the callback with `kPermissionDenied` and a null remote. The report also asks for a corresponding test in `content/browser/security_exploit_browsertest.cc`, the same file that holds the test for the `kModals` fix.
## Other flags worth checking
The report recommends auditing other sandbox flags for the same missing browser-side check: `kDownloads`, `kOrientationLock`, `kPresentationController` and `kDocumentDomain`. An audit here means a systematic review: go through each one and look for the same gap. These flags govern, respectively, downloading files, locking the screen orientation, controlling presentations, and relaxing the same-origin rule through `document.domain`.
The report recommends auditing these flags for similar missing browser-side checks.
For comparison, the report notes which flags already have browser-side checks:
- `kPopups` is checked in `CreateNewWindow` (line 10092). Popups are the extra windows a page can open.
- `kTopNavigationByUserActivation` is checked (line 983). This flag concerns navigating the top-level page only after a user action.
- `kModals` received its check with Bug 491676472.
## Glossary
- **API**: a set of commands one program offers to another so they can work together.
- **Bad message**: a message the browser process receives from a renderer that should never have been sent, often a sign the renderer is compromised.
- **Bitwise and (`&`)**: an operation that compares the individual bits of two values, used here to test whether a particular flag is set.
- **Blink**: Chrome's web engine, the part that parses and renders web pages.
- **Boolean**: a value that is either true or false.
- **Branch position (Cr-Commit-Position)**: a numbered marker in Chrome's source code history identifying exactly which version of the code contains a change.
- **Browser process**: the central Chrome process that makes decisions and is not supposed to trust renderers.
- **Callback**: a function passed along so it can be called later with a result, like leaving a number for a return call.
- **Code execution**: the ability to make a program run an attacker's own instructions, usually after exploiting a bug.
- **Defence in depth**: checking the same rule in more than one place so a single failure does not open the door.
- **Delegate**: the next object in a chain that a handler passes a request to for the real decision.
- **Fenced frame**: a newer kind of embedded frame with stricter isolation rules, separate from a sandboxed frame.
- **Flag**: an internal on or off setting in code, here one permission from the sandbox attribute.
- **Fuzzer**: a tool that sends large numbers of automatically generated inputs to a program to find crashes and bugs.
- **Iframe**: a box inside a web page that displays another web page.
- **IPC**: inter-process communication, the way separate parts of a program talk to each other.
- **Memory corruption**: a class of bug where a program writes data where it should not, sometimes turning into code execution.
- **Mojo**: Chrome's system for IPC between its processes.
- **Mojo interface**: a named set of messages one process can send to another over Mojo.
- **Pointer lock**: a browser feature where the cursor disappears and all mouse movement goes to the page.
- **Pointer Lock API**: the set of commands a page uses to request pointer lock.
- **Reason code**: a label attached to an error saying exactly what went wrong.
- **Remote (Mojo)**: a handle to the other end of a Mojo connection; a null remote means no connection is handed back.
- **Renderer**: the Chrome process that draws pages and runs their JavaScript, treated as untrusted.
- **Resolver**: the object holding the pending answer to a page's request, which can be rejected with an error.
- **Sandbox attribute**: an HTML attribute listing which permissions an embedded frame is allowed.
- **Sandbox flag**: the internal code setting that corresponds to one sandbox permission.
- **Sandbox policy bypass**: getting around the rules that restrict what embedded or untrusted content may do.
- **UI redress**: tricking a user into interacting with something different from what they believe they are clicking.
- **V8**: Chrome's JavaScript engine.
- **View**: the browser-side object that draws a rendered page.