# GHSA-HRJ5-67JP-WQP9: Url::origin() overflows the stack on a URL with nested blob: prefixes

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2026-11-20
- Modified: 2026-11-20

## Affected versions

- url (crates.io): through 2.5.8

## Description

For a `blob:` URL, `Url::origin()` parses the path as a URL and calls itself on the result.
It does so for any inner scheme, `blob` included, so each `blob:` prefix costs one stack frame, with no limit.

```rust
let text = format!("{}https://example.com/", "blob:".repeat(10_000));
let url = Url::parse(&text).unwrap(); // 50,020 bytes, parses fine
// A spawned thread has the default 2 MiB stack.
std::thread::spawn(move || url.origin()).join().unwrap(); // stack overflow, the process aborts
```

A server that wraps each request in `catch_unwind` still goes down as a whole: a stack overflow aborts the process.
`url::quirks::origin`, hidden from the docs and used by Servo, calls `Url::origin()` and is affected too.
The [URL Standard](https://url.spec.whatwg.org/#concept-url-origin) takes the inner URL's origin only when its scheme is `http`, `https`, or `file`, and returns an opaque origin otherwise; it never recurses.

### Impact

Any program that calls `origin()` on a URL from untrusted input can be made to abort.
`url` 2.5.8 and earlier are affected.

Servo's DOM getter `URL.origin` calls `url::quirks::origin`, so page script can trigger it.

Firefox calls it through `MozURL::Origin()` in the parent process, in `ClientSourceParent::RecvExecutionReady`, on a URL that a content process sends, so a compromised content process can make the parent process abort.

### Patches

Fixed in https://github.com/servo/rust-url/pull/1186, which follows the standard.


This is shipped in `url` 2.5.9.

### Workarounds

Compute the origin of a `blob:` URL as the standard does: parse its path, and take that URL's origin only when its scheme is `http`, `https`, or `file`; otherwise treat the origin as opaque.

Note to maintainers: the bug is already public and fixed; please publish this advisory and request a CVE for it.

## References

- https://github.com/servo/rust-url/security/advisories/GHSA-hrj5-67jp-wqp9

Page: https://cve.now/GHSA-HRJ5-67JP-WQP9

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
