/

CVE-2026-107845

Severity:

CRITICAL RISK

(9.3)

Stored XSS (CWE-79) in Contao Comments Administration

CVE-2026-107845

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79, CWE-116

Impact:

Arbitrary script execution in the Contao backend origin, potentially enabling session compromise and unauthorized backend actions

Severity:

CRITICAL RISK

(9.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

Contao contains a stored cross-site scripting vulnerability in comment metadata rendering. An unauthenticated visitor may submit a comment containing script in email or website fields, which can execute when a backend user opens the Comments module.

Contao contains a stored cross-site scripting vulnerability in comment metadata rendering. An unauthenticated visitor may submit a comment containing script in email or website fields, which can execute when a backend user opens the Comments module.

Affected context

The issue occurs in Contao deployments where the Comments module displays attacker-controlled email or website metadata without sufficient HTML attribute and URL encoding. Unpublished comments may still be visible to moderators, so exposure can occur before a comment is approved or published.

The issue occurs in Contao deployments where the Comments module displays attacker-controlled email or website metadata without sufficient HTML attribute and URL encoding. Unpublished comments may still be visible to moderators, so exposure can occur before a comment is approved or published.

Exploit preconditions

  • Attack surface: Public comment submission functionality
  • Required access: No authentication is required to submit the affected comment data
  • Trigger point: A backend user opens the Comments module containing the crafted comment
  • Why exploitation is possible: Comment metadata is rendered without context-appropriate attribute and URL encoding, allowing submitted content to be interpreted as active browser script
  • Attack surface: Public comment submission functionality
  • Required access: No authentication is required to submit the affected comment data
  • Trigger point: A backend user opens the Comments module containing the crafted comment
  • Why exploitation is possible: Comment metadata is rendered without context-appropriate attribute and URL encoding, allowing submitted content to be interpreted as active browser script

Why this happens

The vulnerability is caused by insufficient output encoding when untrusted comment metadata is inserted into HTML attributes or URL-related contexts. This maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation, with CWE-116: Improper Encoding or Escaping of Output describing the missing context-sensitive encoding. The insecure pattern is trusting stored user input at rendering time instead of treating it as data that must be safely encoded for its specific output context.

The vulnerability is caused by insufficient output encoding when untrusted comment metadata is inserted into HTML attributes or URL-related contexts. This maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation, with CWE-116: Improper Encoding or Escaping of Output describing the missing context-sensitive encoding. The insecure pattern is trusting stored user input at rendering time instead of treating it as data that must be safely encoded for its specific output context.

Potential impact

  • A malicious script may execute in the Contao backend origin
  • An attacker could potentially act through a moderator's authenticated session
  • Backend data or configuration may be exposed
  • Unauthorized administrative actions could be performed
  • Other backend users may be targeted when reviewing comments
  • A malicious script may execute in the Contao backend origin
  • An attacker could potentially act through a moderator's authenticated session
  • Backend data or configuration may be exposed
  • Unauthorized administrative actions could be performed
  • Other backend users may be targeted when reviewing comments

General mitigation guidance

Mitigation generally focuses on consistent, context-aware output encoding and reducing trust in submitted metadata.

Common defensive patterns include:

  • HTML-attribute-encode all untrusted values before rendering them in attributes
  • Validate and normalize website values using an allowlisted URL scheme and format
  • Avoid constructing executable HTML or script-capable URLs from user-controlled input
  • Apply a restrictive Content Security Policy as defense in depth
  • Limit backend privileges and isolate moderation capabilities according to role
  • Ensure unpublished content receives the same output-safety treatment as published content

Mitigation generally focuses on consistent, context-aware output encoding and reducing trust in submitted metadata.

Common defensive patterns include:

  • HTML-attribute-encode all untrusted values before rendering them in attributes
  • Validate and normalize website values using an allowlisted URL scheme and format
  • Avoid constructing executable HTML or script-capable URLs from user-controlled input
  • Apply a restrictive Content Security Policy as defense in depth
  • Limit backend privileges and isolate moderation capabilities according to role
  • Ensure unpublished content receives the same output-safety treatment as published content

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules for unescaped template output and dynamic attribute construction
  • Code review checks covering every rendering context for comment and profile metadata
  • Tests that submit markup, event-handler syntax, and unsafe URL schemes to public forms
  • Policy enforcement requiring contextual encoding and URL-scheme allowlists
  • Monitoring for unusual comment submissions and unexpected script-like content in metadata

Automated application-security and code-review tools may help identify missing escaping, but rendered-output testing remains important.

Organizations can look for this class of issue through:

  • Static analysis rules for unescaped template output and dynamic attribute construction
  • Code review checks covering every rendering context for comment and profile metadata
  • Tests that submit markup, event-handler syntax, and unsafe URL schemes to public forms
  • Policy enforcement requiring contextual encoding and URL-scheme allowlists
  • Monitoring for unusual comment submissions and unexpected script-like content in metadata

Automated application-security and code-review tools may help identify missing escaping, but rendered-output testing remains important.

Sources

SourceLink
github.comgithub.com/contao/contao/commit/22505d5f79bc1a7f52e2cba5fddf6007e1f0408a
github.comgithub.com/contao/contao/releases/tag/5.3.50
github.comgithub.com/contao/contao/releases/tag/5.7.12
github.comgithub.com/contao/contao/security/advisories/GHSA-628f-v4f6-p37r

Frequently asked

questions

Yes. An unauthenticated visitor can submit the affected comment data remotely, but script execution generally requires a backend user to view the comment in the Contao administration area.

No. The described submission path is available to unauthenticated visitors. The victim needs an authenticated backend session and must open the relevant Comments module.

Encode untrusted values for their exact output context, validate website URLs with an allowlist, and ensure stored comments are safely rendered regardless of publication status.

Use framework-native contextual escaping, test public inputs in administrative views, enforce restrictive content security policies, and review all user-controlled values that cross from public forms into privileged interfaces.

Yes. An unauthenticated visitor can submit the affected comment data remotely, but script execution generally requires a backend user to view the comment in the Contao administration area.

No. The described submission path is available to unauthenticated visitors. The victim needs an authenticated backend session and must open the relevant Comments module.

Encode untrusted values for their exact output context, validate website URLs with an allowlist, and ensure stored comments are safely rendered regardless of publication status.

Use framework-native contextual escaping, test public inputs in administrative views, enforce restrictive content security policies, and review all user-controlled values that cross from public forms into privileged interfaces.

Find out what's already
exploitable in your codebase.