/

CVE-2026-42556

Severity:

HIGH RISK

(8.9)

Cross-Site Scripting (XSS) in Postiz Post Preview Rendering

CVE-2026-42556

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting on primary application origin

Severity:

HIGH RISK

(8.9)

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

Postiz versions 2.21.6 through 2.21.6 allow authenticated users who can create posts to inject arbitrary HTML into post content and have it rendered in the public preview page.

By tampering with their own save request and sharing the /p/<postId>?share=true preview link, an attacker can cause other users' browsers to execute untrusted scripts on the main application origin.

Affected context

This vulnerability occurs in the Postiz AI social media scheduling platform, specifically in the public post preview feature.

It affects deployments where:

  • Users can create posts and trigger a save operation for post content
  • The post preview is accessible via links of the form /p/<postId>?share=true
  • Preview pages render stored post content using dangerouslySetInnerHTML or equivalent raw HTML injection on the main application origin

The issue manifests when user-controlled HTML is persisted in post data and rendered without robust sanitization or encoding.

Exploit preconditions

  • Attack surface: Web UI (public post preview endpoint) served from the primary Postiz origin.
  • Required access: Authenticated account with permission to create or edit posts; no elevated administrative rights are required.
  • Attacker capabilities: Ability to intercept or modify their own post save request (e.g., via browser dev tools, intercepting proxy, or custom client) to inject arbitrary HTML/JavaScript into the post content.
  • Trigger point: Another user (or the attacker in a different browser/session) visits the crafted preview URL /p/<postId>?share=true, causing the stored content to be rendered.
  • Why exploitation is possible: The preview page directly injects stored post content into the DOM using dangerouslySetInnerHTML without adequate sanitization or output encoding, allowing embedded scripts or event handlers to execute within the origin's security context.

Why this happens

The underlying bug is a stored cross-site scripting issue where user-supplied content is persisted and later rendered as raw HTML on a page that shares the main application origin.

React's dangerouslySetInnerHTML API is used to inject the stored post content into the DOM, but the application does not sufficiently sanitize or encode this content before rendering.

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), where untrusted input flows into an HTML context without proper output encoding, enabling the execution of attacker-controlled scripts when other users view the affected page.

Potential impact

  • Attacker-controlled scripts may execute in the victim's browser under the trusted Postiz origin.
  • Session or authentication tokens stored in accessible contexts (e.g., local storage, session storage) could be read and exfiltrated, potentially leading to account compromise.
  • User actions could be performed on behalf of the victim (e.g., modifying posts, changing settings) via DOM manipulation or authenticated API calls.
  • Sensitive data visible in the Postiz UI may be captured and sent to an attacker-controlled endpoint.
  • Malicious content could be used to stage phishing attacks or deliver further browser-based exploits.

General mitigation guidance

Effective mitigation focuses on ensuring that untrusted content is never rendered as executable HTML/JavaScript:

  • Treat all user-supplied post content as untrusted and apply context-aware output encoding by default when rendering to HTML.
  • Avoid using raw HTML injection mechanisms such as dangerouslySetInnerHTML unless absolutely necessary; prefer safe component-based rendering and text nodes.
  • When rich text is required, use a well-maintained, security-focused HTML sanitizer that enforces an allowlist of safe tags and attributes, and strips or neutralizes scripts, event handlers, and dangerous URL schemes.
  • Separate the origin or domain for untrusted content previews where feasible (e.g., serve previews from a different subdomain with limited privileges) to reduce impact if content is mishandled.
  • Apply least-privilege principles in the browser by minimizing reliance on long-lived tokens in web storage and restricting what actions can be performed automatically on page load.

How teams detect issues like this

Detection generally involves both code-level and runtime approaches:

  • Static analysis: Configure linters or SAST tools to flag uses of dangerouslySetInnerHTML, direct innerHTML assignments, and other raw DOM injection APIs, especially when the source is user-controlled content.
  • Code review: Establish review checklists that require explicit justification and documented sanitization for any raw HTML rendering in React or similar frameworks.
  • Security testing: Incorporate automated and manual XSS testing into CI/CD, including fuzzing of post content fields and automated crawling of preview endpoints.
  • Runtime monitoring: Use web application firewalls (WAF) or equivalent reverse-proxy rules to detect and log suspicious HTML/JavaScript payloads in application requests, especially those that end up in stored content.
  • Policy enforcement: Adopt secure coding guidelines that mandate context-aware encoding and use of vetted sanitization libraries for any user-rendered HTML, and enforce them through PR templates and automated checks.

Sources

SourceLink
github.comgithub.com/gitroomhq/postiz-app/releases/tag/v2.21.7
github.comgithub.com/gitroomhq/postiz-app/security/advisories/GHSA-hhxq-3wg7-4rj8

Frequently asked

questions

The issue is broadly exploitable by any authenticated user who can create or edit posts and can share the corresponding preview link. Victims only need to visit the crafted /p/<postId>?share=true URL for the malicious script to execute.

An attacker needs a valid Postiz account with permissions to create posts, plus the ability to modify their own outgoing save request (which most users can do with a browser's developer tools). No special administrative privileges are required.

The safest approach is to eliminate direct raw HTML rendering from untrusted sources. Replace dangerouslySetInnerHTML with component-based rendering or text nodes, and if HTML must be supported, pass content through a strict, vetted sanitizer and encode it appropriately before rendering.

Adopt a defense-in-depth strategy: enforce output encoding by default, restrict or ban use of dangerouslySetInnerHTML without explicit security review, standardize on trusted sanitization libraries for any rich text rendering, and integrate automated checks in CI/CD to flag unsafe HTML injection patterns early in development.

Find out what's already
exploitable in your codebase.