CVE-2021-33040: Cross-site Scripting in epubjs
6.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.52153%
CWE
Published
1/21/2022
Updated
9/21/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
epubjs | npm | < 0.3.89 | 0.3.89 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key factors:
- The iframe creation in IframeView.create() lacked critical sandbox attributes (added in the patched commit ab4dd46), which would normally restrict script execution.
- The content loading mechanism in IframeView.load() directly writes unsanitized content into the iframe document. The combination of these factors allows attacker-controlled EPUB content to execute scripts in the host page context. The patch explicitly adds sandbox='allow-same-origin' to the iframe and documents scripted content handling, confirming these were the vulnerable points.