/

CVE-2026-35455

Severity:

HIGH RISK

(7.3)

Stored XSS in Immich 360° Panorama OCR Viewer

CVE-2026-35455

Analyzed

Vulnerability type

Category:

Stored Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Authenticated Client-Side Code Execution and Account Compromise

Severity:

HIGH RISK

(7.3)

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

A stored Cross-Site Scripting (XSS) vulnerability in Immich's 360° panorama viewer allows arbitrary JavaScript execution when malicious OCR text is rendered without sanitization.

Any authenticated user who uploads a crafted panorama image can inject persistent script code that executes in the browser of other users who view that panorama with the OCR overlay enabled, potentially exposing sessions, media, and sensitive metadata.

Affected context

This vulnerability affects Immich deployments that use the 360° panorama viewer with OCR overlay enabled for images.

The issue manifests when:

  • Authenticated users can upload equirectangular (360°) images for processing
  • OCR is enabled and extracts text from the uploaded image
  • The viewer renders extracted OCR text into the DOM using innerHTML or equivalent APIs
  • No robust output encoding or HTML sanitization is applied to the OCR text before rendering

Under these conditions, attacker-controlled text embedded in an image can persist in the system and execute in the browser of any user viewing the affected panorama.

Exploit preconditions

  • Attack surface: Web application UI, specifically the 360° panorama viewer with OCR overlay.
  • Required access: Authenticated user account with permission to upload images that are processed by OCR.
  • User interaction: A victim must open the malicious panorama and enable or view the OCR overlay in their browser.
  • Data path:
  • The attacker uploads an equirectangular panorama containing crafted text content.
  • OCR processes the image, extracts the text, and stores it as part of the image metadata or associated data.
  • The panorama viewer later retrieves this OCR text and injects it into the DOM via innerHTML without sanitization.
  • Why exploitation is possible: The application treats OCR output as trusted HTML content and renders it without output encoding or sanitization, allowing embedded script constructs to be interpreted by the browser.

Why this happens

The underlying bug is a classic stored XSS pattern mapped to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').

In this case, the "input" is not a typical form field or URL parameter but text derived from an uploaded image via OCR. The system fails to treat this OCR-derived text as untrusted and subsequently renders it directly into the browser using innerHTML or similar DOM APIs. Because there is no HTML-escaping or sanitization, any markup-like content embedded in the OCR text can be interpreted as active HTML/JavaScript. This turns passively stored OCR data into executable script when the panorama viewer is loaded, resulting in persistent script execution across user sessions.

Potential impact

  • Attackers may execute arbitrary JavaScript in the context of the victim's Immich session.
  • Attackers could create or steal persistent API keys, effectively hijacking user accounts.
  • Attackers may exfiltrate private photos, videos, and associated metadata accessible to the victim account.
  • Attackers can access and exfiltrate GPS location history stored with media.
  • Attackers may access face recognition / biometric clustering data, including associations between faces and identities.
  • Attackers can perform actions on the victim's behalf (e.g., modify settings, share media, manage albums) within the permissions of the compromised account.

General mitigation guidance

Effective mitigation centers on consistent output encoding and treating all derived content as untrusted:

  • Apply strict output encoding when rendering any user-controlled or user-derived data (including OCR text) into HTML; use text-only insertion APIs (e.g., textContent) instead of innerHTML wherever possible.
  • Where rich text is required, pass content through a well-maintained HTML sanitization library that enforces a minimal, allow-listed subset of tags and attributes, explicitly removing scriptable constructs, event handlers, and dangerous URLs.
  • Treat OCR output as untrusted input at all stages, enforcing the same security controls as for manually entered user content.
  • Architect view components so that data and presentation are separated, and templates encode data by default instead of requiring manual escaping.
  • Limit the privileges associated with user sessions and API keys; use least-privilege design so that compromise of a single account has constrained blast radius.
  • Implement Content Security Policy (CSP) to reduce the impact of injected scripts, favoring restrictions on inline script execution and untrusted script sources where compatible with the application.

How teams detect issues like this

Detection strategies can focus both on code-level issues and runtime behavior:

  • Static analysis & linting:
  • Flag uses of innerHTML, outerHTML, insertAdjacentHTML, or equivalent APIs where the source is not clearly trusted and sanitized.
  • Identify rendering paths where OCR or other derived content flows directly into DOM construction without explicit encoding.
  • Use framework-specific security linters or rules that enforce safe templating and output encoding practices.
  • Code review cues:
  • Look for templates or components that display OCR, EXIF, captions, or other derived metadata and verify they rely on encoded bindings rather than raw HTML injection.
  • Review any feature that converts non-text content (images, PDFs) into text for display and ensure the text is treated as untrusted.
  • Confirm that any sanitization logic is centralized, tested, and not bypassed by "special case" code paths.
  • Runtime monitoring:
  • Monitor security logs and browser console reports (e.g., CSP violation reports) for unexpected script execution related to media viewing pages.
  • Use web application security scanners that crawl authenticated areas and attempt stored XSS patterns in metadata fields, particularly around media upload and OCR features.

Sources

SourceLink
github.comgithub.com/immich-app/immich/security/advisories/GHSA-9qx4-67jm-cc66

Frequently asked

questions

Yes, if the Immich instance is accessible over the internet and user registration or account creation is possible, an attacker can register, upload a malicious panorama, and wait for other users to view it. The exploit itself runs in the victim's browser when they access the crafted media with OCR overlay enabled.

Yes. The attacker must have an authenticated account with permissions to upload images that are processed by OCR. Victims only need to be authenticated users who can view the malicious panorama and its OCR overlay.

The safest fix is to treat all OCR text as untrusted and ensure it is either inserted using text-only DOM APIs or passed through robust HTML sanitization before rendering. Broadly, remove direct uses of innerHTML (and similar APIs) with untrusted data and rely on templating systems or output encoding that escape special characters by default.

Adopt a consistent output-encoding policy for all user-controlled and derived data, enforce secure coding guidelines that prohibit raw HTML injection from untrusted sources, and integrate automated checks (linting, static analysis, and security review) into the development pipeline. Additionally, design new features—especially those involving content extraction like OCR—under the assumption that all produced text may be attacker-controlled.

Find out what's already
exploitable in your codebase.