Summary
Readest may allow active HTML content embedded in an EPUB chapter to bypass incomplete sanitization and execute JavaScript inside a rendered content iframe. If an attacker can supply or influence book content, the script may access the application's Tauri IPC bridge and potentially achieve arbitrary code execution with the application's privileges.
Affected context
The issue occurs in Readest builds that sanitize EPUB chapter HTML while forbidding only selected tags, without also blocking iframe-based document containers and related attributes. Risk is higher when untrusted or attacker-controlled EPUB content is opened and the rendered content iframe permits scripts and shares the application's origin.
Exploit preconditions
- Attack surface: EPUB chapter HTML rendered by the Readest desktop application
- Required access: Ability to provide, modify, or distribute an EPUB containing attacker-controlled markup
- Trigger point: Sanitized chapter content is inserted into the application's content iframe and rendered
- Why exploitation is possible: The sanitizer may retain an iframe and its
srcdocattribute while treating the attribute value as opaque, allowing active document content to execute within a privileged application context
Why this happens
The vulnerability results from incomplete HTML sanitization that blocks a specific executable tag but does not remove all browser features capable of creating active documents.
DOMPurify may not recursively parse the contents of an iframe srcdoc attribute as independent HTML during sanitization. When the surrounding iframe and attribute survive, browser rendering can interpret the embedded document and execute script. Because the content iframe is configured with script execution and same-origin access, that script may reach the application's Tauri IPC interface. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Potential impact
- Arbitrary JavaScript execution in the rendered content context
- Access to Tauri IPC commands exposed to the application
- Execution of operating-system actions permitted to the application
- Disclosure, modification, or destruction of accessible local data
- Potential compromise of the user's desktop environment
General mitigation guidance
Mitigation generally focuses on treating EPUB content as untrusted active content and eliminating browser features that can create executable subdocuments.
Common defensive patterns include:
- Using an allowlist-based HTML sanitizer with explicit handling for nested document containers
- Blocking iframe, object, embed,
srcdoc, and other active-content features unless they are strictly required - Applying context-appropriate validation to both elements and attributes
- Separating untrusted book content from privileged application origins
- Disabling script execution and minimizing exposed Tauri IPC commands for content-rendering contexts
- Enforcing least privilege for filesystem, process, and application capabilities
- Rendering untrusted content in an isolated environment with restrictive browser policies
How teams detect issues like this
Detection can combine static analysis, review of sanitizer policy, and runtime security controls.
Useful approaches include:
- Searching sanitizer configurations for tag-only deny lists that omit iframe-like elements and document-bearing attributes
- Reviewing code that renders EPUB HTML with script-enabled or same-origin iframes
- Flagging use of
srcdoc, dynamic HTML insertion, and broad Tauri IPC access from content frames - Testing sanitization with nested document containers and active-content attributes
- Enforcing security policies that prohibit privileged IPC exposure to untrusted rendered content
- Using automated code review or security scanning tools to identify incomplete XSS defenses

