Skip to main content
Menu
Advisories

Privileged navigator.servo (ServoInternals) prefs API exposed to web content in about:srcdoc iframes

GHSA-G642-F7QJ-WGXPPublished Updated GitHub

Description

We would like to report a privilege-boundary violation in Servo. The internal ServoInternals interface, reachable from script as navigator.servo, is meant to be available only to trusted about: chrome pages (for example about:config). The gate that decides this trust looks at the document's serialized URL rather than its origin/principal, and it treats every about: URL except about:blank as privileged. A document created from an <iframe srcdoc> attribute is assigned the URL about:srcdoc while its content is fully attacker-authored, so any web page the victim loads can embed such an iframe and obtain navigator.servo. From there, untrusted web content can read every preference and write the script process's feature-flag preferences, by default, with no user interaction.

This issue was found by Anthropic using Claude, and has been reviewed manually by me from Ada Logics.

Let me know if you need any more information.

It was reproduced end to end against a servoshell built from current main HEAD 4e2ad49caae5de92c0125d7b3654bb70579e971e (2026-08-08), built with ./mach build --release and run headless with software GL (Mesa llvmpipe under xvfb). No Servo source is modified; this is default browsing-context behaviour with default preferences.

Location: components/script/dom/servointernals.rs — ServoInternals::is_servo_internal (the faulty disjunct url.scheme() == "about" && url.as_str() != "about:blank"); the sinks SetBoolPreference/SetIntPreference/SetStringPreference (-> prefs::set) and the matching Get*Preference. The srcdoc document is assigned about:srcdoc in components/script/script_thread.rs (page_load_about_srcdoc, ServoUrl::parse("about:srcdoc")). The WebIDL binding components/script_bindings/webidls/ServoInternals.webidl attaches Func="ServoInternals::is_servo_internal" to both the navigator.servo attribute and each Get*/Set*Preference method, so that predicate is exactly what decides visibility of the interface in a realm.

The gate authorizes on the serialized URL string instead of the document's origin/principal:

    fn is_servo_internal(cx: &mut js::context::JSContext, _global: HandleObject) -> bool {
        let realm = CurrentRealm::assert(cx);
        let global_scope = GlobalScope::from_current_realm(&realm);
        let url = global_scope.get_url();
        (url.scheme() == "about" && url.as_str() != "about:blank") ||   // faulty check
            ScriptThread::is_servo_privileged(url) ||
            prefs::get().expose_servointernals_globally
    }

The set of about: URLs is not a trust boundary. about:srcdoc is assigned to a document whose content is fully attacker-controlled — the srcdoc attribute of an iframe written by a web page — yet it has scheme "about" and is not "about:blank", so the first disjunct returns true. The other two disjuncts are inert in the shipped default configuration: is_servo_privileged tests a privileged_urls set that is empty unless an embedder registers custom protocol handlers, and expose_servointernals_globally defaults to false. So by default the gate reduces to the URL test, which about:srcdoc passes.

How attacker web content reaches it, all in default config:

  1. The attacker page contains <iframe srcdoc="<script> ... navigator.servo ... </script>">.
  2. Servo loads the srcdoc document and assigns it the URL about:srcdoc.
  3. Script in the frame accesses navigator.servo. The binding consults is_servo_internal; get_url() returns about:srcdoc; scheme()=="about" and as_str()!="about:blank", so the interface and every Get*/Set*Preference method are exposed.
  4. setBoolPreference(name, value) reaches prefs::set(), overwriting the script process's PREFERENCES; getBoolPreference(name) reads any preference back.

Observed output (real shipped servoshell driving real web content; the srcdoc document reports back to the attacker origin, complete copy in the attached reproducer_output.txt):

[*] launching servoshell headless against nav.example.com ... REPORT {"url":"about:srcdoc","typeofServo":"object","exposed":true, "pref":"dom_webgl2_enabled","before":false,"after":true,"write_ok":true} RESULT=PASS: navigator.servo exposed to about:srcdoc web content AND a real preference was written.

The decisive line is the REPORT: url == about:srcdoc (a document created by attacker-authored srcdoc content), typeof navigator.servo == "object" (the privileged internal API is reachable), and getBoolPreference('dom_webgl2_enabled') == false then setBoolPreference(..., true) then getBoolPreference(...) == true (a genuine process-preference read+write from web content). On a fixed engine navigator.servo is undefined in about:srcdoc and this is impossible.

What access to navigator.servo grants ------------------------------------- navigator.servo is the ServoInternals interface. Its WebIDL states the boundary plainly: "Private interfaces that are only used for internal Servo usage like about: pages. This interface is entirely internal to Servo, and should not be accessible to web pages." Once exposed, web content can call all of it:

preferenceList() enumerate every preference name getPreference / get{String,Int,Bool}Preference / defaultPreferenceValue / preferenceType read the value, default and type of any pref set{String,Int,Bool}Preference write any preference (script-process copy) garbageCollectAllContexts() force GC across all contexts reportMemory() produce a memory report

Concrete gains for an attacker who reaches it from an about:srcdoc frame:

  1. Configuration disclosure. preferenceList() + getPreference() read the deployment's entire preference surface, including network settings such as network_http_proxy_uri, network_https_proxy_uri, network_http_no_proxy, the network_enforce_tls_* flags, and network_local_directory_listing_enabled. Writing those does not cross into the net process, but reading them discloses configured proxy endpoints (which may be internal hosts), whether TLS enforcement is disabled, and configured paths, to arbitrary web content.
  2. Enabling disabled-by-default attack surface, including a path to memory corruption. setBoolPreference flips the script-process dom_* feature flags that ship disabled. The flag is read per call, so in the same frame: navigator.servo.setBoolPreference("dom_webgl2_enabled", true); canvas.getContext("webgl2"); // WebGL2 is off by default; this now succeeds enables WebGL2. WebGL2 in turn exposes a separate heap-buffer-overflow we found in the WebGL ReadPixels path (components/webgl/webgl_thread.rs, WebGLCommand::ReadPixels: the pack buffer is sized width*height*bpp and only PACK_ALIGNMENT is reset, so a stale PACK_ROW_LENGTH installed through the WebGL2 PBO readPixels path drives an out-of-bounds write in the content process). That overflow is not reachable in a default configuration on its own, because WebGL2 is disabled by default (dom_webgl2_enabled = false); reaching ServoInternals from ordinary web content removes that precondition. Other flags in the same class include dom_webgpu_enabled, dom_webrtc_enabled, dom_cookiestore_enabled, and dom_permissions_testing_allowed_in_nonsecure_contexts.
  3. garbageCollectAllContexts() lets web content force garbage collection across all contexts in the process — a denial-of-service / jank primitive, and a possible cross-context timing signal.

Scope bound (stated plainly): the write primitive mutates only the script process's in-memory PREFERENCES copy, so preferences consumed in other processes are readable but not effectively writable through this call. The write is process-global within the script process that hosts the attacker's same-site documents.

On whether you consider this a security issue --------------------------------------------- We recognise that ServoInternals is developer/debug tooling, and that you may not treat navigator.servo as a hardened trust boundary — the expose_servointernals_globally preference, added for testing, suggests it is sometimes regarded as low-sensitivity. We are reporting it because the code itself draws the boundary: the WebIDL says the interface "should not be accessible to web pages", and is_servo_internal exists precisely to keep it off web content, explicitly excluding about:blank as a web-reachable about: URL. about:srcdoc is another web-reachable about: URL that reaches it, and it was, as far as we can tell, never considered in relation to this gate. We have laid out the trust boundary and the concrete gains above so you can judge the impact. In our own reading this is High, given the default-config, unauthenticated, zero-interaction reach from any web page plus the escalation to memory corruption via WebGL2; but we defer to your assessment of severity and whether it warrants a fix and at what priority.

Reachability: the only precondition for reaching navigator.servo is that the victim loads an attacker-controlled web page; that page embeds an <iframe srcdoc="..."> and the script inside the frame obtains navigator.servo. Default build, default preferences, zero interaction, whole-web origin space.

We checked the servo/servo published Security Advisories and the GitHub Advisory DB / NVD for servointernals, is_servo_internal, about:srcdoc, and navigator.servo, and did not find this reported. It appears novel.

Reproduction ------------ Attached is a self-contained Docker reproducer (ANT-2026-8R6T3AMV-e2e.zip).

ANT-2026-8R6T3AMV-e2e.zip

unzip ANT-2026-8R6T3AMV-e2e.zip cd ANT-2026-8R6T3AMV docker build -t servo-e2e-base:latest docker-e2e/servo-base/ docker build -t ant-8r6t3amv docker-e2e/ && docker run --rm ant-8r6t3amv

The base image clones Servo at the pinned commit and builds the real servoshell (./mach build --release; multi-GB download and a long native compile, roughly 30-45 minutes). run_e2e.sh then starts a local HTTP server that serves an attacker page containing an <iframe srcdoc> whose script probes navigator.servo, reads a real preference, writes it, reads it back, and reports the outcome to the attacker origin. It launches the real shipped servoshell headless against that page. The run ends in "RESULT=PASS". The full report and captured output (reproducer_output.txt) are included.

Disclosure ---------- We follow coordinated disclosure policy here: anthropic.com/coordinated-vulnerability-disclosure (90 day deadline).

Please credit Claude and Ada Logics -- found by Anthropic using agents to study the security of open-source projects, with Ada Logics validating and reporting.

Affected versions

References

GitHub · servo/servo