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.

