CVE-2020-26297: MdBook Cross-Site Scripting Vulnerability
HIGHCVE-2020-26297 is a HIGH (CVSS 8.2) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting MdBook libraries in the crates.io ecosystem. The issue involves xss in mdbook. Remediation is available by upgrading affected packages to version 0.4.5.
CVE-2020-26297 at a Glance
Security Impact
CVSS: 8.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N).
How to Fix CVE-2020-26297
To remediate this vulnerability, upgrade all affected MdBook dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade mdBook to 0.4.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for mdBook
How to Check if You Are Affected
To determine whether your application is affected by CVE-2020-26297, inspect your project dependencies for MdBook:
inspect dependencies for mdBook
Analyze the terminal output to locate any version of MdBook in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.5), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In MdBook, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2020-26297 Affected MdBook Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
mdBook
|
crates.io |
≥ 0.1.4
< 0.4.5
|
0.4.5
|
References
Frequently Asked Questions
What is CVE-2020-26297?
Which MdBook versions are affected?
What version fixes CVE-2020-26297?
Is mdBook affected?
What is the CVSS score of CVE-2020-26297?
What CWE is associated with CVE-2020-26297?
How can I check crates.io dependencies for CVE-2020-26297?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gx5w-rrhp-f436",
"modified" : "2021-08-18T21:06:53Z",
"published" : "2021-08-25T20:56:20Z",
"aliases" : [ "CVE-2020-26297" ],
"summary" : "XSS in mdBook",
"details" : "> This is a cross-post of [the official security advisory][ml]. The official post contains a signed version with our PGP key, as well.\n\n[ml]: https://groups.google.com/g/rustlang-security-announcements/c/3-sO6of29O0\n\nThe 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.\n\nThe CVE for this vulnerability is [CVE-2020-26297](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-26297).\n\n## Overview\n\nThe 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.\n\nmdBook 0.4.5 fixes the vulnerability by properly escaping the search query.\n\n## Mitigations\n\nOwners 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:\n\n```\ncargo install mdbook --version 0.4.5 --force\n```\n\n## Acknowledgements\n\nThanks to Kamil Vavra for responsibly disclosing the vulnerability to us according to [our security policy](https://www.rust-lang.org/policies/security).\n\n## Timeline of events\n\nAll times are listed in UTC.\n\n- 2020-12-30 20:14 - The issue is reported to the Rust Security Response WG\n- 2020-12-30 20:32 - The issue is acknowledged and the investigation began\n- 2020-12-30 21:21 - Found the cause of the vulnerability and prepared the patch\n- 2021-01-04 15:00 - Patched version released and vulnerability disclosed",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "mdBook"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.1.4"
}, {
"fixed" : "0.4.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-lang/mdBook/security/advisories/GHSA-gx5w-rrhp-f436"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-26297"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-lang/mdBook/commit/32abeef088e98327ca0dfccdad92e84afa9d2e9b"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-lang/mdBook"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-045"
}, {
"type" : "WEB",
"url" : "https://groups.google.com/g/rustlang-security-announcements/c/3-sO6of29O0"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2021-0001.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-08-18T21:06:53Z",
"nvd_published_at" : "2021-01-04T19:15:00Z"
}
}