Summary
Joplin's Fountain rendering path can place unsanitized HTML into note output, allowing malicious Fountain content to execute script in affected clients or published notes.
The risk arises when Fountain rendering is enabled and a user views the affected note, potentially exposing note content or data available to an authenticated browser in the server's origin.
Affected context
The issue occurs in Joplin's Fountain-to-HTML rendering path when generated HTML is inserted into note output without adequate sanitization. It may affect desktop or mobile clients with Fountain rendering enabled, as well as notes published through Joplin Server configurations where Fountain rendering is enabled. Impact depends on who can create or modify Fountain content and which data is accessible in the viewer's browser context.
Exploit preconditions
- Attack surface: Joplin note rendering and published-note viewing
- Required access: Ability to create or modify a note containing malicious Fountain content, or cause such a note to be published
- Trigger point: Rendering and subsequent viewing of the affected note with Fountain support enabled
- Why exploitation is possible: Renderer-generated HTML is trusted and inserted into note output without sufficient sanitization, allowing script-bearing content to reach the browser
Why this happens
The underlying bug is an output-encoding and sanitization failure in the handling of renderer-generated HTML.
The Fountain renderer produces HTML that is passed into note output as trusted content rather than being constrained to an approved set of elements and attributes. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-influenced content can be interpreted as active browser script.
Potential impact
- A malicious note may execute script in a viewer's browser
- Script may read notes or other content subsequently loaded in the reused viewer
- An authenticated browser session may expose data available to the Joplin Server origin
- Published-note viewers could experience unauthorized actions within their permitted session
- The issue could enable phishing, content manipulation, or account-impacting browser actions
General mitigation guidance
Mitigation generally focuses on treating all renderer output as untrusted and enforcing safe output boundaries.
Common defensive patterns include:
- Sanitizing generated HTML with a well-maintained, allowlist-based HTML sanitizer
- Applying contextual output encoding before content reaches the browser
- Restricting permitted tags, attributes, URL schemes, and active-content features
- Avoiding direct insertion of untrusted HTML when a structured text or DOM API provides a safer alternative
- Isolating published notes from sensitive server origins where practical
- Applying least privilege to authenticated browser sessions and limiting exposed server data
- Disabling optional rendering features when their security controls cannot be verified
How teams detect issues like this
Organizations can detect related issues through:
- Static analysis rules for direct HTML insertion, unsafe template rendering, and missing sanitization
- Code review checks for renderer output crossing into browser-facing note content
- Tests containing benign markup and script-like input to verify that active content is neutralized
- Content Security Policy monitoring and violation reporting for unexpected script execution
- Runtime review of published-note origins, cookie scope, and browser-accessible server resources
- Automated security review tools that flag untrusted data flowing into HTML sinks

