Browser Architecture: Processes, Site Isolation and Sandboxes
A web browser runs code from every site you visit, written by strangers, on the same machine that holds your mail session, your bank login and your files. It is the most attacked piece of software most people use, and its design shows it: a modern browser is a small operating system of cooperating processes, each with as few privileges as its job allows. Browser security research is the study of where those processes trust each other. This lesson explains the architecture at the level a researcher needs before reading a browser advisory; the web-platform rules themselves (same-origin policy, CORS, CSP) are in Web Application Security.
The processes
| Process | Does | Privileges |
|---|---|---|
| browser (main) | UI, navigation, cookies, storage, permissions, file and network access on behalf of others | full user privileges: the trusted core |
| renderer (one per site, or more) | parses HTML, CSS, images; runs JavaScript and WebAssembly (the JIT) | heavily sandboxed: no files, no network sockets, few system calls |
| GPU | talks to the graphics driver | partly sandboxed (drivers need access) |
| network, storage, audio, utility | one service each | sandboxed to what the service needs |
The renderer handles the most complex untrusted input (every web page) and is therefore assumed to be compromisable. Its sandbox is built from operating-system features: on Linux, namespaces plus a seccomp-bpf system-call filter (kernel lesson); on Windows, restricted tokens, job objects, an untrusted or low integrity level, or AppContainer; on macOS, the Seatbelt sandbox. Everything a renderer needs beyond computing, it must ask the browser process for, over IPC (in Chromium, the Mojo framework).
Site isolation
Process separation helps only if each process holds one principal's data. Site isolation puts documents from different sites in different renderer processes, including cross-site iframes inside one page. A site is the scheme plus the registrable domain (the "eTLD+1", computed with the Public Suffix List), so shop.lab.test and cdn.shop.lab.test are the same site but different origins. Chrome turned site isolation on for all desktop sites in 2018, accelerated by Spectre (Spectre and Meltdown): if a renderer can read its whole own address space with a side channel, the only safe place for another site's data is another process. Firefox shipped the same idea as "Fission", on by default for desktop users since Firefox 95 (December 2021).
The example computes origins and sites for a page with three iframes, assigns renderer processes by site, and then plays the browser process receiving two requests: one legitimate, and one from a renderer that claims to act for a site it is not locked to, which is what a compromised renderer would do. It runs in your browser:
from urllib.parse import urlsplit
PUBLIC_SUFFIXES = {"test", "lab.test", "co.lab.test"} # a tiny stand-in for the Public Suffix List
def site(url):
"""scheme + registrable domain (eTLD+1): the unit of site isolation."""
u = urlsplit(url)
labels = u.hostname.split(".")
for i in range(len(labels)):
if ".".join(labels[i + 1:]) in PUBLIC_SUFFIXES:
return f"{u.scheme}://{'.'.join(labels[i:])}"
return f"{u.scheme}://{u.hostname}"
def origin(url):
u = urlsplit(url)
return f"{u.scheme}://{u.hostname}:{u.port or (443 if u.scheme == 'https' else 80)}"
# One tab: a page with three iframes. Which renderer process gets each frame?
frames = ["https://shop.lab.test/cart",
"https://cdn.shop.lab.test/widget", # same site, other origin
"https://pay.co.lab.test/checkout", # different site
"https://ads.example.test/banner"] # different site
processes = {}
for f in frames:
pid = processes.setdefault(site(f), 100 + len(processes))
print(f"{f:<36} origin {origin(f):<30} site {site(f):<28} -> renderer {pid}")
# The browser process checks every request against the renderer's site lock.
locks = {pid: s for s, pid in processes.items()}
def browser_handles(pid, request, url):
if site(url) != locks[pid]:
return f"BAD MESSAGE from renderer {pid}: {request} for {site(url)}, locked to {locks[pid]}; renderer killed"
return f"ok: {request} for {url} (renderer {pid})"
print()
print(browser_handles(100, "read cookies", "https://cdn.shop.lab.test/"))
print(browser_handles(102, "read cookies", "https://pay.co.lab.test/")) # a compromised ad renderer lieshttps://shop.lab.test/cart origin https://shop.lab.test:443 site https://shop.lab.test -> renderer 100
https://cdn.shop.lab.test/widget origin https://cdn.shop.lab.test:443 site https://shop.lab.test -> renderer 100
https://pay.co.lab.test/checkout origin https://pay.co.lab.test:443 site https://pay.co.lab.test -> renderer 101
https://ads.example.test/banner origin https://ads.example.test:443 site https://example.test -> renderer 102
ok: read cookies for https://cdn.shop.lab.test/ (renderer 100)
BAD MESSAGE from renderer 102: read cookies for https://pay.co.lab.test, locked to https://example.test; renderer killed
- The CDN frame shares renderer 100 with the shop page (same site), while the payment and ad frames get their own processes. The ad renderer never holds the payment page's memory, so even a renderer bug plus a side channel cannot read it.
- Every privileged request carries a claim ("cookies for this origin"). The browser process checks it against the site lock of the process that sent it, not against what the message says. The lying renderer is killed. In Chromium this is a "bad message" kill, and such checks exist for every IPC that involves a principal.
The research view: chains and boundaries
Because of this architecture, a full browser compromise is a chain: a bug in the renderer (often in the JavaScript engine, see JIT compilers) gives code execution inside the sandbox; a second bug escapes it, usually in the browser process's handling of IPC, in the GPU process, or in the operating-system kernel. Researchers study each boundary:
| Boundary | Typical bug classes |
|---|---|
| web content to renderer | memory bugs in parsers, layout, the DOM; JIT type confusions; use-after-free in object lifetimes |
| renderer to browser (sandbox escape) | IPC handlers that trust a field, lifetime bugs in browser-side objects, missing site-lock checks |
| renderer to other sites | site-isolation bypasses, cross-origin leaks (XS-Leaks), universal XSS |
| browser to OS | kernel and driver bugs reachable from the sandbox's allowed system calls |
How browser vulnerabilities are detected
Browser vendors run some of the largest fuzzing operations in existence (ClusterFuzz was built for Chrome) with grammar fuzzers for HTML, CSS and JavaScript (Fuzzing Strategies), IPC fuzzers that act as a malicious renderer, and sanitizer builds. Crash reports from users' browsers point to new bugs. Release notes list security fixes with severity and credit, and serious bugs are tracked as CVEs. Exploits seen in the wild are rare and get emergency updates within days.
How browsers are hardened
- Least privilege per process and tighter sandboxes over time.
- Site isolation and cross-origin isolation headers (COOP, COEP) that let sites opt into stronger separation.
- Memory-safety measures: hardened allocators, pointer protection against use-after-free in the browser process (Chromium's MiraclePtr / BackupRefPtr), an in-process sandbox for the JavaScript heap (the "V8 sandbox"), and new components written in memory-safe languages (Rust in Chromium and Firefox).
- Fast updates: auto-update is a security feature; most real attacks use bugs that already have fixes.
Pitfalls
- Confusing origin and site. Same-origin policy is per origin; process isolation is per site. Two subdomains of one site can share a process.
- Assuming the renderer is trusted. Every check that matters must happen in the browser process, on data the renderer cannot forge.
- Testing browsers outside a lab. Research on browser bugs runs on your own builds, in a VM; bug-bounty rules say what you may test and how (Browser bug bounties).
Practice
1. Are https://a.shop.lab.test and http://shop.lab.test the same site?
No: the scheme differs (https vs http), and sites include the scheme ("schemeful same-site"). The registrable domain is the same, shop.lab.test.
2. Why can't the browser process simply trust the origin a renderer puts in its IPC message?
The renderer runs untrusted web content and may be compromised; then every field it sends is attacker-controlled. Only the browser process's own record of which site the process is locked to is trustworthy.
3. What is the minimum a public browser exploit chain needs, and which half does site isolation not stop?
A renderer bug for code execution in the sandbox, plus a sandbox escape (browser IPC, GPU, or kernel bug). Site isolation limits what the renderer half can read from other sites; it does nothing against a sandbox escape.
Test yourself
Which process runs JavaScript from web pages?
- The browser process
- A sandboxed renderer process
- The GPU process
- The network process
What is the unit of site isolation?
- The origin (scheme, host, port)
- The site: scheme plus registrable domain (eTLD+1)
- The tab
- The IP address
Why did Spectre push browsers to site isolation?
- It made JIT compilers slower
- A renderer may read its whole address space with a side channel, so other sites' data must be in another process
- It broke cookies
- It required new TLS versions
What does the browser process do with a renderer request for a site the renderer is not locked to?
- Answers it
- Treats it as a bad message and kills the renderer
- Asks the user
- Logs it and continues