Email me

Rust advisories / mdbook

Vulnerability MediumRUSTSEC-2021-0001 · mdbook

RUSTSEC-2021-0001: XSS in mdBook's search page

Short answerA security vulnerability in the mdbook crate: XSS in mdBook's search page. Medium severity (CVSS 6.1). Fixed in 0.4.5: update to a fixed version.

Cratemdbook
TypeVulnerability (code-execution)
Affected versionsFrom 0.1.4 before 0.4.5.
Fixed in0.4.5
SeverityMedium, CVSS 6.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Published2021-01-04
Last changed2023-11-08
Also known asCVE-2020-26297, GHSA-gx5w-rrhp-f436

What to do

  1. See which version you have: cargo tree -i mdbook (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p mdbook. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example mdbook = "0.4.5") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

> This is a cross-post of the official security advisory. The official post > contains a signed version with our PGP key, as well.

The Rust Security Response Working Group was recently notified of a security issue affecting the search feature of mdBook, which could allow an attacker to execute arbitrary JavaScript code on the page.

The CVE for this vulnerability is CVE-2020-26297.

Overview

The search feature of mdBook (introduced in version 0.1.4) was affected by a cross site scripting vulnerability that allowed an attacker to execute arbitrary JavaScript code on an user's browser by tricking the user into typing a malicious search query, or tricking the user into clicking a link to the search page with the malicious search query prefilled.

mdBook 0.4.5 fixes the vulnerability by properly escaping the search query.

Mitigations

Owners of websites built with mdBook have to upgrade to mdBook 0.4.5 or greater and rebuild their website contents with it. It's possible to install mdBook 0.4.5 on the local system with:

cargo install mdbook --version 0.4.5 --force

Acknowledgements

Thanks to Kamil Vavra for responsibly disclosing the vulnerability to us according to our security policy.

Timeline of events

All times are listed in UTC.

  • 2020-12-30 20:14 - The issue is reported to the Rust Security Response WG
  • 2020-12-30 20:32 - The issue is acknowledged and the investigation began
  • 2020-12-30 21:21 - Found the cause of the vulnerability and prepared the patch
  • 2021-01-04 15:00 - Patched version released and vulnerability disclosed

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ