/

CVE-2026-48788

Severity:

HIGH RISK

(8.2)

Cross-Site Scripting (CWE-79) in Remark42 Image Proxy

CVE-2026-48788

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-436

Impact:

Arbitrary JavaScript execution in the context of the Remark42 origin, enabling session hijacking, content manipulation, and user targeting.

Severity:

HIGH RISK

(8.2)

CVSS version:

3.0

Catch this CVE while code is being written

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

Summary

Remark42's image proxy contains a cross-site scripting flaw where attacker-controlled content can be rendered as HTML/JavaScript under the Remark42 origin.

By spoofing the Content-Type of a remote resource and abusing inconsistent MIME handling between download and serving phases, an attacker can execute arbitrary scripts in users' browsers without needing an account.

Affected context

The issue occurs in Remark42 deployments that enable and use the built-in image proxy to fetch and re-serve remote images.

The vulnerability is triggered when Remark42 accepts a remote URL as an image solely based on the upstream Content-Type header, then later re-serves the response after sniffing the actual bytes and emitting a different Content-Type.

Any environment where users or administrators can embed or click links that are passed through the image proxy may be affected, especially when external URLs are incorporated into comment content or templates.

Exploit preconditions

  • Attack surface: Web clients that load content from a Remark42 instance with the image proxy enabled.
  • Required access: No authentication on the target Remark42 instance is required; the attacker only needs to control a remote server or URL and get a victim to load a crafted proxy link.
  • Trigger point: The victim's browser requests an image via the Remark42 image proxy, which has previously fetched and cached attacker-controlled content.
  • Why exploitation is possible: The proxy trusts the upstream Content-Type header during the download step (accepting non-image bytes as an "image"), but later uses byte sniffing (http.DetectContentType) to serve the same content as text/html. This mismatch allows the browser to interpret attacker-supplied HTML/JavaScript as a first-party document under the Remark42 origin.

Why this happens

The root cause is inconsistent and overly trusting MIME-type handling, combining:

  • Reliance on upstream Content-Type headers to decide whether a URL is an image during the fetch phase.
  • Subsequent server-side content sniffing of the response body to determine the Content-Type sent to browsers.

This pattern maps to:

  • CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), because attacker-controlled HTML/JS is served to clients within a trusted origin.
  • CWE-436: Interpretation Conflict, because different components (download vs. serve logic, upstream vs. downstream interpretation) make inconsistent decisions about what the resource is.

The combination of trusting remote headers and later reclassifying the content, without enforcing a strict and stable type boundary, creates a path for untrusted script to run in the application's security context.

Potential impact

  • Attacker-controlled JavaScript may execute in the Remark42 origin in the victim's browser.
  • Session or token theft could be possible where authentication data is accessible via the Remark42 origin.
  • On-page comment content and UI elements can be modified or defaced for affected users.
  • Targeted phishing or drive-by attacks can be launched against visitors of a compromised Remark42 instance.
  • Further pivoting to other applications that trust the Remark42 origin may be possible in integrated environments.

General mitigation guidance

Mitigation generally focuses on enforcing strict, consistent content-type boundaries and minimizing the trust placed in remote responses:

  • Validate that a resource is an image by inspecting its bytes and enforcing known-safe image signatures, not only the upstream Content-Type header.
  • Ensure that the MIME type used to decide whether to cache or accept a resource is identical to what will later be served to clients.
  • Disable or strictly limit proxying of arbitrary third-party URLs; consider allowlists, well-scoped domains, or signed/validated URLs.
  • Avoid serving proxied content as a top-level HTML document; where feasible, serve only as image data with immutable Content-Type headers and restrictive response headers (e.g., X-Content-Type-Options: nosniff, Content-Security-Policy for embedded contexts).
  • Apply defense-in-depth by architecting the proxy as a separate origin or subdomain, reducing the impact of script execution if content-type checks fail.

How teams detect issues like this

Detection can rely on both code-centric and runtime techniques:

  • Static analysis and code review:
  • Look for proxy or fetch logic that trusts remote Content-Type headers to classify resources.
  • Flag any code paths where MIME type decisions diverge between intake (download) and output (serve) logic.
  • Review use of content sniffing APIs like http.DetectContentType and verify that they cannot cause type escalation to HTML/JavaScript for untrusted data.
  • Policy and automated checks:
  • Enforce linting rules or security policies that require stable MIME handling for proxies and image loaders.
  • Integrate automated security scanning tools that detect XSS patterns related to dynamic content serving.
  • Runtime monitoring:
  • Log and monitor uses of the image proxy, especially responses that are served with text/html or other executable content types.
  • Use Content Security Policy (CSP) reporting to surface unexpected script execution originating from proxied resources.

Sources

SourceLink
github.comgithub.com/umputun/remark42/commit/78d6de6bce1e961f023969da3ec8a00dd80c9ae8
github.comgithub.com/umputun/remark42/releases/tag/v1.16.0
github.comgithub.com/umputun/remark42/security/advisories/GHSA-4c8j-mgm4-qqvp

Frequently asked

questions

Yes. An attacker can host a malicious URL on any reachable server and trick a victim into loading a Remark42 image proxy link pointing to that URL; no direct access to the Remark42 server itself is required beyond normal web connectivity.

No. The attacker does not need an account on the target Remark42 instance. The only requirement is that the instance's image proxy will fetch the attacker's URL and that a victim follows or loads the corresponding proxy link.

The safest pattern is to enforce strict and consistent MIME-type validation: verify image content by inspecting bytes with well-defined heuristics, reject any response that does not match expected image formats, and ensure the same classification is used both when caching and when serving. Additionally, avoid ever serving untrusted proxied content as text/html under the primary application origin.

Prevent them by designing proxy and media-handling components around clear trust boundaries: never rely solely on upstream headers, avoid content sniffing that can upgrade non-HTML content into HTML/JS, segregate untrusted content onto separate origins, and incorporate security-focused code reviews and automated checks that specifically look for XSS and MIME interpretation conflicts.

Find out what's already
exploitable in your codebase.