/

CVE-2026-27627

Severity:

HIGH RISK

(8.2)

XSS in Karakeep Reddit Metascraper Plugin

CVE-2026-27627

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting and Client-Side Code Execution

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Karakeep 0.30.0 contains a stored cross-site scripting (XSS) vulnerability in its Reddit metascraper integration, where HTML returned in readableContentHtml is injected into the reader view without sanitization.

If an attacker can influence the HTML content returned from Reddit, that malicious markup is rendered via dangerouslySetInnerHTML in users' browsers and can execute arbitrary JavaScript in their session.

Affected context

The issue occurs in Karakeep's crawler/reader pipeline specifically when processing content through the Reddit metascraper plugin.

Unlike other content sources, this path bypasses both Readability and DOMPurify, passing the readableContentHtml response directly into a frontend component that uses dangerouslySetInnerHTML to render the reader view.

Deployments that ingest Reddit content and present it to end users in the reader interface are affected when the application treats that HTML as trusted.

Exploit preconditions

  • Attack surface: Web UI (reader view) rendering Reddit-sourced content.
  • Required access: Ability to cause Karakeep to fetch or display Reddit content containing attacker-controlled HTML (e.g., by controlling or influencing a Reddit post, comment, or previewed content).
  • Trigger point: A user opens a Karakeep reader view for an affected Reddit item whose readableContentHtml includes malicious markup or script constructs.
  • Why exploitation is possible: The Reddit-specific pipeline skips the normal sanitization flow; readableContentHtml is not passed through Readability or DOMPurify and is rendered directly via dangerouslySetInnerHTML, allowing script-capable HTML to execute.

Why this happens

This vulnerability stems from inconsistent output sanitization in the content-processing pipeline.

Most sources in Karakeep are normalized via Readability and then sanitized by DOMPurify before being rendered, but the Reddit metascraper path bypasses these steps and treats the returned readableContentHtml as trusted.

Mapping to CWE-79: Improper Neutralization of Input During Web Page Generation (XSS), the bug class is: untrusted HTML from an external system is inserted into the DOM using dangerouslySetInnerHTML without proper sanitization or encoding, enabling execution of attacker-controlled JavaScript in the browser.

Potential impact

  • Attacker-controlled JavaScript may run in the context of the Karakeep web application.
  • Session data and in-app sensitive information could be read or exfiltrated from the browser.
  • User actions might be spoofed, such as adding, modifying, or deleting bookmarks or configuration via scripted requests.
  • Content displayed in the UI could be altered to perform phishing or drive-by attacks against users.
  • If the app is integrated with other services or APIs, tokens or API keys accessible from the frontend could be at risk.

General mitigation guidance

Mitigation focuses on enforcing a consistent HTML sanitization strategy for all content sources and avoiding unsafe DOM APIs where possible.

Recommended patterns include:

  • Ensuring every ingestion path that can produce HTML passes through a robust, allowlist-based HTML sanitizer (e.g., DOMPurify or equivalent) before rendering.
  • Normalizing content from third-party sources through a common processing pipeline (such as Readability + sanitization) rather than maintaining special-case bypasses.
  • Minimizing or eliminating usage of dangerouslySetInnerHTML; where it is unavoidable, restrict it to sanitized, application-controlled HTML only.
  • Adopting a strict Content Security Policy (CSP) to limit the impact of potential future XSS issues (e.g., disallow inline scripts and unsafe eval).
  • Treating all external or third-party content as untrusted, regardless of perceived reputation of the source, and applying the same sanitization guarantees across the board.

How teams detect issues like this

Detection typically involves reviewing both the frontend rendering code and the content ingestion pipeline:

  • Static analysis and linting:
  • Search for dangerouslySetInnerHTML, innerHTML, and similar sinks, and verify each usage is preceded by explicit sanitization.
  • Enforce lint rules or custom checks that flag direct injection of untrusted HTML into the DOM.
  • Code review signals:
  • Identify special-case logic for particular content sources (e.g., Reddit-specific branches) and verify they reuse the shared sanitization utilities.
  • Examine places where HTML from external services is trusted based on origin (e.g., "it's from Reddit, so it's safe") rather than explicit sanitization.
  • Automated security testing:
  • Use dynamic scanners or integration tests that inject benign XSS test strings into external content and verify that they are neutralized in the UI.
  • Integrate security-focused unit tests around the content-processing and rendering modules, asserting that sanitizer functions are always invoked for HTML sources.
  • Policy enforcement:
  • Implement CI/CD policies that require security review for any changes to HTML rendering paths, sanitizer configuration, or metascraper plugins.

Sources

SourceLink
github.comgithub.com/karakeep-app/karakeep/commit/ba3db953c0d8675e2e3ecc29113a332b570b2cb9
github.comgithub.com/karakeep-app/karakeep/releases/tag/v0.31.0
github.comgithub.com/karakeep-app/karakeep/security/advisories/GHSA-mg93-f9mw-wpgj

Frequently asked

questions

Yes. If an attacker can cause Karakeep to process Reddit content that they control or influence, they can remotely trigger malicious script execution in the browsers of users who view that content in the reader view.

Exploitation depends on how Karakeep is exposed. In many setups, an attacker only needs the ability to supply or influence Reddit content that Karakeep later fetches. Viewing the resulting entry in the reader view is typically done by an authenticated user, but the attacker does not necessarily need direct access to the Karakeep instance itself.

Apply a single, mandatory sanitization pipeline for all HTML content—regardless of source—before it reaches any dangerouslySetInnerHTML or similar DOM injection sink, and avoid source-specific bypasses that skip sanitization.

Adopt a "untrusted by default" stance for all external content, enforce centralized sanitization utilities, lint against direct DOM injection APIs, and incorporate security reviews and automated tests for any changes involving HTML rendering or third-party content integrations.

Find out what's already
exploitable in your codebase.