Details
Proof of concept
Setup
- Install YesWiki and log in as admin (or as any user with the
saisie_formulaireACL). - Navigate to *Bazar → Formulaires → Nouveau formulaire* and create a form. Add any field of type
range,email, or any other field type (every field type renders throughlayouts/input.twig, so thetitle=/alt=/ label-body vectors apply universally).
PoC 1 — range.twig placeholder attribute breakout (Sink class [B])
Set the field's label to:
Enter value" onmouseover="alert('XSS via field.label in range.twig')" x="
Save the form. Have any visitor (including unauthenticated guests if the form is published) open a page that renders the form. Hovering the range input fires the injected handler.
Rendered HTML:
<input type="range" … placeholder="Enter value" onmouseover="alert('XSS via field.label in range.twig')" x="" required />
PoC 2 — layouts/input.twig tooltip injection (Sink class [C])
Set the field's hint (Aide) to:
"><script>alert('XSS via field.hint in layouts/input.twig — fires on EVERY field type')</script><span x="
Save. Any page that renders the form executes the script at parse time, before any user interaction. The vector is universal because layouts/input.twig is the base template extended by every field type.
PoC 3 — layouts/input.twig label-body injection (Sink class [D])
Set the field's label to:
<img src=x onerror="alert('XSS via field.label in layouts/input.twig')">
Save. Page render fires the onerror immediately — no hover, no click, no striptags filter in the way.
Impact
Direct
- Stored XSS on every visitor of any Bazar form page — a privileged form editor injects script into a field's label/hint and the script runs in the wiki origin against every viewer of the form, including unauthenticated guests. Cookie theft, session hijack of any admin who visits, full content modification, phishing overlays.
- Universal sink in `layouts/input.twig` — sinks [C] and [D] live in the base layout extended by every field type, so a single field with a malicious hint poisons every form render across the wiki, not just forms using a specific input type.
Indirect / second-order
- Privilege amplification despite `saisie_formulaire` being admin-only by default — many deployments grant
saisie_formulaireto specific user groups (per-deployment ACL configured viaconfig['permissions']['action']['saisie_formulaire']). For those deployments, the bug is exploitable by any user in those groups against any visitor. The audit pattern at commitfe7244b(the same team explicitly gatedimported-formPOST handling onsaisie_formulaire) demonstrates thatsaisie_formulaireis in fact a "trusted-input" boundary — outputs of that boundary should not assume HTML-safety. - Composability with the unpatched POI/CSRF in `BazarImportAction` (reported separately as `01-bazarimport-poi-csrf.md`) — once any XSS exists in the wiki origin, an attacker can fetch a CSRF token (if added as part of the POI fix) and chain XSS → POI → RCE without needing to phish the admin onto a third-party origin.
- The pre-`fe7244b` window — for any deployment still running a build that predates
fe7244b(theimported-formauth fix from 2026-05-12), the source offield.label/field.hintwas reachable from unauthenticated POST to theimported-formhandler, making this finding unauth-stored-XSS on those builds. The current code path closes that source side, but reinforces that the sink-side fix ate6b66aashould be applied class-wide.
Suggested fix
Apply the same transformation e6b66aa applied to text.twig / textarea.twig placeholders, class-wide:
- For attribute contexts (
placeholder=,title=,alt=, etc.) — drop therawfilter. Let Twig's attribute-context autoescape handle the value:
placeholder="{{ field.label|striptags|trim }}"
title="{{ field.hint|striptags|trim }}"
alt="{{ field.hint|striptags|trim }}"
striptags is fine to keep if there's a UX reason to strip incidental HTML; the security is in the absence of raw.
- For label-body contexts (
<label>{{ field.label|raw }}</label>) — decide which is the design intent and apply it everywhere: - If labels really need to render bold/italic/links: pass
field.labelthroughHtmlPurifierService::cleanHTML()at the point where the field object is constructed (i.e.BazarField::__construct's$this->label = …line), so any subsequent template emits already-purified HTML andrawbecomes safe. - If labels are plain text: drop the
rawfilter and let{{ field.label }}autoescape.
The label-body case in layouts/input.twig:9, layouts/field.twig:5, and the four inputs/*.twig files is the highest-impact patch target because it's reached by every field type; the attribute-context cases are more surgical.
Sweep target list (all in tools/bazar/templates/):
inputs/range.twig:19inputs/email.twig:13layouts/input.twig:7, 9layouts/field.twig:5inputs/textarea.twig:14, 16inputs/user.twig:41, 55inputs/bookmarklet.twig:4, 6inputs/subscribe.twig:16inputs/linked-entry.twig:4
A grep-driven CI check for |raw('html') and |raw inside Bazar twig templates would surface any future reintroduction.