Summary
Thelia versions before 3.1.0 contain a stored cross-site scripting flaw in ForSomeCustomers::getSummary(), where customer names are rendered without adequate escaping. An unauthenticated attacker can register with a crafted name; if an administrator later views a related coupon, the script may run in the administrator's browser and expose CSRF tokens.
Affected context
The issue occurs in Thelia's coupon summary flow when ForSomeCustomers::getSummary() includes customer names in content viewed by administrators. It affects deployments before version 3.1.0 where names supplied during registration can reach this output without context-appropriate escaping.
Exploit preconditions
- Attack surface: Customer registration and administrator-facing coupon summaries
- Required access: No prior authentication is required to register a customer
- Trigger point: An administrator views a related coupon summary containing the attacker-controlled name
- Why exploitation is possible: The customer name is rendered without adequate escaping, allowing browser-executable script to run in the administrator's context
Why this happens
The application inserts user-controlled customer-name data into administrator-facing output without applying context-appropriate output encoding. This is a stored cross-site scripting flaw mapped to CWE-79: Improper Neutralization of Input During Web Page Generation. The unsafe pattern is treating stored user input as trusted when generating HTML.
Potential impact
- Script execution in an administrator's browser
- Exposure of sensitive page data or CSRF tokens, depending on application protections
- Unauthorized administrative actions, potentially including administrator account creation
- Further compromise of the application if administrative privileges are abused
General mitigation guidance
Defensive approaches focus on treating customer-provided values as untrusted at every output boundary.
- Apply context-aware output encoding when rendering names in HTML.
- Prefer template frameworks and APIs that escape output by default.
- Validate input as a supplementary control, not a replacement for output encoding.
- Reduce the privileges and sensitive actions available to browser sessions, and use CSRF protections that do not rely solely on token secrecy.
- Review other administrator-facing views for similar handling of stored user-controlled data.
How teams detect issues like this
- Use static analysis to identify user-controlled values flowing into HTML rendering without context-aware encoding.
- Review templates and summary-generation code for raw or explicitly unescaped output.
- Add tests that verify customer names are rendered as text in administrator-facing pages.
- Enforce secure templating and output-encoding requirements through code review policies and CI checks.
- Monitor for unexpected account creation or suspicious administrative actions following unusual customer registrations.

